aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2011-09-18 16:40:46 -0400
committerAlex Elder <aelder@sgi.com>2011-10-11 22:15:03 -0400
commit5b777ad517ee75d3bb8d67c142d808822e46601b (patch)
tree0f73fed092f3772d51890f3e90fe518460522e3b /fs/xfs
parent5c8ed2021ff291f5e399a9b43c4f699b2fc58fbb (diff)
xfs: remove xfs_bmapi_single()
Now we have xfs_bmapi_read, there is no need for xfs_bmapi_single(). Change the remaining caller over and kill the function. Signed-off-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Alex Elder <aelder@sgi.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/xfs_bmap.c52
-rw-r--r--fs/xfs/xfs_bmap.h15
-rw-r--r--fs/xfs/xfs_da_btree.c32
-rw-r--r--fs/xfs/xfs_rtalloc.c32
4 files changed, 19 insertions, 112 deletions
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c
index fc5acf0b921..fd06bf17d09 100644
--- a/fs/xfs/xfs_bmap.c
+++ b/fs/xfs/xfs_bmap.c
@@ -4969,58 +4969,6 @@ error0:
4969} 4969}
4970 4970
4971/* 4971/*
4972 * Map file blocks to filesystem blocks, simple version.
4973 * One block (extent) only, read-only.
4974 * For flags, only the XFS_BMAPI_ATTRFORK flag is examined.
4975 * For the other flag values, the effect is as if XFS_BMAPI_METADATA
4976 * was set and all the others were clear.
4977 */
4978int /* error */
4979xfs_bmapi_single(
4980 xfs_trans_t *tp, /* transaction pointer */
4981 xfs_inode_t *ip, /* incore inode */
4982 int whichfork, /* data or attr fork */
4983 xfs_fsblock_t *fsb, /* output: mapped block */
4984 xfs_fileoff_t bno) /* starting file offs. mapped */
4985{
4986 int eof; /* we've hit the end of extents */
4987 int error; /* error return */
4988 xfs_bmbt_irec_t got; /* current file extent record */
4989 xfs_ifork_t *ifp; /* inode fork pointer */
4990 xfs_extnum_t lastx; /* last useful extent number */
4991 xfs_bmbt_irec_t prev; /* previous file extent record */
4992
4993 ifp = XFS_IFORK_PTR(ip, whichfork);
4994 if (unlikely(
4995 XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE &&
4996 XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_EXTENTS)) {
4997 XFS_ERROR_REPORT("xfs_bmapi_single", XFS_ERRLEVEL_LOW,
4998 ip->i_mount);
4999 return XFS_ERROR(EFSCORRUPTED);
5000 }
5001 if (XFS_FORCED_SHUTDOWN(ip->i_mount))
5002 return XFS_ERROR(EIO);
5003 XFS_STATS_INC(xs_blk_mapr);
5004 if (!(ifp->if_flags & XFS_IFEXTENTS) &&
5005 (error = xfs_iread_extents(tp, ip, whichfork)))
5006 return error;
5007 (void)xfs_bmap_search_extents(ip, bno, whichfork, &eof, &lastx, &got,
5008 &prev);
5009 /*
5010 * Reading past eof, act as though there's a hole
5011 * up to end.
5012 */
5013 if (eof || got.br_startoff > bno) {
5014 *fsb = NULLFSBLOCK;
5015 return 0;
5016 }
5017 ASSERT(!isnullstartblock(got.br_startblock));
5018 ASSERT(bno < got.br_startoff + got.br_blockcount);
5019 *fsb = got.br_startblock + (bno - got.br_startoff);
5020 return 0;
5021}
5022
5023/*
5024 * Unmap (remove) blocks from a file. 4972 * Unmap (remove) blocks from a file.
5025 * If nexts is nonzero then the number of extents to remove is limited to 4973 * If nexts is nonzero then the number of extents to remove is limited to
5026 * that value. If not all extents in the block range can be removed then 4974 * that value. If not all extents in the block range can be removed then
diff --git a/fs/xfs/xfs_bmap.h b/fs/xfs/xfs_bmap.h
index 16257c6eba7..01693390df2 100644
--- a/fs/xfs/xfs_bmap.h
+++ b/fs/xfs/xfs_bmap.h
@@ -299,21 +299,6 @@ int xfs_bmapi_read(struct xfs_inode *ip, xfs_fileoff_t bno,
299 int *nmap, int flags); 299 int *nmap, int flags);
300 300
301/* 301/*
302 * Map file blocks to filesystem blocks, simple version.
303 * One block only, read-only.
304 * For flags, only the XFS_BMAPI_ATTRFORK flag is examined.
305 * For the other flag values, the effect is as if XFS_BMAPI_METADATA
306 * was set and all the others were clear.
307 */
308int /* error */
309xfs_bmapi_single(
310 struct xfs_trans *tp, /* transaction pointer */
311 struct xfs_inode *ip, /* incore inode */
312 int whichfork, /* data or attr fork */
313 xfs_fsblock_t *fsb, /* output: mapped block */
314 xfs_fileoff_t bno); /* starting file offs. mapped */
315
316/*
317 * Unmap (remove) blocks from a file. 302 * Unmap (remove) blocks from a file.
318 * If nexts is nonzero then the number of extents to remove is limited to 303 * If nexts is nonzero then the number of extents to remove is limited to
319 * that value. If not all extents in the block range can be removed then 304 * that value. If not all extents in the block range can be removed then
diff --git a/fs/xfs/xfs_da_btree.c b/fs/xfs/xfs_da_btree.c
index 44dfa39099e..70a5f580e5e 100644
--- a/fs/xfs/xfs_da_btree.c
+++ b/fs/xfs/xfs_da_btree.c
@@ -1975,32 +1975,16 @@ xfs_da_do_buf(
1975 /* 1975 /*
1976 * Optimize the one-block case. 1976 * Optimize the one-block case.
1977 */ 1977 */
1978 if (nfsb == 1) { 1978 if (nfsb == 1)
1979 xfs_fsblock_t fsb;
1980
1981 if ((error =
1982 xfs_bmapi_single(trans, dp, whichfork, &fsb,
1983 (xfs_fileoff_t)bno))) {
1984 return error;
1985 }
1986 mapp = &map; 1979 mapp = &map;
1987 if (fsb == NULLFSBLOCK) { 1980 else
1988 nmap = 0;
1989 } else {
1990 map.br_startblock = fsb;
1991 map.br_startoff = (xfs_fileoff_t)bno;
1992 map.br_blockcount = 1;
1993 nmap = 1;
1994 }
1995 } else {
1996 mapp = kmem_alloc(sizeof(*mapp) * nfsb, KM_SLEEP); 1981 mapp = kmem_alloc(sizeof(*mapp) * nfsb, KM_SLEEP);
1997 nmap = nfsb; 1982
1998 error = xfs_bmapi_read(dp, (xfs_fileoff_t)bno, nfsb, 1983 nmap = nfsb;
1999 mapp, &nmap, 1984 error = xfs_bmapi_read(dp, (xfs_fileoff_t)bno, nfsb, mapp,
2000 xfs_bmapi_aflag(whichfork)); 1985 &nmap, xfs_bmapi_aflag(whichfork));
2001 if (error) 1986 if (error)
2002 goto exit0; 1987 goto exit0;
2003 }
2004 } else { 1988 } else {
2005 map.br_startblock = XFS_DADDR_TO_FSB(mp, mappedbno); 1989 map.br_startblock = XFS_DADDR_TO_FSB(mp, mappedbno);
2006 map.br_startoff = (xfs_fileoff_t)bno; 1990 map.br_startoff = (xfs_fileoff_t)bno;
diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c
index 35561a511b5..e5f40c6460b 100644
--- a/fs/xfs/xfs_rtalloc.c
+++ b/fs/xfs/xfs_rtalloc.c
@@ -856,33 +856,23 @@ xfs_rtbuf_get(
856 xfs_buf_t **bpp) /* output: buffer for the block */ 856 xfs_buf_t **bpp) /* output: buffer for the block */
857{ 857{
858 xfs_buf_t *bp; /* block buffer, result */ 858 xfs_buf_t *bp; /* block buffer, result */
859 xfs_daddr_t d; /* disk addr of block */
860 int error; /* error value */
861 xfs_fsblock_t fsb; /* fs block number for block */
862 xfs_inode_t *ip; /* bitmap or summary inode */ 859 xfs_inode_t *ip; /* bitmap or summary inode */
860 xfs_bmbt_irec_t map;
861 int nmap;
862 int error; /* error value */
863 863
864 ip = issum ? mp->m_rsumip : mp->m_rbmip; 864 ip = issum ? mp->m_rsumip : mp->m_rbmip;
865 /* 865
866 * Map from the file offset (block) and inode number to the 866 error = xfs_bmapi_read(ip, block, 1, &map, &nmap, XFS_DATA_FORK);
867 * file system block. 867 if (error)
868 */
869 error = xfs_bmapi_single(tp, ip, XFS_DATA_FORK, &fsb, block);
870 if (error) {
871 return error; 868 return error;
872 } 869
873 ASSERT(fsb != NULLFSBLOCK); 870 ASSERT(map.br_startblock != NULLFSBLOCK);
874 /* 871 error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp,
875 * Convert to disk address for buffer cache. 872 XFS_FSB_TO_DADDR(mp, map.br_startblock),
876 */
877 d = XFS_FSB_TO_DADDR(mp, fsb);
878 /*
879 * Read the buffer.
880 */
881 error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, d,
882 mp->m_bsize, 0, &bp); 873 mp->m_bsize, 0, &bp);
883 if (error) { 874 if (error)
884 return error; 875 return error;
885 }
886 ASSERT(!xfs_buf_geterror(bp)); 876 ASSERT(!xfs_buf_geterror(bp));
887 *bpp = bp; 877 *bpp = bp;
888 return 0; 878 return 0;