Commit 6c888af0 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Dave Chinner

xfs: pass struct da_args to xfs_attr_calc_size

And remove a very confused comment.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
parent 67fd718f
...@@ -162,12 +162,10 @@ xfs_attr_get( ...@@ -162,12 +162,10 @@ xfs_attr_get(
*/ */
STATIC int STATIC int
xfs_attr_calc_size( xfs_attr_calc_size(
struct xfs_inode *ip, struct xfs_da_args *args,
int namelen,
int valuelen,
int *local) int *local)
{ {
struct xfs_mount *mp = ip->i_mount; struct xfs_mount *mp = args->dp->i_mount;
int size; int size;
int nblks; int nblks;
...@@ -175,7 +173,7 @@ xfs_attr_calc_size( ...@@ -175,7 +173,7 @@ xfs_attr_calc_size(
* Determine space new attribute will use, and if it would be * Determine space new attribute will use, and if it would be
* "local" or "remote" (note: local != inline). * "local" or "remote" (note: local != inline).
*/ */
size = xfs_attr_leaf_newentsize(namelen, valuelen, size = xfs_attr_leaf_newentsize(args->namelen, args->valuelen,
mp->m_sb.sb_blocksize, local); mp->m_sb.sb_blocksize, local);
nblks = XFS_DAENTER_SPACE_RES(mp, XFS_ATTR_FORK); nblks = XFS_DAENTER_SPACE_RES(mp, XFS_ATTR_FORK);
...@@ -189,7 +187,7 @@ xfs_attr_calc_size( ...@@ -189,7 +187,7 @@ xfs_attr_calc_size(
* Out of line attribute, cannot double split, but * Out of line attribute, cannot double split, but
* make room for the attribute value itself. * make room for the attribute value itself.
*/ */
uint dblocks = XFS_B_TO_FSB(mp, valuelen); uint dblocks = XFS_B_TO_FSB(mp, args->valuelen);
nblks += dblocks; nblks += dblocks;
nblks += XFS_NEXTENTADD_SPACE_RES(mp, dblocks, XFS_ATTR_FORK); nblks += XFS_NEXTENTADD_SPACE_RES(mp, dblocks, XFS_ATTR_FORK);
} }
...@@ -227,9 +225,7 @@ xfs_attr_set( ...@@ -227,9 +225,7 @@ xfs_attr_set(
args.firstblock = &firstblock; args.firstblock = &firstblock;
args.flist = &flist; args.flist = &flist;
args.op_flags = XFS_DA_OP_ADDNAME | XFS_DA_OP_OKNOENT; args.op_flags = XFS_DA_OP_ADDNAME | XFS_DA_OP_OKNOENT;
args.total = xfs_attr_calc_size(&args, &local);
/* Size is now blocks for attribute data */
args.total = xfs_attr_calc_size(dp, args.namelen, valuelen, &local);
error = xfs_qm_dqattach(dp, 0); error = xfs_qm_dqattach(dp, 0);
if (error) if (error)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment