aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvgeniy Dushistov <dushistov@mail.ru>2006-06-25 05:47:25 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-25 10:01:03 -0700
commitdd187a2603d9904ddc410441348f0cfc558a5233 (patch)
treea3859f88d1f458a18d31a231f03c955393282255
parentabf5d15fd2e52517dd56a17a846d5a1f900b7db4 (diff)
downloadkernel_goldelico_gta04-dd187a2603d9904ddc410441348f0cfc558a5233.zip
kernel_goldelico_gta04-dd187a2603d9904ddc410441348f0cfc558a5233.tar.gz
kernel_goldelico_gta04-dd187a2603d9904ddc410441348f0cfc558a5233.tar.bz2
[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: Evgeniy Dushistov <dushistov@mail.ru> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--fs/ufs/dir.c7
-rw-r--r--fs/ufs/ialloc.c1
-rw-r--r--fs/ufs/inode.c4
-rw-r--r--include/linux/ufs_fs_i.h1
4 files changed, 8 insertions, 5 deletions
diff --git a/fs/ufs/dir.c b/fs/ufs/dir.c
index 732c3fd..7f0a0aa 100644
--- a/fs/ufs/dir.c
+++ b/fs/ufs/dir.c
@@ -252,6 +252,7 @@ struct ufs_dir_entry *ufs_find_entry(struct inode *dir, struct dentry *dentry,
unsigned long start, n;
unsigned long npages = ufs_dir_pages(dir);
struct page *page = NULL;
+ struct ufs_inode_info *ui = UFS_I(dir);
struct ufs_dir_entry *de;
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,
/* OFFSET_CACHE */
*res_page = NULL;
- /* start = ei->i_dir_start_lookup; */
- start = 0;
+ start = ui->i_dir_start_lookup;
+
if (start >= npages)
start = 0;
n = start;
@@ -295,7 +296,7 @@ out:
found:
*res_page = page;
- /* ei->i_dir_start_lookup = n; */
+ ui->i_dir_start_lookup = n;
return de;
}
diff --git a/fs/ufs/ialloc.c b/fs/ufs/ialloc.c
index ad017fa..c684aaa 100644
--- a/fs/ufs/ialloc.c
+++ b/fs/ufs/ialloc.c
@@ -264,6 +264,7 @@ cg_found:
ufsi->i_shadow = 0;
ufsi->i_osync = 0;
ufsi->i_oeftflag = 0;
+ ufsi->i_dir_start_lookup = 0;
memset(&ufsi->i_u1, 0, sizeof(ufsi->i_u1));
insert_inode_hash(inode);
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c
index 01f7544..c57612d 100644
--- a/fs/ufs/inode.c
+++ b/fs/ufs/inode.c
@@ -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_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_dir_start_lookup = 0;
if (S_ISCHR(mode) || S_ISBLK(mode) || inode->i_blocks) {
for (i = 0; i < (UFS_NDADDR + UFS_NINDIR); 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++)
ufsi->i_u1.i_symlink[i] = ufs_inode->ui_u2.ui_symlink[i];
}
diff --git a/include/linux/ufs_fs_i.h b/include/linux/ufs_fs_i.h
index 21665a9..f50ce3b 100644
--- a/include/linux/ufs_fs_i.h
+++ b/include/linux/ufs_fs_i.h
@@ -27,6 +27,7 @@ struct ufs_inode_info {
__u32 i_oeftflag;
__u16 i_osync;
__u32 i_lastfrag;
+ __u32 i_dir_start_lookup;
struct inode vfs_inode;
};