Commit a7beabea authored by Brian Foster's avatar Brian Foster Committed by Darrick J. Wong

xfs: remove xfs_bmapi_write() firstblock param

All callers pass ->t_firstblock from the current transaction.
Signed-off-by: default avatarBrian Foster <bfoster@redhat.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
parent d0a9d795
...@@ -484,8 +484,7 @@ xfs_attr_rmtval_set( ...@@ -484,8 +484,7 @@ xfs_attr_rmtval_set(
&args->trans->t_firstblock); &args->trans->t_firstblock);
nmap = 1; nmap = 1;
error = xfs_bmapi_write(args->trans, dp, (xfs_fileoff_t)lblkno, error = xfs_bmapi_write(args->trans, dp, (xfs_fileoff_t)lblkno,
blkcnt, XFS_BMAPI_ATTRFORK, blkcnt, XFS_BMAPI_ATTRFORK, args->total, &map,
&args->trans->t_firstblock, args->total, &map,
&nmap); &nmap);
if (error) if (error)
goto out_defer_cancel; goto out_defer_cancel;
......
...@@ -4212,12 +4212,6 @@ xfs_bmapi_convert_unwritten( ...@@ -4212,12 +4212,6 @@ xfs_bmapi_convert_unwritten(
* extent state if necessary. Details behaviour is controlled by the flags * extent state if necessary. Details behaviour is controlled by the flags
* parameter. Only allocates blocks from a single allocation group, to avoid * parameter. Only allocates blocks from a single allocation group, to avoid
* locking problems. * locking problems.
*
* The returned value in "firstblock" from the first call in a transaction
* must be remembered and presented to subsequent calls in "firstblock".
* An upper bound for the number of blocks to be allocated is supplied to
* the first call in "total"; if no allocation group has that many free
* blocks then the call will fail (return NULLFSBLOCK in "firstblock").
*/ */
int int
xfs_bmapi_write( xfs_bmapi_write(
...@@ -4226,8 +4220,6 @@ xfs_bmapi_write( ...@@ -4226,8 +4220,6 @@ xfs_bmapi_write(
xfs_fileoff_t bno, /* starting file offs. mapped */ xfs_fileoff_t bno, /* starting file offs. mapped */
xfs_filblks_t len, /* length to map in file */ xfs_filblks_t len, /* length to map in file */
int flags, /* XFS_BMAPI_... */ int flags, /* XFS_BMAPI_... */
xfs_fsblock_t *firstblock, /* first allocated block
controls a.g. for allocs */
xfs_extlen_t total, /* total blocks needed */ xfs_extlen_t total, /* total blocks needed */
struct xfs_bmbt_irec *mval, /* output: map values */ struct xfs_bmbt_irec *mval, /* output: map values */
int *nmap) /* i/o: mval size/count */ int *nmap) /* i/o: mval size/count */
...@@ -4294,7 +4286,7 @@ xfs_bmapi_write( ...@@ -4294,7 +4286,7 @@ xfs_bmapi_write(
XFS_STATS_INC(mp, xs_blk_mapw); XFS_STATS_INC(mp, xs_blk_mapw);
if (!tp || *firstblock == NULLFSBLOCK) { if (!tp || tp->t_firstblock == NULLFSBLOCK) {
if (XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_BTREE) if (XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_BTREE)
bma.minleft = be16_to_cpu(ifp->if_broot->bb_level) + 1; bma.minleft = be16_to_cpu(ifp->if_broot->bb_level) + 1;
else else
...@@ -4321,7 +4313,7 @@ xfs_bmapi_write( ...@@ -4321,7 +4313,7 @@ xfs_bmapi_write(
bma.ip = ip; bma.ip = ip;
bma.total = total; bma.total = total;
bma.datatype = 0; bma.datatype = 0;
bma.firstblock = firstblock; bma.firstblock = &tp->t_firstblock;
ASSERT(!tp || tp->t_dfops); ASSERT(!tp || tp->t_dfops);
while (bno < end && n < *nmap) { while (bno < end && n < *nmap) {
...@@ -4474,11 +4466,11 @@ xfs_bmapi_write( ...@@ -4474,11 +4466,11 @@ xfs_bmapi_write(
if (bma.cur) { if (bma.cur) {
if (!error) { if (!error) {
ASSERT(*firstblock == NULLFSBLOCK || ASSERT(tp->t_firstblock == NULLFSBLOCK ||
XFS_FSB_TO_AGNO(mp, *firstblock) <= XFS_FSB_TO_AGNO(mp, tp->t_firstblock) <=
XFS_FSB_TO_AGNO(mp, XFS_FSB_TO_AGNO(mp,
bma.cur->bc_private.b.firstblock)); bma.cur->bc_private.b.firstblock));
*firstblock = bma.cur->bc_private.b.firstblock; tp->t_firstblock = bma.cur->bc_private.b.firstblock;
} }
xfs_btree_del_cursor(bma.cur, xfs_btree_del_cursor(bma.cur,
error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR); error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR);
......
...@@ -201,8 +201,7 @@ int xfs_bmapi_read(struct xfs_inode *ip, xfs_fileoff_t bno, ...@@ -201,8 +201,7 @@ int xfs_bmapi_read(struct xfs_inode *ip, xfs_fileoff_t bno,
int *nmap, int flags); int *nmap, int flags);
int xfs_bmapi_write(struct xfs_trans *tp, struct xfs_inode *ip, int xfs_bmapi_write(struct xfs_trans *tp, struct xfs_inode *ip,
xfs_fileoff_t bno, xfs_filblks_t len, int flags, xfs_fileoff_t bno, xfs_filblks_t len, int flags,
xfs_fsblock_t *firstblock, xfs_extlen_t total, xfs_extlen_t total, struct xfs_bmbt_irec *mval, int *nmap);
struct xfs_bmbt_irec *mval, int *nmap);
int __xfs_bunmapi(struct xfs_trans *tp, struct xfs_inode *ip, int __xfs_bunmapi(struct xfs_trans *tp, struct xfs_inode *ip,
xfs_fileoff_t bno, xfs_filblks_t *rlen, int flags, xfs_fileoff_t bno, xfs_filblks_t *rlen, int flags,
xfs_extnum_t nexts, xfs_fsblock_t *firstblock); xfs_extnum_t nexts, xfs_fsblock_t *firstblock);
......
...@@ -2061,7 +2061,7 @@ xfs_da_grow_inode_int( ...@@ -2061,7 +2061,7 @@ xfs_da_grow_inode_int(
nmap = 1; nmap = 1;
error = xfs_bmapi_write(tp, dp, *bno, count, error = xfs_bmapi_write(tp, dp, *bno, count,
xfs_bmapi_aflag(w)|XFS_BMAPI_METADATA|XFS_BMAPI_CONTIG, xfs_bmapi_aflag(w)|XFS_BMAPI_METADATA|XFS_BMAPI_CONTIG,
&tp->t_firstblock, args->total, &map, &nmap); args->total, &map, &nmap);
if (error) if (error)
return error; return error;
...@@ -2083,8 +2083,7 @@ xfs_da_grow_inode_int( ...@@ -2083,8 +2083,7 @@ xfs_da_grow_inode_int(
c = (int)(*bno + count - b); c = (int)(*bno + count - b);
error = xfs_bmapi_write(tp, dp, b, c, error = xfs_bmapi_write(tp, dp, b, c,
xfs_bmapi_aflag(w)|XFS_BMAPI_METADATA, xfs_bmapi_aflag(w)|XFS_BMAPI_METADATA,
&tp->t_firstblock, args->total, args->total, &mapp[mapi], &nmap);
&mapp[mapi], &nmap);
if (error) if (error)
goto out_free_map; goto out_free_map;
if (nmap < 1) if (nmap < 1)
......
...@@ -973,9 +973,8 @@ xfs_alloc_file_space( ...@@ -973,9 +973,8 @@ xfs_alloc_file_space(
xfs_defer_init(tp, &dfops, &tp->t_firstblock); xfs_defer_init(tp, &dfops, &tp->t_firstblock);
error = xfs_bmapi_write(tp, ip, startoffset_fsb, error = xfs_bmapi_write(tp, ip, startoffset_fsb,
allocatesize_fsb, alloc_type, allocatesize_fsb, alloc_type, resblks,
&tp->t_firstblock, resblks, imapp, imapp, &nimaps);
&nimaps);
if (error) if (error)
goto error0; goto error0;
......
...@@ -311,8 +311,7 @@ xfs_dquot_disk_alloc( ...@@ -311,8 +311,7 @@ xfs_dquot_disk_alloc(
xfs_trans_ijoin(tp, quotip, XFS_ILOCK_EXCL); xfs_trans_ijoin(tp, quotip, XFS_ILOCK_EXCL);
error = xfs_bmapi_write(tp, quotip, dqp->q_fileoffset, error = xfs_bmapi_write(tp, quotip, dqp->q_fileoffset,
XFS_DQUOT_CLUSTER_SIZE_FSB, XFS_BMAPI_METADATA, XFS_DQUOT_CLUSTER_SIZE_FSB, XFS_BMAPI_METADATA,
&tp->t_firstblock, XFS_QM_DQALLOC_SPACE_RES(mp), XFS_QM_DQALLOC_SPACE_RES(mp), &map, &nmaps);
&map, &nmaps);
if (error) if (error)
goto error0; goto error0;
ASSERT(map.br_blockcount == XFS_DQUOT_CLUSTER_SIZE_FSB); ASSERT(map.br_blockcount == XFS_DQUOT_CLUSTER_SIZE_FSB);
......
...@@ -256,8 +256,7 @@ xfs_iomap_write_direct( ...@@ -256,8 +256,7 @@ xfs_iomap_write_direct(
xfs_defer_init(tp, &dfops, &tp->t_firstblock); xfs_defer_init(tp, &dfops, &tp->t_firstblock);
nimaps = 1; nimaps = 1;
error = xfs_bmapi_write(tp, ip, offset_fsb, count_fsb, error = xfs_bmapi_write(tp, ip, offset_fsb, count_fsb,
bmapi_flags, &tp->t_firstblock, resblks, imap, bmapi_flags, resblks, imap, &nimaps);
&nimaps);
if (error) if (error)
goto out_bmap_cancel; goto out_bmap_cancel;
...@@ -768,8 +767,7 @@ xfs_iomap_write_allocate( ...@@ -768,8 +767,7 @@ xfs_iomap_write_allocate(
* pointer that the caller gave to us. * pointer that the caller gave to us.
*/ */
error = xfs_bmapi_write(tp, ip, map_start_fsb, error = xfs_bmapi_write(tp, ip, map_start_fsb,
count_fsb, flags, count_fsb, flags, nres, imap,
&tp->t_firstblock, nres, imap,
&nimaps); &nimaps);
if (error) if (error)
goto trans_cancel; goto trans_cancel;
...@@ -877,8 +875,8 @@ xfs_iomap_write_unwritten( ...@@ -877,8 +875,8 @@ xfs_iomap_write_unwritten(
xfs_defer_init(tp, &dfops, &tp->t_firstblock); xfs_defer_init(tp, &dfops, &tp->t_firstblock);
nimaps = 1; nimaps = 1;
error = xfs_bmapi_write(tp, ip, offset_fsb, count_fsb, error = xfs_bmapi_write(tp, ip, offset_fsb, count_fsb,
XFS_BMAPI_CONVERT, &tp->t_firstblock, XFS_BMAPI_CONVERT, resblks, &imap,
resblks, &imap, &nimaps); &nimaps);
if (error) if (error)
goto error_on_bmapi_transaction; goto error_on_bmapi_transaction;
......
...@@ -324,7 +324,7 @@ xfs_reflink_convert_cow_extent( ...@@ -324,7 +324,7 @@ xfs_reflink_convert_cow_extent(
if (imap->br_blockcount == 0) if (imap->br_blockcount == 0)
return 0; return 0;
return xfs_bmapi_write(NULL, ip, imap->br_startoff, imap->br_blockcount, return xfs_bmapi_write(NULL, ip, imap->br_startoff, imap->br_blockcount,
XFS_BMAPI_COWFORK | XFS_BMAPI_CONVERT, NULL, 0, imap, XFS_BMAPI_COWFORK | XFS_BMAPI_CONVERT, 0, imap,
&nimaps); &nimaps);
} }
...@@ -347,7 +347,7 @@ xfs_reflink_convert_cow( ...@@ -347,7 +347,7 @@ xfs_reflink_convert_cow(
xfs_ilock(ip, XFS_ILOCK_EXCL); xfs_ilock(ip, XFS_ILOCK_EXCL);
error = xfs_bmapi_write(NULL, ip, offset_fsb, count_fsb, error = xfs_bmapi_write(NULL, ip, offset_fsb, count_fsb,
XFS_BMAPI_COWFORK | XFS_BMAPI_CONVERT | XFS_BMAPI_COWFORK | XFS_BMAPI_CONVERT |
XFS_BMAPI_CONVERT_ONLY, NULL, 0, &imap, &nimaps); XFS_BMAPI_CONVERT_ONLY, 0, &imap, &nimaps);
xfs_iunlock(ip, XFS_ILOCK_EXCL); xfs_iunlock(ip, XFS_ILOCK_EXCL);
return error; return error;
} }
...@@ -430,7 +430,7 @@ xfs_reflink_allocate_cow( ...@@ -430,7 +430,7 @@ xfs_reflink_allocate_cow(
/* Allocate the entire reservation as unwritten blocks. */ /* Allocate the entire reservation as unwritten blocks. */
error = xfs_bmapi_write(tp, ip, imap->br_startoff, imap->br_blockcount, error = xfs_bmapi_write(tp, ip, imap->br_startoff, imap->br_blockcount,
XFS_BMAPI_COWFORK | XFS_BMAPI_PREALLOC, XFS_BMAPI_COWFORK | XFS_BMAPI_PREALLOC,
&tp->t_firstblock, resblks, imap, &nimaps); resblks, imap, &nimaps);
if (error) if (error)
goto out_bmap_cancel; goto out_bmap_cancel;
......
...@@ -792,8 +792,8 @@ xfs_growfs_rt_alloc( ...@@ -792,8 +792,8 @@ xfs_growfs_rt_alloc(
*/ */
nmap = 1; nmap = 1;
error = xfs_bmapi_write(tp, ip, oblocks, nblocks - oblocks, error = xfs_bmapi_write(tp, ip, oblocks, nblocks - oblocks,
XFS_BMAPI_METADATA, &tp->t_firstblock, XFS_BMAPI_METADATA, resblks, &map,
resblks, &map, &nmap); &nmap);
if (!error && nmap < 1) if (!error && nmap < 1)
error = -ENOSPC; error = -ENOSPC;
if (error) if (error)
......
...@@ -288,8 +288,7 @@ xfs_symlink( ...@@ -288,8 +288,7 @@ xfs_symlink(
nmaps = XFS_SYMLINK_MAPS; nmaps = XFS_SYMLINK_MAPS;
error = xfs_bmapi_write(tp, ip, first_fsb, fs_blocks, error = xfs_bmapi_write(tp, ip, first_fsb, fs_blocks,
XFS_BMAPI_METADATA, &tp->t_firstblock, XFS_BMAPI_METADATA, resblks, mval, &nmaps);
resblks, mval, &nmaps);
if (error) if (error)
goto out_bmap_cancel; goto out_bmap_cancel;
......
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