xfs: use ->t_firstblock in attrfork add
Note that this codepath is a user of struct xfs_da_args. Switch it over to ->t_firstblock in preparation to remove xfs_da_args.firstblock. Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
This commit is contained in:
parent
381eee69f8
commit
825d75cd8c
|
@ -915,7 +915,6 @@ STATIC int /* error */
|
||||||
xfs_bmap_add_attrfork_btree(
|
xfs_bmap_add_attrfork_btree(
|
||||||
xfs_trans_t *tp, /* transaction pointer */
|
xfs_trans_t *tp, /* transaction pointer */
|
||||||
xfs_inode_t *ip, /* incore inode pointer */
|
xfs_inode_t *ip, /* incore inode pointer */
|
||||||
xfs_fsblock_t *firstblock, /* first block allocated */
|
|
||||||
int *flags) /* inode logging flags */
|
int *flags) /* inode logging flags */
|
||||||
{
|
{
|
||||||
xfs_btree_cur_t *cur; /* btree cursor */
|
xfs_btree_cur_t *cur; /* btree cursor */
|
||||||
|
@ -928,7 +927,7 @@ xfs_bmap_add_attrfork_btree(
|
||||||
*flags |= XFS_ILOG_DBROOT;
|
*flags |= XFS_ILOG_DBROOT;
|
||||||
else {
|
else {
|
||||||
cur = xfs_bmbt_init_cursor(mp, tp, ip, XFS_DATA_FORK);
|
cur = xfs_bmbt_init_cursor(mp, tp, ip, XFS_DATA_FORK);
|
||||||
cur->bc_private.b.firstblock = *firstblock;
|
cur->bc_private.b.firstblock = tp->t_firstblock;
|
||||||
error = xfs_bmbt_lookup_first(cur, &stat);
|
error = xfs_bmbt_lookup_first(cur, &stat);
|
||||||
if (error)
|
if (error)
|
||||||
goto error0;
|
goto error0;
|
||||||
|
@ -940,7 +939,7 @@ xfs_bmap_add_attrfork_btree(
|
||||||
xfs_btree_del_cursor(cur, XFS_BTREE_NOERROR);
|
xfs_btree_del_cursor(cur, XFS_BTREE_NOERROR);
|
||||||
return -ENOSPC;
|
return -ENOSPC;
|
||||||
}
|
}
|
||||||
*firstblock = cur->bc_private.b.firstblock;
|
tp->t_firstblock = cur->bc_private.b.firstblock;
|
||||||
cur->bc_private.b.allocated = 0;
|
cur->bc_private.b.allocated = 0;
|
||||||
xfs_btree_del_cursor(cur, XFS_BTREE_NOERROR);
|
xfs_btree_del_cursor(cur, XFS_BTREE_NOERROR);
|
||||||
}
|
}
|
||||||
|
@ -957,7 +956,6 @@ STATIC int /* error */
|
||||||
xfs_bmap_add_attrfork_extents(
|
xfs_bmap_add_attrfork_extents(
|
||||||
struct xfs_trans *tp, /* transaction pointer */
|
struct xfs_trans *tp, /* transaction pointer */
|
||||||
struct xfs_inode *ip, /* incore inode pointer */
|
struct xfs_inode *ip, /* incore inode pointer */
|
||||||
xfs_fsblock_t *firstblock, /* first block allocated */
|
|
||||||
int *flags) /* inode logging flags */
|
int *flags) /* inode logging flags */
|
||||||
{
|
{
|
||||||
xfs_btree_cur_t *cur; /* bmap btree cursor */
|
xfs_btree_cur_t *cur; /* bmap btree cursor */
|
||||||
|
@ -966,8 +964,8 @@ xfs_bmap_add_attrfork_extents(
|
||||||
if (ip->i_d.di_nextents * sizeof(xfs_bmbt_rec_t) <= XFS_IFORK_DSIZE(ip))
|
if (ip->i_d.di_nextents * sizeof(xfs_bmbt_rec_t) <= XFS_IFORK_DSIZE(ip))
|
||||||
return 0;
|
return 0;
|
||||||
cur = NULL;
|
cur = NULL;
|
||||||
error = xfs_bmap_extents_to_btree(tp, ip, firstblock, &cur, 0, flags,
|
error = xfs_bmap_extents_to_btree(tp, ip, &tp->t_firstblock, &cur, 0,
|
||||||
XFS_DATA_FORK);
|
flags, XFS_DATA_FORK);
|
||||||
if (cur) {
|
if (cur) {
|
||||||
cur->bc_private.b.allocated = 0;
|
cur->bc_private.b.allocated = 0;
|
||||||
xfs_btree_del_cursor(cur,
|
xfs_btree_del_cursor(cur,
|
||||||
|
@ -989,12 +987,11 @@ xfs_bmap_add_attrfork_extents(
|
||||||
*/
|
*/
|
||||||
STATIC int /* error */
|
STATIC int /* error */
|
||||||
xfs_bmap_add_attrfork_local(
|
xfs_bmap_add_attrfork_local(
|
||||||
xfs_trans_t *tp, /* transaction pointer */
|
struct xfs_trans *tp, /* transaction pointer */
|
||||||
xfs_inode_t *ip, /* incore inode pointer */
|
struct xfs_inode *ip, /* incore inode pointer */
|
||||||
xfs_fsblock_t *firstblock, /* first block allocated */
|
|
||||||
int *flags) /* inode logging flags */
|
int *flags) /* inode logging flags */
|
||||||
{
|
{
|
||||||
xfs_da_args_t dargs; /* args for dir/attr code */
|
struct xfs_da_args dargs; /* args for dir/attr code */
|
||||||
|
|
||||||
if (ip->i_df.if_bytes <= XFS_IFORK_DSIZE(ip))
|
if (ip->i_df.if_bytes <= XFS_IFORK_DSIZE(ip))
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1003,7 +1000,7 @@ xfs_bmap_add_attrfork_local(
|
||||||
memset(&dargs, 0, sizeof(dargs));
|
memset(&dargs, 0, sizeof(dargs));
|
||||||
dargs.geo = ip->i_mount->m_dir_geo;
|
dargs.geo = ip->i_mount->m_dir_geo;
|
||||||
dargs.dp = ip;
|
dargs.dp = ip;
|
||||||
dargs.firstblock = firstblock;
|
dargs.firstblock = &tp->t_firstblock;
|
||||||
dargs.total = dargs.geo->fsbcount;
|
dargs.total = dargs.geo->fsbcount;
|
||||||
dargs.whichfork = XFS_DATA_FORK;
|
dargs.whichfork = XFS_DATA_FORK;
|
||||||
dargs.trans = tp;
|
dargs.trans = tp;
|
||||||
|
@ -1011,7 +1008,7 @@ xfs_bmap_add_attrfork_local(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (S_ISLNK(VFS_I(ip)->i_mode))
|
if (S_ISLNK(VFS_I(ip)->i_mode))
|
||||||
return xfs_bmap_local_to_extents(tp, ip, firstblock, 1,
|
return xfs_bmap_local_to_extents(tp, ip, &tp->t_firstblock, 1,
|
||||||
flags, XFS_DATA_FORK,
|
flags, XFS_DATA_FORK,
|
||||||
xfs_symlink_local_to_remote);
|
xfs_symlink_local_to_remote);
|
||||||
|
|
||||||
|
@ -1030,7 +1027,6 @@ xfs_bmap_add_attrfork(
|
||||||
int size, /* space new attribute needs */
|
int size, /* space new attribute needs */
|
||||||
int rsvd) /* xact may use reserved blks */
|
int rsvd) /* xact may use reserved blks */
|
||||||
{
|
{
|
||||||
xfs_fsblock_t firstblock; /* 1st block/ag allocated */
|
|
||||||
struct xfs_defer_ops dfops; /* freed extent records */
|
struct xfs_defer_ops dfops; /* freed extent records */
|
||||||
xfs_mount_t *mp; /* mount structure */
|
xfs_mount_t *mp; /* mount structure */
|
||||||
xfs_trans_t *tp; /* transaction pointer */
|
xfs_trans_t *tp; /* transaction pointer */
|
||||||
|
@ -1050,7 +1046,7 @@ xfs_bmap_add_attrfork(
|
||||||
rsvd ? XFS_TRANS_RESERVE : 0, &tp);
|
rsvd ? XFS_TRANS_RESERVE : 0, &tp);
|
||||||
if (error)
|
if (error)
|
||||||
return error;
|
return error;
|
||||||
xfs_defer_init(tp, &dfops, &firstblock);
|
xfs_defer_init(tp, &dfops, &tp->t_firstblock);
|
||||||
|
|
||||||
xfs_ilock(ip, XFS_ILOCK_EXCL);
|
xfs_ilock(ip, XFS_ILOCK_EXCL);
|
||||||
error = xfs_trans_reserve_quota_nblks(tp, ip, blks, 0, rsvd ?
|
error = xfs_trans_reserve_quota_nblks(tp, ip, blks, 0, rsvd ?
|
||||||
|
@ -1100,16 +1096,13 @@ xfs_bmap_add_attrfork(
|
||||||
logflags = 0;
|
logflags = 0;
|
||||||
switch (ip->i_d.di_format) {
|
switch (ip->i_d.di_format) {
|
||||||
case XFS_DINODE_FMT_LOCAL:
|
case XFS_DINODE_FMT_LOCAL:
|
||||||
error = xfs_bmap_add_attrfork_local(tp, ip, &firstblock,
|
error = xfs_bmap_add_attrfork_local(tp, ip, &logflags);
|
||||||
&logflags);
|
|
||||||
break;
|
break;
|
||||||
case XFS_DINODE_FMT_EXTENTS:
|
case XFS_DINODE_FMT_EXTENTS:
|
||||||
error = xfs_bmap_add_attrfork_extents(tp, ip, &firstblock,
|
error = xfs_bmap_add_attrfork_extents(tp, ip, &logflags);
|
||||||
&logflags);
|
|
||||||
break;
|
break;
|
||||||
case XFS_DINODE_FMT_BTREE:
|
case XFS_DINODE_FMT_BTREE:
|
||||||
error = xfs_bmap_add_attrfork_btree(tp, ip, &firstblock,
|
error = xfs_bmap_add_attrfork_btree(tp, ip, &logflags);
|
||||||
&logflags);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
error = 0;
|
error = 0;
|
||||||
|
|
Loading…
Reference in New Issue