diff options
author | Christoph Hellwig <hch@infradead.org> | 2010-05-06 17:04:58 -0400 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2010-05-21 13:30:43 -0400 |
commit | b9b2dd36c1bc64430f8e13990ab135cbecc10076 (patch) | |
tree | 051bb6a238c9ff98fe135de3e8591c65cf242d46 /fs/quota/quota.c | |
parent | 0636c73ee7b129f77f577aaaefc8dde057be6d18 (diff) |
quota: unify ->get_dqblk
Pass the larger struct fs_disk_quota to the ->get_dqblk operation so
that the Q_GETQUOTA and Q_XGETQUOTA operations can be implemented
with a single filesystem operation and we can retire the ->get_xquota
operation. The additional information (RT-subvolume accounting and
warn counts) are left zero for the VFS quota implementation.
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.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/fs/quota/quota.c b/fs/quota/quota.c index 95388f9b7356..8680e257c2bd 100644 --- a/fs/quota/quota.c +++ b/fs/quota/quota.c | |||
@@ -136,19 +136,32 @@ static int quota_setinfo(struct super_block *sb, int type, void __user *addr) | |||
136 | return sb->s_qcop->set_info(sb, type, &info); | 136 | return sb->s_qcop->set_info(sb, type, &info); |
137 | } | 137 | } |
138 | 138 | ||
139 | static void copy_to_if_dqblk(struct if_dqblk *dst, struct fs_disk_quota *src) | ||
140 | { | ||
141 | dst->dqb_bhardlimit = src->d_blk_hardlimit; | ||
142 | dst->dqb_bsoftlimit = src->d_blk_softlimit; | ||
143 | dst->dqb_curspace = src->d_bcount; | ||
144 | dst->dqb_ihardlimit = src->d_ino_hardlimit; | ||
145 | dst->dqb_isoftlimit = src->d_ino_softlimit; | ||
146 | dst->dqb_curinodes = src->d_icount; | ||
147 | dst->dqb_btime = src->d_btimer; | ||
148 | dst->dqb_itime = src->d_itimer; | ||
149 | dst->dqb_valid = QIF_ALL; | ||
150 | } | ||
151 | |||
139 | static int quota_getquota(struct super_block *sb, int type, qid_t id, | 152 | static int quota_getquota(struct super_block *sb, int type, qid_t id, |
140 | void __user *addr) | 153 | void __user *addr) |
141 | { | 154 | { |
155 | struct fs_disk_quota fdq; | ||
142 | struct if_dqblk idq; | 156 | struct if_dqblk idq; |
143 | int ret; | 157 | int ret; |
144 | 158 | ||
145 | if (!sb_has_quota_active(sb, type)) | ||
146 | return -ESRCH; | ||
147 | if (!sb->s_qcop->get_dqblk) | 159 | if (!sb->s_qcop->get_dqblk) |
148 | return -ENOSYS; | 160 | return -ENOSYS; |
149 | ret = sb->s_qcop->get_dqblk(sb, type, id, &idq); | 161 | ret = sb->s_qcop->get_dqblk(sb, type, id, &fdq); |
150 | if (ret) | 162 | if (ret) |
151 | return ret; | 163 | return ret; |
164 | copy_to_if_dqblk(&idq, &fdq); | ||
152 | if (copy_to_user(addr, &idq, sizeof(idq))) | 165 | if (copy_to_user(addr, &idq, sizeof(idq))) |
153 | return -EFAULT; | 166 | return -EFAULT; |
154 | return 0; | 167 | return 0; |
@@ -210,9 +223,9 @@ static int quota_getxquota(struct super_block *sb, int type, qid_t id, | |||
210 | struct fs_disk_quota fdq; | 223 | struct fs_disk_quota fdq; |
211 | int ret; | 224 | int ret; |
212 | 225 | ||
213 | if (!sb->s_qcop->get_xquota) | 226 | if (!sb->s_qcop->get_dqblk) |
214 | return -ENOSYS; | 227 | return -ENOSYS; |
215 | ret = sb->s_qcop->get_xquota(sb, type, id, &fdq); | 228 | ret = sb->s_qcop->get_dqblk(sb, type, id, &fdq); |
216 | if (!ret && copy_to_user(addr, &fdq, sizeof(fdq))) | 229 | if (!ret && copy_to_user(addr, &fdq, sizeof(fdq))) |
217 | return -EFAULT; | 230 | return -EFAULT; |
218 | return ret; | 231 | return ret; |