From be94d11704ef79030fd2e6a0c41b4a7f65f9e860 Mon Sep 17 00:00:00 2001 From: Mark Fasheh Date: Tue, 11 Sep 2007 15:22:06 -0700 Subject: 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 Reviewed-by: Joel Becker --- fs/ocfs2/dir.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'fs/ocfs2/dir.c') diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c index 4bb54406354..4791683a119 100644 --- a/fs/ocfs2/dir.c +++ b/fs/ocfs2/dir.c @@ -628,6 +628,23 @@ leave: return status; } +/* + * Convenience function for callers which just want the block number + * mapped to a name and don't require the full dirent info, etc. + */ +int ocfs2_lookup_ino_from_name(struct inode *dir, const char *name, + int namelen, u64 *blkno) +{ + int ret; + struct buffer_head *bh = NULL; + struct ocfs2_dir_entry *dirent = NULL; + + ret = ocfs2_find_files_on_disk(name, namelen, blkno, dir, &bh, &dirent); + brelse(bh); + + return ret; +} + /* Check for a name within a directory. * * Return 0 if the name does not exist -- cgit v1.2.3