Skip to content

Commit 2911edb

Browse files
Christoph Hellwigdjwong
authored andcommitted
xfs: remove the mappedbno argument to xfs_da_get_buf
Use the xfs_da_get_buf_daddr function directly for the two callers that pass a mapped disk address, and then remove the mappedbno argument. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Signed-off-by: Darrick J. Wong <[email protected]>
1 parent cd2c9f1 commit 2911edb

File tree

7 files changed

+28
-27
lines changed

7 files changed

+28
-27
lines changed

fs/xfs/libxfs/xfs_attr_leaf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,7 +1162,7 @@ xfs_attr3_leaf_to_node(
11621162
if (error)
11631163
goto out;
11641164

1165-
error = xfs_da_get_buf(args->trans, dp, blkno, -1, &bp2, XFS_ATTR_FORK);
1165+
error = xfs_da_get_buf(args->trans, dp, blkno, &bp2, XFS_ATTR_FORK);
11661166
if (error)
11671167
goto out;
11681168

@@ -1223,7 +1223,7 @@ xfs_attr3_leaf_create(
12231223

12241224
trace_xfs_attr_leaf_create(args);
12251225

1226-
error = xfs_da_get_buf(args->trans, args->dp, blkno, -1, &bp,
1226+
error = xfs_da_get_buf(args->trans, args->dp, blkno, &bp,
12271227
XFS_ATTR_FORK);
12281228
if (error)
12291229
return error;

fs/xfs/libxfs/xfs_da_btree.c

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ xfs_da3_node_create(
429429
trace_xfs_da_node_create(args);
430430
ASSERT(level <= XFS_DA_NODE_MAXDEPTH);
431431

432-
error = xfs_da_get_buf(tp, dp, blkno, -1, &bp, whichfork);
432+
error = xfs_da_get_buf(tp, dp, blkno, &bp, whichfork);
433433
if (error)
434434
return error;
435435
bp->b_ops = &xfs_da3_node_buf_ops;
@@ -656,7 +656,7 @@ xfs_da3_root_split(
656656

657657
dp = args->dp;
658658
tp = args->trans;
659-
error = xfs_da_get_buf(tp, dp, blkno, -1, &bp, args->whichfork);
659+
error = xfs_da_get_buf(tp, dp, blkno, &bp, args->whichfork);
660660
if (error)
661661
return error;
662662
node = bp->b_addr;
@@ -2577,7 +2577,6 @@ xfs_da_get_buf(
25772577
struct xfs_trans *tp,
25782578
struct xfs_inode *dp,
25792579
xfs_dablk_t bno,
2580-
xfs_daddr_t mappedbno,
25812580
struct xfs_buf **bpp,
25822581
int whichfork)
25832582
{
@@ -2588,22 +2587,11 @@ xfs_da_get_buf(
25882587
int error;
25892588

25902589
*bpp = NULL;
2591-
2592-
if (mappedbno >= 0) {
2593-
bp = xfs_trans_get_buf(tp, mp->m_ddev_targp, mappedbno,
2594-
XFS_FSB_TO_BB(mp,
2595-
xfs_dabuf_nfsb(mp, whichfork)), 0);
2596-
goto done;
2597-
}
2598-
2599-
error = xfs_dabuf_map(dp, bno,
2600-
mappedbno == -1 ? XFS_DABUF_MAP_HOLE_OK : 0,
2601-
whichfork, &mapp, &nmap);
2590+
error = xfs_dabuf_map(dp, bno, 0, whichfork, &mapp, &nmap);
26022591
if (error || nmap == 0)
26032592
goto out_free;
26042593

26052594
bp = xfs_trans_get_buf_map(tp, mp->m_ddev_targp, mapp, nmap, 0);
2606-
done:
26072595
error = bp ? bp->b_error : -EIO;
26082596
if (error) {
26092597
if (bp)

fs/xfs/libxfs/xfs_da_btree.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,7 @@ int xfs_da_grow_inode(xfs_da_args_t *args, xfs_dablk_t *new_blkno);
203203
int xfs_da_grow_inode_int(struct xfs_da_args *args, xfs_fileoff_t *bno,
204204
int count);
205205
int xfs_da_get_buf(struct xfs_trans *trans, struct xfs_inode *dp,
206-
xfs_dablk_t bno, xfs_daddr_t mappedbno,
207-
struct xfs_buf **bp, int whichfork);
206+
xfs_dablk_t bno, struct xfs_buf **bp, int whichfork);
208207
int xfs_da_read_buf(struct xfs_trans *trans, struct xfs_inode *dp,
209208
xfs_dablk_t bno, unsigned int flags, struct xfs_buf **bpp,
210209
int whichfork, const struct xfs_buf_ops *ops);

fs/xfs/libxfs/xfs_dir2_data.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ xfs_dir3_data_init(
679679
* Get the buffer set up for the block.
680680
*/
681681
error = xfs_da_get_buf(tp, dp, xfs_dir2_db_to_da(args->geo, blkno),
682-
-1, &bp, XFS_DATA_FORK);
682+
&bp, XFS_DATA_FORK);
683683
if (error)
684684
return error;
685685
bp->b_ops = &xfs_dir3_data_buf_ops;

fs/xfs/libxfs/xfs_dir2_leaf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ xfs_dir3_leaf_get_buf(
355355
bno < xfs_dir2_byte_to_db(args->geo, XFS_DIR2_FREE_OFFSET));
356356

357357
error = xfs_da_get_buf(tp, dp, xfs_dir2_db_to_da(args->geo, bno),
358-
-1, &bp, XFS_DATA_FORK);
358+
&bp, XFS_DATA_FORK);
359359
if (error)
360360
return error;
361361

fs/xfs/libxfs/xfs_dir2_node.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ xfs_dir3_free_get_buf(
324324
struct xfs_dir3_icfree_hdr hdr;
325325

326326
error = xfs_da_get_buf(tp, dp, xfs_dir2_db_to_da(args->geo, fbno),
327-
-1, &bp, XFS_DATA_FORK);
327+
&bp, XFS_DATA_FORK);
328328
if (error)
329329
return error;
330330

fs/xfs/xfs_attr_inactive.c

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ xfs_attr3_node_inactive(
196196
struct xfs_buf *bp,
197197
int level)
198198
{
199+
struct xfs_mount *mp = dp->i_mount;
199200
struct xfs_da_blkinfo *info;
200201
xfs_dablk_t child_fsb;
201202
xfs_daddr_t parent_blkno, child_blkno;
@@ -267,10 +268,16 @@ xfs_attr3_node_inactive(
267268
/*
268269
* Remove the subsidiary block from the cache and from the log.
269270
*/
270-
error = xfs_da_get_buf(*trans, dp, 0, child_blkno, &child_bp,
271-
XFS_ATTR_FORK);
272-
if (error)
271+
child_bp = xfs_trans_get_buf(*trans, mp->m_ddev_targp,
272+
child_blkno,
273+
XFS_FSB_TO_BB(mp, mp->m_attr_geo->fsbcount), 0);
274+
if (!child_bp)
275+
return -EIO;
276+
error = bp->b_error;
277+
if (error) {
278+
xfs_trans_brelse(*trans, child_bp);
273279
return error;
280+
}
274281
xfs_trans_binval(*trans, child_bp);
275282

276283
/*
@@ -311,6 +318,7 @@ xfs_attr3_root_inactive(
311318
struct xfs_trans **trans,
312319
struct xfs_inode *dp)
313320
{
321+
struct xfs_mount *mp = dp->i_mount;
314322
struct xfs_da_blkinfo *info;
315323
struct xfs_buf *bp;
316324
xfs_daddr_t blkno;
@@ -353,9 +361,15 @@ xfs_attr3_root_inactive(
353361
/*
354362
* Invalidate the incore copy of the root block.
355363
*/
356-
error = xfs_da_get_buf(*trans, dp, 0, blkno, &bp, XFS_ATTR_FORK);
357-
if (error)
364+
bp = xfs_trans_get_buf(*trans, mp->m_ddev_targp, blkno,
365+
XFS_FSB_TO_BB(mp, mp->m_attr_geo->fsbcount), 0);
366+
if (!bp)
367+
return -EIO;
368+
error = bp->b_error;
369+
if (error) {
370+
xfs_trans_brelse(*trans, bp);
358371
return error;
372+
}
359373
xfs_trans_binval(*trans, bp); /* remove from cache */
360374
/*
361375
* Commit the invalidate and start the next transaction.

0 commit comments

Comments
 (0)