Commit dd187a26 authored by Evgeniy Dushistov's avatar Evgeniy Dushistov Committed by Linus Torvalds

[PATCH] ufs: little directory lookup optimization

This patch make little optimization of ufs_find_entry like "ext2" does.  Save
number of page and reuse it again in the next call.
Signed-off-by: default avatarEvgeniy Dushistov <dushistov@mail.ru>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent abf5d15f
...@@ -252,6 +252,7 @@ struct ufs_dir_entry *ufs_find_entry(struct inode *dir, struct dentry *dentry, ...@@ -252,6 +252,7 @@ struct ufs_dir_entry *ufs_find_entry(struct inode *dir, struct dentry *dentry,
unsigned long start, n; unsigned long start, n;
unsigned long npages = ufs_dir_pages(dir); unsigned long npages = ufs_dir_pages(dir);
struct page *page = NULL; struct page *page = NULL;
struct ufs_inode_info *ui = UFS_I(dir);
struct ufs_dir_entry *de; struct ufs_dir_entry *de;
UFSD("ENTER, dir_ino %lu, name %s, namlen %u\n", dir->i_ino, name, namelen); UFSD("ENTER, dir_ino %lu, name %s, namlen %u\n", dir->i_ino, name, namelen);
...@@ -262,8 +263,8 @@ struct ufs_dir_entry *ufs_find_entry(struct inode *dir, struct dentry *dentry, ...@@ -262,8 +263,8 @@ struct ufs_dir_entry *ufs_find_entry(struct inode *dir, struct dentry *dentry,
/* OFFSET_CACHE */ /* OFFSET_CACHE */
*res_page = NULL; *res_page = NULL;
/* start = ei->i_dir_start_lookup; */ start = ui->i_dir_start_lookup;
start = 0;
if (start >= npages) if (start >= npages)
start = 0; start = 0;
n = start; n = start;
...@@ -295,7 +296,7 @@ struct ufs_dir_entry *ufs_find_entry(struct inode *dir, struct dentry *dentry, ...@@ -295,7 +296,7 @@ struct ufs_dir_entry *ufs_find_entry(struct inode *dir, struct dentry *dentry,
found: found:
*res_page = page; *res_page = page;
/* ei->i_dir_start_lookup = n; */ ui->i_dir_start_lookup = n;
return de; return de;
} }
......
...@@ -264,6 +264,7 @@ struct inode * ufs_new_inode(struct inode * dir, int mode) ...@@ -264,6 +264,7 @@ struct inode * ufs_new_inode(struct inode * dir, int mode)
ufsi->i_shadow = 0; ufsi->i_shadow = 0;
ufsi->i_osync = 0; ufsi->i_osync = 0;
ufsi->i_oeftflag = 0; ufsi->i_oeftflag = 0;
ufsi->i_dir_start_lookup = 0;
memset(&ufsi->i_u1, 0, sizeof(ufsi->i_u1)); memset(&ufsi->i_u1, 0, sizeof(ufsi->i_u1));
insert_inode_hash(inode); insert_inode_hash(inode);
......
...@@ -628,12 +628,12 @@ void ufs_read_inode (struct inode * inode) ...@@ -628,12 +628,12 @@ void ufs_read_inode (struct inode * inode)
ufsi->i_shadow = fs32_to_cpu(sb, ufs_inode->ui_u3.ui_sun.ui_shadow); ufsi->i_shadow = fs32_to_cpu(sb, ufs_inode->ui_u3.ui_sun.ui_shadow);
ufsi->i_oeftflag = fs32_to_cpu(sb, ufs_inode->ui_u3.ui_sun.ui_oeftflag); ufsi->i_oeftflag = fs32_to_cpu(sb, ufs_inode->ui_u3.ui_sun.ui_oeftflag);
ufsi->i_lastfrag = (inode->i_size + uspi->s_fsize - 1) >> uspi->s_fshift; ufsi->i_lastfrag = (inode->i_size + uspi->s_fsize - 1) >> uspi->s_fshift;
ufsi->i_dir_start_lookup = 0;
if (S_ISCHR(mode) || S_ISBLK(mode) || inode->i_blocks) { if (S_ISCHR(mode) || S_ISBLK(mode) || inode->i_blocks) {
for (i = 0; i < (UFS_NDADDR + UFS_NINDIR); i++) for (i = 0; i < (UFS_NDADDR + UFS_NINDIR); i++)
ufsi->i_u1.i_data[i] = ufs_inode->ui_u2.ui_addr.ui_db[i]; ufsi->i_u1.i_data[i] = ufs_inode->ui_u2.ui_addr.ui_db[i];
} } else {
else {
for (i = 0; i < (UFS_NDADDR + UFS_NINDIR) * 4; i++) for (i = 0; i < (UFS_NDADDR + UFS_NINDIR) * 4; i++)
ufsi->i_u1.i_symlink[i] = ufs_inode->ui_u2.ui_symlink[i]; ufsi->i_u1.i_symlink[i] = ufs_inode->ui_u2.ui_symlink[i];
} }
......
...@@ -27,6 +27,7 @@ struct ufs_inode_info { ...@@ -27,6 +27,7 @@ struct ufs_inode_info {
__u32 i_oeftflag; __u32 i_oeftflag;
__u16 i_osync; __u16 i_osync;
__u32 i_lastfrag; __u32 i_lastfrag;
__u32 i_dir_start_lookup;
struct inode vfs_inode; struct inode vfs_inode;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment