mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
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 <[email protected]> Signed-off-by: Jan Kara <[email protected]>
This commit is contained in:
parent
63936ddaa1
commit
759bfee658
8 changed files with 65 additions and 38 deletions
26
fs/jfs/acl.c
26
fs/jfs/acl.c
|
|
@ -20,7 +20,6 @@
|
|||
|
||||
#include <linux/sched.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/quotaops.h>
|
||||
#include <linux/posix_acl_xattr.h>
|
||||
#include "jfs_incore.h"
|
||||
#include "jfs_txnmgr.h"
|
||||
|
|
@ -174,7 +173,7 @@ cleanup:
|
|||
return rc;
|
||||
}
|
||||
|
||||
static int jfs_acl_chmod(struct inode *inode)
|
||||
int jfs_acl_chmod(struct inode *inode)
|
||||
{
|
||||
struct posix_acl *acl, *clone;
|
||||
int rc;
|
||||
|
|
@ -205,26 +204,3 @@ static int jfs_acl_chmod(struct inode *inode)
|
|||
posix_acl_release(clone);
|
||||
return rc;
|
||||
}
|
||||
|
||||
int jfs_setattr(struct dentry *dentry, struct iattr *iattr)
|
||||
{
|
||||
struct inode *inode = dentry->d_inode;
|
||||
int rc;
|
||||
|
||||
rc = inode_change_ok(inode, iattr);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) ||
|
||||
(iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) {
|
||||
if (vfs_dq_transfer(inode, iattr))
|
||||
return -EDQUOT;
|
||||
}
|
||||
|
||||
rc = inode_setattr(inode, iattr);
|
||||
|
||||
if (!rc && (iattr->ia_valid & ATTR_MODE))
|
||||
rc = jfs_acl_chmod(inode);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
|
||||
#include <linux/fs.h>
|
||||
#include <linux/quotaops.h>
|
||||
#include "jfs_incore.h"
|
||||
#include "jfs_inode.h"
|
||||
#include "jfs_dmap.h"
|
||||
|
|
@ -88,14 +89,37 @@ static int jfs_release(struct inode *inode, struct file *file)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int jfs_setattr(struct dentry *dentry, struct iattr *iattr)
|
||||
{
|
||||
struct inode *inode = dentry->d_inode;
|
||||
int rc;
|
||||
|
||||
rc = inode_change_ok(inode, iattr);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) ||
|
||||
(iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) {
|
||||
if (vfs_dq_transfer(inode, iattr))
|
||||
return -EDQUOT;
|
||||
}
|
||||
|
||||
rc = inode_setattr(inode, iattr);
|
||||
|
||||
if (!rc && (iattr->ia_valid & ATTR_MODE))
|
||||
rc = jfs_acl_chmod(inode);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
const struct inode_operations jfs_file_inode_operations = {
|
||||
.truncate = jfs_truncate,
|
||||
.setxattr = jfs_setxattr,
|
||||
.getxattr = jfs_getxattr,
|
||||
.listxattr = jfs_listxattr,
|
||||
.removexattr = jfs_removexattr,
|
||||
#ifdef CONFIG_JFS_POSIX_ACL
|
||||
.setattr = jfs_setattr,
|
||||
#ifdef CONFIG_JFS_POSIX_ACL
|
||||
.check_acl = jfs_check_acl,
|
||||
#endif
|
||||
};
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
int jfs_check_acl(struct inode *, int);
|
||||
int jfs_init_acl(tid_t, struct inode *, struct inode *);
|
||||
int jfs_setattr(struct dentry *, struct iattr *);
|
||||
int jfs_acl_chmod(struct inode *inode);
|
||||
|
||||
#else
|
||||
|
||||
|
|
@ -32,5 +32,10 @@ static inline int jfs_init_acl(tid_t tid, struct inode *inode,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static inline int jfs_acl_chmod(struct inode *inode)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif /* _H_JFS_ACL */
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ extern struct dentry *jfs_fh_to_parent(struct super_block *sb, struct fid *fid,
|
|||
int fh_len, int fh_type);
|
||||
extern void jfs_set_inode_flags(struct inode *);
|
||||
extern int jfs_get_block(struct inode *, sector_t, struct buffer_head *, int);
|
||||
extern int jfs_setattr(struct dentry *, struct iattr *);
|
||||
|
||||
extern const struct address_space_operations jfs_aops;
|
||||
extern const struct inode_operations jfs_dir_inode_operations;
|
||||
|
|
|
|||
|
|
@ -1541,8 +1541,8 @@ const struct inode_operations jfs_dir_inode_operations = {
|
|||
.getxattr = jfs_getxattr,
|
||||
.listxattr = jfs_listxattr,
|
||||
.removexattr = jfs_removexattr,
|
||||
#ifdef CONFIG_JFS_POSIX_ACL
|
||||
.setattr = jfs_setattr,
|
||||
#ifdef CONFIG_JFS_POSIX_ACL
|
||||
.check_acl = jfs_check_acl,
|
||||
#endif
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue