aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/dir.c
diff options
context:
space:
mode:
authorMark Fasheh <mark.fasheh@oracle.com>2007-09-11 18:22:06 -0400
committerMark Fasheh <mark.fasheh@oracle.com>2007-10-12 14:54:38 -0400
commitbe94d11704ef79030fd2e6a0c41b4a7f65f9e860 (patch)
tree10b060625c464db127210acc00e8aa80b43ce6f3 /fs/ocfs2/dir.c
parent0bfbbf62a8b5a129ba2c689283bfece80a601aba (diff)
ocfs2: Provide convenience function for ino lookup
A couple paths which needed to just match a parent dir + name pair to an inode number were a bit messy because they had to deal with ocfs2_find_files_on_disk() which returns a larger number of values. Provide a convenience function, ocfs2_lookup_ino_from_name() which internalizes all the extra accounting. Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com> Reviewed-by: Joel Becker <joel.becker@oracle.com>
Diffstat (limited to 'fs/ocfs2/dir.c')
-rw-r--r--fs/ocfs2/dir.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c
index 4bb54406354b..4791683a119c 100644
--- a/fs/ocfs2/dir.c
+++ b/fs/ocfs2/dir.c
@@ -628,6 +628,23 @@ leave:
628 return status; 628 return status;
629} 629}
630 630
631/*
632 * Convenience function for callers which just want the block number
633 * mapped to a name and don't require the full dirent info, etc.
634 */
635int ocfs2_lookup_ino_from_name(struct inode *dir, const char *name,
636 int namelen, u64 *blkno)
637{
638 int ret;
639 struct buffer_head *bh = NULL;
640 struct ocfs2_dir_entry *dirent = NULL;
641
642 ret = ocfs2_find_files_on_disk(name, namelen, blkno, dir, &bh, &dirent);
643 brelse(bh);
644
645 return ret;
646}
647
631/* Check for a name within a directory. 648/* Check for a name within a directory.
632 * 649 *
633 * Return 0 if the name does not exist 650 * Return 0 if the name does not exist