summaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_acl.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2020-02-27 04:30:44 +0300
committerDarrick J. Wong <darrick.wong@oracle.com>2020-03-03 07:55:55 +0300
commited02d13f5da896f5563b3673dd16db6c268c0f83 (patch)
tree5eea9997b9cda376fcd98a84a1d9f79ce84f699b /fs/xfs/xfs_acl.c
parentf311d771a090f5cc96b65ab76737cbf13914bc0c (diff)
downloadlinux-ed02d13f5da896f5563b3673dd16db6c268c0f83.tar.xz
xfs: only allocate the buffer size actually needed in __xfs_set_acl
No need to allocate the max size if we can just allocate the easily known actual ACL size. Suggested-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Diffstat (limited to 'fs/xfs/xfs_acl.c')
-rw-r--r--fs/xfs/xfs_acl.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/fs/xfs/xfs_acl.c b/fs/xfs/xfs_acl.c
index 950ae1e7dae6..d4c687b5cd06 100644
--- a/fs/xfs/xfs_acl.c
+++ b/fs/xfs/xfs_acl.c
@@ -191,16 +191,11 @@ __xfs_set_acl(struct inode *inode, struct posix_acl *acl, int type)
args.namelen = strlen(args.name);
if (acl) {
- args.valuelen = XFS_ACL_MAX_SIZE(ip->i_mount);
+ args.valuelen = XFS_ACL_SIZE(acl->a_count);
args.value = kmem_zalloc_large(args.valuelen, 0);
if (!args.value)
return -ENOMEM;
-
xfs_acl_to_disk(args.value, acl);
-
- /* subtract away the unused acl entries */
- args.valuelen -= sizeof(struct xfs_acl_entry) *
- (XFS_ACL_MAX_ENTRIES(ip->i_mount) - acl->a_count);
}
error = xfs_attr_set(&args);