diff options
author | Christoph Hellwig <hch@lst.de> | 2019-11-20 20:46:04 +0300 |
---|---|---|
committer | Darrick J. Wong <darrick.wong@oracle.com> | 2019-11-22 19:17:10 +0300 |
commit | cd2c9f1b544b8f5e1ca1874032fd669d74946a6d (patch) | |
tree | 12f8fd044b2af10e2e70f1cda6269223ce784e11 /fs/xfs/libxfs/xfs_da_btree.c | |
parent | 02c57f0a8b07f5c8a393530ff29b2f6fbe17c825 (diff) | |
download | linux-cd2c9f1b544b8f5e1ca1874032fd669d74946a6d.tar.xz |
xfs: remove the mappedbno argument to xfs_da_read_buf
Move the code for reading an already mapped block into
xfs_da3_node_read_mapped, which is the only caller ever passing a block
number in the mappedbno argument and replace the mappedbno argument with
the simple xfs_dabuf_get flags.
Signed-off-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>
Diffstat (limited to 'fs/xfs/libxfs/xfs_da_btree.c')
-rw-r--r-- | fs/xfs/libxfs/xfs_da_btree.c | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/fs/xfs/libxfs/xfs_da_btree.c b/fs/xfs/libxfs/xfs_da_btree.c index ee509bb787ff..c00983034c78 100644 --- a/fs/xfs/libxfs/xfs_da_btree.c +++ b/fs/xfs/libxfs/xfs_da_btree.c @@ -369,7 +369,7 @@ xfs_da3_node_read( { int error; - error = xfs_da_read_buf(tp, dp, bno, -1, bpp, whichfork, + error = xfs_da_read_buf(tp, dp, bno, 0, bpp, whichfork, &xfs_da3_node_buf_ops); if (error || !*bpp || !tp) return error; @@ -384,12 +384,22 @@ xfs_da3_node_read_mapped( struct xfs_buf **bpp, int whichfork) { + struct xfs_mount *mp = dp->i_mount; int error; - error = xfs_da_read_buf(tp, dp, 0, mappedbno, bpp, whichfork, - &xfs_da3_node_buf_ops); - if (error || !*bpp || !tp) + error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, mappedbno, + XFS_FSB_TO_BB(mp, xfs_dabuf_nfsb(mp, whichfork)), 0, + bpp, &xfs_da3_node_buf_ops); + if (error || !*bpp) return error; + + if (whichfork == XFS_ATTR_FORK) + xfs_buf_set_ref(*bpp, XFS_ATTR_BTREE_REF); + else + xfs_buf_set_ref(*bpp, XFS_DIR_BTREE_REF); + + if (!tp) + return 0; return xfs_da3_node_set_type(tp, *bpp); } @@ -2618,7 +2628,7 @@ xfs_da_read_buf( struct xfs_trans *tp, struct xfs_inode *dp, xfs_dablk_t bno, - xfs_daddr_t mappedbno, + unsigned int flags, struct xfs_buf **bpp, int whichfork, const struct xfs_buf_ops *ops) @@ -2630,24 +2640,12 @@ xfs_da_read_buf( int error; *bpp = NULL; - - if (mappedbno >= 0) { - error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, - mappedbno, XFS_FSB_TO_BB(mp, - xfs_dabuf_nfsb(mp, whichfork)), - 0, &bp, ops); - goto done; - } - - error = xfs_dabuf_map(dp, bno, - mappedbno == -1 ? XFS_DABUF_MAP_HOLE_OK : 0, - whichfork, &mapp, &nmap); + error = xfs_dabuf_map(dp, bno, flags, whichfork, &mapp, &nmap); if (error || !nmap) goto out_free; error = xfs_trans_read_buf_map(mp, tp, mp->m_ddev_targp, mapp, nmap, 0, &bp, ops); -done: if (error) goto out_free; |