[PATCH 31/32] xfs: only allocate the buffer size actually needed in __xfs_set_acl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



No need to allocate the max size if we can just allocate the easily
known actual ACL size.

Suggested-by: Dave Chinner <dchinner@xxxxxxxxxx>
Signed-off-by: Christoph Hellwig <hch@xxxxxx>
---
 fs/xfs/xfs_acl.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/fs/xfs/xfs_acl.c b/fs/xfs/xfs_acl.c
index 552258399648..5807f11aed3e 100644
--- a/fs/xfs/xfs_acl.c
+++ b/fs/xfs/xfs_acl.c
@@ -187,16 +187,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);
-- 
2.24.1




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux