aboutsummaryrefslogtreecommitdiffstats
path: root/fs/udf/file.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2010-03-03 09:05:02 -0500
committerJan Kara <jack@suse.cz>2010-03-04 18:20:28 -0500
commit759bfee658beab14af7b357156461d0eb852be2c (patch)
tree180cdedd004781ee67c30ce89951324d32910067 /fs/udf/file.c
parent63936ddaa16b9486e2d426ed7b09f559a5c60f87 (diff)
dquot: move dquot transfer responsibility into the filesystem
Currently notify_change calls vfs_dq_transfer directly. This means we tie the quota code into the VFS. Get rid of that and make the filesystem responsible for the transfer. Most filesystems already do this, only ufs and udf need the code added, and for jfs it needs to be enabled unconditionally instead of only when ACLs are enabled. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/udf/file.c')
-rw-r--r--fs/udf/file.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/fs/udf/file.c b/fs/udf/file.c
index f311d509b6a3..35ca47281faa 100644
--- a/fs/udf/file.c
+++ b/fs/udf/file.c
@@ -34,6 +34,7 @@
34#include <linux/errno.h> 34#include <linux/errno.h>
35#include <linux/smp_lock.h> 35#include <linux/smp_lock.h>
36#include <linux/pagemap.h> 36#include <linux/pagemap.h>
37#include <linux/quotaops.h>
37#include <linux/buffer_head.h> 38#include <linux/buffer_head.h>
38#include <linux/aio.h> 39#include <linux/aio.h>
39 40
@@ -217,6 +218,26 @@ const struct file_operations udf_file_operations = {
217 .llseek = generic_file_llseek, 218 .llseek = generic_file_llseek,
218}; 219};
219 220
221static int udf_setattr(struct dentry *dentry, struct iattr *iattr)
222{
223 struct inode *inode = dentry->d_inode;
224 int error;
225
226 error = inode_change_ok(inode, iattr);
227 if (error)
228 return error;
229
230 if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) ||
231 (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) {
232 error = vfs_dq_transfer(inode, iattr) ? -EDQUOT : 0;
233 if (error)
234 return error;
235 }
236
237 return inode_setattr(inode, iattr);
238}
239
220const struct inode_operations udf_file_inode_operations = { 240const struct inode_operations udf_file_inode_operations = {
221 .truncate = udf_truncate, 241 .truncate = udf_truncate,
242 .setattr = udf_setattr,
222}; 243};