aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_inode.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2008-11-27 22:23:41 -0500
committerNiv Sardi <xaiki@sgi.com>2008-11-30 19:38:03 -0500
commit94e1b69d1abd108d306e926c3012ec89e481c0da (patch)
treed7fb02a0c855729831dcddbef6afcb518d3ed870 /fs/xfs/xfs_inode.c
parenta1941895034cda2bffa23ba845607c82138ccf52 (diff)
[XFS] merge xfs_imap into xfs_dilocate
xfs_imap is the only caller of xfs_dilocate and doesn't add any significant value. Merge the two functions and document the various cases we have for inode cluster lookup in the new xfs_imap. Also remove the unused im_agblkno and im_ioffset fields from struct xfs_imap while we're at it. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Dave Chinner <david@fromorbit.com> Signed-off-by: Niv Sardi <xaiki@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_inode.c')
-rw-r--r--fs/xfs/xfs_inode.c60
1 files changed, 1 insertions, 59 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 663ff9e517fd..bf528b725ae1 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -266,7 +266,7 @@ xfs_inotobp(
266 * in once, thus we can use the mapping information stored in the inode 266 * in once, thus we can use the mapping information stored in the inode
267 * rather than calling xfs_imap(). This allows us to avoid the overhead 267 * rather than calling xfs_imap(). This allows us to avoid the overhead
268 * of looking at the inode btree for small block file systems 268 * of looking at the inode btree for small block file systems
269 * (see xfs_dilocate()). 269 * (see xfs_imap()).
270 */ 270 */
271int 271int
272xfs_itobp( 272xfs_itobp(
@@ -2508,64 +2508,6 @@ xfs_idata_realloc(
2508 ASSERT(ifp->if_bytes <= XFS_IFORK_SIZE(ip, whichfork)); 2508 ASSERT(ifp->if_bytes <= XFS_IFORK_SIZE(ip, whichfork));
2509} 2509}
2510 2510
2511
2512
2513
2514/*
2515 * Map inode to disk block and offset.
2516 *
2517 * mp -- the mount point structure for the current file system
2518 * tp -- the current transaction
2519 * ino -- the inode number of the inode to be located
2520 * imap -- this structure is filled in with the information necessary
2521 * to retrieve the given inode from disk
2522 * flags -- flags to pass to xfs_dilocate indicating whether or not
2523 * lookups in the inode btree were OK or not
2524 */
2525int
2526xfs_imap(
2527 xfs_mount_t *mp,
2528 xfs_trans_t *tp,
2529 xfs_ino_t ino,
2530 xfs_imap_t *imap,
2531 uint flags)
2532{
2533 xfs_fsblock_t fsbno;
2534 int len;
2535 int off;
2536 int error;
2537
2538 fsbno = imap->im_blkno ?
2539 XFS_DADDR_TO_FSB(mp, imap->im_blkno) : NULLFSBLOCK;
2540 error = xfs_dilocate(mp, tp, ino, &fsbno, &len, &off, flags);
2541 if (error)
2542 return error;
2543
2544 imap->im_blkno = XFS_FSB_TO_DADDR(mp, fsbno);
2545 imap->im_len = XFS_FSB_TO_BB(mp, len);
2546 imap->im_agblkno = XFS_FSB_TO_AGBNO(mp, fsbno);
2547 imap->im_ioffset = (ushort)off;
2548 imap->im_boffset = (ushort)(off << mp->m_sb.sb_inodelog);
2549
2550 /*
2551 * If the inode number maps to a block outside the bounds
2552 * of the file system then return NULL rather than calling
2553 * read_buf and panicing when we get an error from the
2554 * driver.
2555 */
2556 if ((imap->im_blkno + imap->im_len) >
2557 XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks)) {
2558 xfs_fs_cmn_err(CE_ALERT, mp, "xfs_imap: "
2559 "(imap->im_blkno (0x%llx) + imap->im_len (0x%llx)) > "
2560 " XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks) (0x%llx)",
2561 (unsigned long long) imap->im_blkno,
2562 (unsigned long long) imap->im_len,
2563 XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks));
2564 return EINVAL;
2565 }
2566 return 0;
2567}
2568
2569void 2511void
2570xfs_idestroy_fork( 2512xfs_idestroy_fork(
2571 xfs_inode_t *ip, 2513 xfs_inode_t *ip,