Re: [PATCH 10/30] xfs: pass an initialized xfs_da_args structure to xfs_attr_set

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

 



On Wed, Feb 26, 2020 at 11:21:09AM +1100, Dave Chinner wrote:
> >  		/* subtract away the unused acl entries */
> > -		len -= sizeof(struct xfs_acl_entry) *
> > +		args.valuelen -= sizeof(struct xfs_acl_entry) *
> >  			 (XFS_ACL_MAX_ENTRIES(ip->i_mount) - acl->a_count);
> 
> why do we allocate a maximally sized buffer for the attribute data
> (64kB for v5 filesystems) when we already know the size of the
> data we are about to format into it? Why isn't this just:
> 
> 	if (acl) {
> 		args.valuelen = sizeof(struct xfs_acl_entry) * acl->a_count;
> 		args.value = kmem_zalloc_large(args.valuelen, 0);
> 		if (!args.value)
> 			return -ENOMEM;
> 
> 		xfs_acl_to_disk(args.value, acl); 
> 	}

We need to also account for the size of the acl header, and have the
XFS_ACL_SIZE macro to do so. But with that it makes sense, and I've
added a patch to do so to the end of the series.



[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