|
45 | 45 | #include "jfs_acl.h" |
46 | 46 | #include "jfs_debug.h" |
47 | 47 | #include "jfs_xattr.h" |
| 48 | +#include "jfs_dinode.h" |
48 | 49 |
|
49 | 50 | MODULE_DESCRIPTION("The Journaled Filesystem (JFS)"); |
50 | 51 | MODULE_AUTHOR("Steve Best/Dave Kleikamp/Barry Arndt, IBM"); |
@@ -181,14 +182,43 @@ static int jfs_statfs(struct dentry *dentry, struct kstatfs *buf) |
181 | 182 | return 0; |
182 | 183 | } |
183 | 184 |
|
| 185 | +#ifdef CONFIG_QUOTA |
| 186 | +static int jfs_quota_off(struct super_block *sb, int type); |
| 187 | +static int jfs_quota_on(struct super_block *sb, int type, int format_id, |
| 188 | + const struct path *path); |
| 189 | + |
| 190 | +static void jfs_quota_off_umount(struct super_block *sb) |
| 191 | +{ |
| 192 | + int type; |
| 193 | + |
| 194 | + for (type = 0; type < MAXQUOTAS; type++) |
| 195 | + jfs_quota_off(sb, type); |
| 196 | +} |
| 197 | + |
| 198 | +static const struct quotactl_ops jfs_quotactl_ops = { |
| 199 | + .quota_on = jfs_quota_on, |
| 200 | + .quota_off = jfs_quota_off, |
| 201 | + .quota_sync = dquot_quota_sync, |
| 202 | + .get_state = dquot_get_state, |
| 203 | + .set_info = dquot_set_dqinfo, |
| 204 | + .get_dqblk = dquot_get_dqblk, |
| 205 | + .set_dqblk = dquot_set_dqblk, |
| 206 | + .get_nextdqblk = dquot_get_next_dqblk, |
| 207 | +}; |
| 208 | +#else |
| 209 | +static inline void jfs_quota_off_umount(struct super_block *sb) |
| 210 | +{ |
| 211 | +} |
| 212 | +#endif |
| 213 | + |
184 | 214 | static void jfs_put_super(struct super_block *sb) |
185 | 215 | { |
186 | 216 | struct jfs_sb_info *sbi = JFS_SBI(sb); |
187 | 217 | int rc; |
188 | 218 |
|
189 | 219 | jfs_info("In jfs_put_super"); |
190 | 220 |
|
191 | | - dquot_disable(sb, -1, DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED); |
| 221 | + jfs_quota_off_umount(sb); |
192 | 222 |
|
193 | 223 | rc = jfs_umount(sb); |
194 | 224 | if (rc) |
@@ -536,7 +566,7 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent) |
536 | 566 | sb->s_xattr = jfs_xattr_handlers; |
537 | 567 | #ifdef CONFIG_QUOTA |
538 | 568 | sb->dq_op = &dquot_operations; |
539 | | - sb->s_qcop = &dquot_quotactl_ops; |
| 569 | + sb->s_qcop = &jfs_quotactl_ops; |
540 | 570 | sb->s_quota_types = QTYPE_MASK_USR | QTYPE_MASK_GRP; |
541 | 571 | #endif |
542 | 572 |
|
@@ -840,6 +870,51 @@ static struct dquot **jfs_get_dquots(struct inode *inode) |
840 | 870 | { |
841 | 871 | return JFS_IP(inode)->i_dquot; |
842 | 872 | } |
| 873 | + |
| 874 | +static int jfs_quota_on(struct super_block *sb, int type, int format_id, |
| 875 | + const struct path *path) |
| 876 | +{ |
| 877 | + int err; |
| 878 | + struct inode *inode; |
| 879 | + |
| 880 | + err = dquot_quota_on(sb, type, format_id, path); |
| 881 | + if (err) |
| 882 | + return err; |
| 883 | + |
| 884 | + inode = d_inode(path->dentry); |
| 885 | + inode_lock(inode); |
| 886 | + JFS_IP(inode)->mode2 |= JFS_NOATIME_FL | JFS_IMMUTABLE_FL; |
| 887 | + inode_set_flags(inode, S_NOATIME | S_IMMUTABLE, |
| 888 | + S_NOATIME | S_IMMUTABLE); |
| 889 | + inode_unlock(inode); |
| 890 | + mark_inode_dirty(inode); |
| 891 | + |
| 892 | + return 0; |
| 893 | +} |
| 894 | + |
| 895 | +static int jfs_quota_off(struct super_block *sb, int type) |
| 896 | +{ |
| 897 | + struct inode *inode = sb_dqopt(sb)->files[type]; |
| 898 | + int err; |
| 899 | + |
| 900 | + if (!inode || !igrab(inode)) |
| 901 | + goto out; |
| 902 | + |
| 903 | + err = dquot_quota_off(sb, type); |
| 904 | + if (err) |
| 905 | + goto out_put; |
| 906 | + |
| 907 | + inode_lock(inode); |
| 908 | + JFS_IP(inode)->mode2 &= ~(JFS_NOATIME_FL | JFS_IMMUTABLE_FL); |
| 909 | + inode_set_flags(inode, 0, S_NOATIME | S_IMMUTABLE); |
| 910 | + inode_unlock(inode); |
| 911 | + mark_inode_dirty(inode); |
| 912 | +out_put: |
| 913 | + iput(inode); |
| 914 | + return err; |
| 915 | +out: |
| 916 | + return dquot_quota_off(sb, type); |
| 917 | +} |
843 | 918 | #endif |
844 | 919 |
|
845 | 920 | static const struct super_operations jfs_super_operations = { |
|
0 commit comments