aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2017-04-11 10:21:01 -0400
committerJan Kara <jack@suse.cz>2017-04-19 08:21:23 -0400
commit12fd086d3946f753fe0d3db01c2cd037a7d76f4e (patch)
tree58e12f60839a3a8a91896fcbfac197ca55dca162
parent161f3b74479b1e486fc784111491023a5bc57bf7 (diff)
jfs: Set flags on quota files directly
Currently immutable and noatime flags on quota files are set by quota code which requires us to copy inode->i_flags to our on disk version of quota flags in GETFLAGS ioctl and copy_to_dinode(). Move to setting / clearing these on-disk flags directly to save that copying. Signed-off-by: Jan Kara <jack@suse.cz>
-rw-r--r--fs/jfs/super.c79
1 files changed, 77 insertions, 2 deletions
diff --git a/fs/jfs/super.c b/fs/jfs/super.c
index c64c2574a0aa..e8aad7d87b8c 100644
--- a/fs/jfs/super.c
+++ b/fs/jfs/super.c
@@ -45,6 +45,7 @@
45#include "jfs_acl.h" 45#include "jfs_acl.h"
46#include "jfs_debug.h" 46#include "jfs_debug.h"
47#include "jfs_xattr.h" 47#include "jfs_xattr.h"
48#include "jfs_dinode.h"
48 49
49MODULE_DESCRIPTION("The Journaled Filesystem (JFS)"); 50MODULE_DESCRIPTION("The Journaled Filesystem (JFS)");
50MODULE_AUTHOR("Steve Best/Dave Kleikamp/Barry Arndt, IBM"); 51MODULE_AUTHOR("Steve Best/Dave Kleikamp/Barry Arndt, IBM");
@@ -181,6 +182,35 @@ static int jfs_statfs(struct dentry *dentry, struct kstatfs *buf)
181 return 0; 182 return 0;
182} 183}
183 184
185#ifdef CONFIG_QUOTA
186static int jfs_quota_off(struct super_block *sb, int type);
187static int jfs_quota_on(struct super_block *sb, int type, int format_id,
188 const struct path *path);
189
190static 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
198static 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
209static inline void jfs_quota_off_umount(struct super_block *sb)
210{
211}
212#endif
213
184static void jfs_put_super(struct super_block *sb) 214static void jfs_put_super(struct super_block *sb)
185{ 215{
186 struct jfs_sb_info *sbi = JFS_SBI(sb); 216 struct jfs_sb_info *sbi = JFS_SBI(sb);
@@ -188,7 +218,7 @@ static void jfs_put_super(struct super_block *sb)
188 218
189 jfs_info("In jfs_put_super"); 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 rc = jfs_umount(sb); 223 rc = jfs_umount(sb);
194 if (rc) 224 if (rc)
@@ -536,7 +566,7 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
536 sb->s_xattr = jfs_xattr_handlers; 566 sb->s_xattr = jfs_xattr_handlers;
537#ifdef CONFIG_QUOTA 567#ifdef CONFIG_QUOTA
538 sb->dq_op = &dquot_operations; 568 sb->dq_op = &dquot_operations;
539 sb->s_qcop = &dquot_quotactl_ops; 569 sb->s_qcop = &jfs_quotactl_ops;
540 sb->s_quota_types = QTYPE_MASK_USR | QTYPE_MASK_GRP; 570 sb->s_quota_types = QTYPE_MASK_USR | QTYPE_MASK_GRP;
541#endif 571#endif
542 572
@@ -840,6 +870,51 @@ static struct dquot **jfs_get_dquots(struct inode *inode)
840{ 870{
841 return JFS_IP(inode)->i_dquot; 871 return JFS_IP(inode)->i_dquot;
842} 872}
873
874static 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
895static 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);
912out_put:
913 iput(inode);
914 return err;
915out:
916 return dquot_quota_off(sb, type);
917}
843#endif 918#endif
844 919
845static const struct super_operations jfs_super_operations = { 920static const struct super_operations jfs_super_operations = {