aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/quota_local.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2012-09-16 06:56:19 -0400
committerEric W. Biederman <ebiederm@xmission.com>2012-09-18 04:01:41 -0400
commit4c376dcae892e5b5daf8576c864061d076d4e4dc (patch)
treedbb4dbc9422992a00f7b478e4254b4da922f7158 /fs/ocfs2/quota_local.c
parentaca645a6a54e001e004f1f1e0eafd94f994bb1b3 (diff)
userns: Convert struct dquot dq_id to be a struct kqid
Change struct dquot dq_id to a struct kqid and remove the now unecessary dq_type. Make minimal changes to dquot, quota_tree, quota_v1, quota_v2, ext3, ext4, and ocfs2 to deal with the change in quota structures and signatures. The ocfs2 changes are larger than most because of the extensive tracing throughout the ocfs2 quota code that prints out dq_id. quota_tree.c:get_index is modified to take a struct kqid instead of a qid_t because all of it's callers pass in dquot->dq_id and it allows me to introduce only a single conversion. The rest of the changes are either just replacing dq_type with dq_id.type, adding conversions to deal with the change in type and occassionally adding qid_eq to allow quota id comparisons in a user namespace safe way. Cc: Mark Fasheh <mfasheh@suse.com> Cc: Joel Becker <jlbec@evilplan.org> Cc: Jan Kara <jack@suse.cz> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Andreas Dilger <adilger.kernel@dilger.ca> Cc: Theodore Tso <tytso@mit.edu> Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Diffstat (limited to 'fs/ocfs2/quota_local.c')
-rw-r--r--fs/ocfs2/quota_local.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/fs/ocfs2/quota_local.c b/fs/ocfs2/quota_local.c
index 020f0ba29ee5..27fe7ee4874c 100644
--- a/fs/ocfs2/quota_local.c
+++ b/fs/ocfs2/quota_local.c
@@ -883,7 +883,8 @@ static void olq_set_dquot(struct buffer_head *bh, void *private)
883 dqblk = (struct ocfs2_local_disk_dqblk *)(bh->b_data 883 dqblk = (struct ocfs2_local_disk_dqblk *)(bh->b_data
884 + ol_dqblk_block_offset(sb, od->dq_local_off)); 884 + ol_dqblk_block_offset(sb, od->dq_local_off));
885 885
886 dqblk->dqb_id = cpu_to_le64(od->dq_dquot.dq_id); 886 dqblk->dqb_id = cpu_to_le64(from_kqid(&init_user_ns,
887 od->dq_dquot.dq_id));
887 spin_lock(&dq_data_lock); 888 spin_lock(&dq_data_lock);
888 dqblk->dqb_spacemod = cpu_to_le64(od->dq_dquot.dq_dqb.dqb_curspace - 889 dqblk->dqb_spacemod = cpu_to_le64(od->dq_dquot.dq_dqb.dqb_curspace -
889 od->dq_origspace); 890 od->dq_origspace);
@@ -893,7 +894,7 @@ static void olq_set_dquot(struct buffer_head *bh, void *private)
893 trace_olq_set_dquot( 894 trace_olq_set_dquot(
894 (unsigned long long)le64_to_cpu(dqblk->dqb_spacemod), 895 (unsigned long long)le64_to_cpu(dqblk->dqb_spacemod),
895 (unsigned long long)le64_to_cpu(dqblk->dqb_inodemod), 896 (unsigned long long)le64_to_cpu(dqblk->dqb_inodemod),
896 od->dq_dquot.dq_id); 897 from_kqid(&init_user_ns, od->dq_dquot.dq_id));
897} 898}
898 899
899/* Write dquot to local quota file */ 900/* Write dquot to local quota file */
@@ -902,7 +903,7 @@ int ocfs2_local_write_dquot(struct dquot *dquot)
902 struct super_block *sb = dquot->dq_sb; 903 struct super_block *sb = dquot->dq_sb;
903 struct ocfs2_dquot *od = OCFS2_DQUOT(dquot); 904 struct ocfs2_dquot *od = OCFS2_DQUOT(dquot);
904 struct buffer_head *bh; 905 struct buffer_head *bh;
905 struct inode *lqinode = sb_dqopt(sb)->files[dquot->dq_type]; 906 struct inode *lqinode = sb_dqopt(sb)->files[dquot->dq_id.type];
906 int status; 907 int status;
907 908
908 status = ocfs2_read_quota_phys_block(lqinode, od->dq_local_phys_blk, 909 status = ocfs2_read_quota_phys_block(lqinode, od->dq_local_phys_blk,
@@ -1223,7 +1224,7 @@ static void olq_alloc_dquot(struct buffer_head *bh, void *private)
1223int ocfs2_create_local_dquot(struct dquot *dquot) 1224int ocfs2_create_local_dquot(struct dquot *dquot)
1224{ 1225{
1225 struct super_block *sb = dquot->dq_sb; 1226 struct super_block *sb = dquot->dq_sb;
1226 int type = dquot->dq_type; 1227 int type = dquot->dq_id.type;
1227 struct inode *lqinode = sb_dqopt(sb)->files[type]; 1228 struct inode *lqinode = sb_dqopt(sb)->files[type];
1228 struct ocfs2_quota_chunk *chunk; 1229 struct ocfs2_quota_chunk *chunk;
1229 struct ocfs2_dquot *od = OCFS2_DQUOT(dquot); 1230 struct ocfs2_dquot *od = OCFS2_DQUOT(dquot);
@@ -1277,7 +1278,7 @@ out:
1277int ocfs2_local_release_dquot(handle_t *handle, struct dquot *dquot) 1278int ocfs2_local_release_dquot(handle_t *handle, struct dquot *dquot)
1278{ 1279{
1279 int status; 1280 int status;
1280 int type = dquot->dq_type; 1281 int type = dquot->dq_id.type;
1281 struct ocfs2_dquot *od = OCFS2_DQUOT(dquot); 1282 struct ocfs2_dquot *od = OCFS2_DQUOT(dquot);
1282 struct super_block *sb = dquot->dq_sb; 1283 struct super_block *sb = dquot->dq_sb;
1283 struct ocfs2_local_disk_chunk *dchunk; 1284 struct ocfs2_local_disk_chunk *dchunk;