summaryrefslogtreecommitdiffstats
path: root/fs/ext4/namei.c
diff options
context:
space:
mode:
authorTao Ma <boyu.mt@taobao.com>2012-12-10 14:05:59 -0500
committerTheodore Ts'o <tytso@mit.edu>2012-12-10 14:05:59 -0500
commit7335cd3b41b1e704608ca46159641ca9cb598121 (patch)
tree33d9d6de3fa27be5701d09e3f75cd568c3021038 /fs/ext4/namei.c
parent65d165d9366dbf783d0102177006d47c8859ba31 (diff)
downloadblackbird-op-linux-7335cd3b41b1e704608ca46159641ca9cb598121.tar.gz
blackbird-op-linux-7335cd3b41b1e704608ca46159641ca9cb598121.zip
ext4: create a new function search_dir
search_dirblock is used to search a dir block, but the code is almost the same for searching an inline dir. So create a new fuction search_dir and let search_dirblock call it. Signed-off-by: Tao Ma <boyu.mt@taobao.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/namei.c')
-rw-r--r--fs/ext4/namei.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 3cde36bd8020..d50684b91496 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -1005,6 +1005,16 @@ errout:
return (err);
}
+static inline int search_dirblock(struct buffer_head *bh,
+ struct inode *dir,
+ const struct qstr *d_name,
+ unsigned int offset,
+ struct ext4_dir_entry_2 **res_dir)
+{
+ return search_dir(bh, bh->b_data, dir->i_sb->s_blocksize, dir,
+ d_name, offset, res_dir);
+}
+
/*
* Directory block splitting, compacting
@@ -1098,11 +1108,13 @@ static inline int ext4_match (int len, const char * const name,
/*
* Returns 0 if not found, -1 on failure, and 1 on success
*/
-static inline int search_dirblock(struct buffer_head *bh,
- struct inode *dir,
- const struct qstr *d_name,
- unsigned int offset,
- struct ext4_dir_entry_2 ** res_dir)
+int search_dir(struct buffer_head *bh,
+ char *search_buf,
+ int buf_size,
+ struct inode *dir,
+ const struct qstr *d_name,
+ unsigned int offset,
+ struct ext4_dir_entry_2 **res_dir)
{
struct ext4_dir_entry_2 * de;
char * dlimit;
@@ -1110,8 +1122,8 @@ static inline int search_dirblock(struct buffer_head *bh,
const char *name = d_name->name;
int namelen = d_name->len;
- de = (struct ext4_dir_entry_2 *) bh->b_data;
- dlimit = bh->b_data + dir->i_sb->s_blocksize;
+ de = (struct ext4_dir_entry_2 *)search_buf;
+ dlimit = search_buf + buf_size;
while ((char *) de < dlimit) {
/* this code is executed quadratically often */
/* do minimal checking `by hand' */
OpenPOWER on IntegriCloud