aboutsummaryrefslogtreecommitdiffstats
path: root/fs/quota/quota.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2010-05-06 17:05:17 -0400
committerJan Kara <jack@suse.cz>2010-05-21 13:30:44 -0400
commitc472b43275976512e4c1c32da5ced03f339cb380 (patch)
tree9159fbfd1190456e8b3e699b856022c23f6ec10c /fs/quota/quota.c
parentb9b2dd36c1bc64430f8e13990ab135cbecc10076 (diff)
quota: unify ->set_dqblk
Pass the larger struct fs_disk_quota to the ->set_dqblk operation so that the Q_SETQUOTA and Q_XSETQUOTA operations can be implemented with a single filesystem operation and we can retire the ->set_xquota operation. The additional information (RT-subvolume accounting and warn counts) are left zero for the VFS quota implementation. Add new fieldmask values for setting the numer of blocks and inodes values which is required for the VFS quota, but wasn't for XFS. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/quota/quota.c')
-rw-r--r--fs/quota/quota.c36
1 files changed, 31 insertions, 5 deletions
diff --git a/fs/quota/quota.c b/fs/quota/quota.c
index 8680e257c2bd..d6ee49dda4fd 100644
--- a/fs/quota/quota.c
+++ b/fs/quota/quota.c
@@ -167,18 +167,44 @@ static int quota_getquota(struct super_block *sb, int type, qid_t id,
167 return 0; 167 return 0;
168} 168}
169 169
170static void copy_from_if_dqblk(struct fs_disk_quota *dst, struct if_dqblk *src)
171{
172 dst->d_blk_hardlimit = src->dqb_bhardlimit;
173 dst->d_blk_softlimit = src->dqb_bsoftlimit;
174 dst->d_bcount = src->dqb_curspace;
175 dst->d_ino_hardlimit = src->dqb_ihardlimit;
176 dst->d_ino_softlimit = src->dqb_isoftlimit;
177 dst->d_icount = src->dqb_curinodes;
178 dst->d_btimer = src->dqb_btime;
179 dst->d_itimer = src->dqb_itime;
180
181 dst->d_fieldmask = 0;
182 if (src->dqb_valid & QIF_BLIMITS)
183 dst->d_fieldmask |= FS_DQ_BSOFT | FS_DQ_BHARD;
184 if (src->dqb_valid & QIF_SPACE)
185 dst->d_fieldmask |= FS_DQ_BCOUNT;
186 if (src->dqb_valid & QIF_ILIMITS)
187 dst->d_fieldmask |= FS_DQ_ISOFT | FS_DQ_IHARD;
188 if (src->dqb_valid & QIF_INODES)
189 dst->d_fieldmask |= FS_DQ_ICOUNT;
190 if (src->dqb_valid & QIF_BTIME)
191 dst->d_fieldmask |= FS_DQ_BTIMER;
192 if (src->dqb_valid & QIF_ITIME)
193 dst->d_fieldmask |= FS_DQ_ITIMER;
194}
195
170static int quota_setquota(struct super_block *sb, int type, qid_t id, 196static int quota_setquota(struct super_block *sb, int type, qid_t id,
171 void __user *addr) 197 void __user *addr)
172{ 198{
199 struct fs_disk_quota fdq;
173 struct if_dqblk idq; 200 struct if_dqblk idq;
174 201
175 if (copy_from_user(&idq, addr, sizeof(idq))) 202 if (copy_from_user(&idq, addr, sizeof(idq)))
176 return -EFAULT; 203 return -EFAULT;
177 if (!sb_has_quota_active(sb, type))
178 return -ESRCH;
179 if (!sb->s_qcop->set_dqblk) 204 if (!sb->s_qcop->set_dqblk)
180 return -ENOSYS; 205 return -ENOSYS;
181 return sb->s_qcop->set_dqblk(sb, type, id, &idq); 206 copy_from_if_dqblk(&fdq, &idq);
207 return sb->s_qcop->set_dqblk(sb, type, id, &fdq);
182} 208}
183 209
184static int quota_setxstate(struct super_block *sb, int cmd, void __user *addr) 210static int quota_setxstate(struct super_block *sb, int cmd, void __user *addr)
@@ -212,9 +238,9 @@ static int quota_setxquota(struct super_block *sb, int type, qid_t id,
212 238
213 if (copy_from_user(&fdq, addr, sizeof(fdq))) 239 if (copy_from_user(&fdq, addr, sizeof(fdq)))
214 return -EFAULT; 240 return -EFAULT;
215 if (!sb->s_qcop->set_xquota) 241 if (!sb->s_qcop->set_dqblk)
216 return -ENOSYS; 242 return -ENOSYS;
217 return sb->s_qcop->set_xquota(sb, type, id, &fdq); 243 return sb->s_qcop->set_dqblk(sb, type, id, &fdq);
218} 244}
219 245
220static int quota_getxquota(struct super_block *sb, int type, qid_t id, 246static int quota_getxquota(struct super_block *sb, int type, qid_t id,