diff options
author | Evgeniy Dushistov <dushistov@mail.ru> | 2006-06-25 08:47:25 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-25 13:01:03 -0400 |
commit | dd187a2603d9904ddc410441348f0cfc558a5233 (patch) | |
tree | a3859f88d1f458a18d31a231f03c955393282255 /fs | |
parent | abf5d15fd2e52517dd56a17a846d5a1f900b7db4 (diff) |
[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>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ufs/dir.c | 7 | ||||
-rw-r--r-- | fs/ufs/ialloc.c | 1 | ||||
-rw-r--r-- | fs/ufs/inode.c | 4 |
3 files changed, 7 insertions, 5 deletions
diff --git a/fs/ufs/dir.c b/fs/ufs/dir.c index 732c3fd2b6f2..7f0a0aa63584 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, | |||
252 | unsigned long start, n; | 252 | unsigned long start, n; |
253 | unsigned long npages = ufs_dir_pages(dir); | 253 | unsigned long npages = ufs_dir_pages(dir); |
254 | struct page *page = NULL; | 254 | struct page *page = NULL; |
255 | struct ufs_inode_info *ui = UFS_I(dir); | ||
255 | struct ufs_dir_entry *de; | 256 | struct ufs_dir_entry *de; |
256 | 257 | ||
257 | UFSD("ENTER, dir_ino %lu, name %s, namlen %u\n", dir->i_ino, name, namelen); | 258 | 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 | /* OFFSET_CACHE */ | 263 | /* OFFSET_CACHE */ |
263 | *res_page = NULL; | 264 | *res_page = NULL; |
264 | 265 | ||
265 | /* start = ei->i_dir_start_lookup; */ | 266 | start = ui->i_dir_start_lookup; |
266 | start = 0; | 267 | |
267 | if (start >= npages) | 268 | if (start >= npages) |
268 | start = 0; | 269 | start = 0; |
269 | n = start; | 270 | n = start; |
@@ -295,7 +296,7 @@ out: | |||
295 | 296 | ||
296 | found: | 297 | found: |
297 | *res_page = page; | 298 | *res_page = page; |
298 | /* ei->i_dir_start_lookup = n; */ | 299 | ui->i_dir_start_lookup = n; |
299 | return de; | 300 | return de; |
300 | } | 301 | } |
301 | 302 | ||
diff --git a/fs/ufs/ialloc.c b/fs/ufs/ialloc.c index ad017fa2dd21..c684aaad9998 100644 --- a/fs/ufs/ialloc.c +++ b/fs/ufs/ialloc.c | |||
@@ -264,6 +264,7 @@ cg_found: | |||
264 | ufsi->i_shadow = 0; | 264 | ufsi->i_shadow = 0; |
265 | ufsi->i_osync = 0; | 265 | ufsi->i_osync = 0; |
266 | ufsi->i_oeftflag = 0; | 266 | ufsi->i_oeftflag = 0; |
267 | ufsi->i_dir_start_lookup = 0; | ||
267 | memset(&ufsi->i_u1, 0, sizeof(ufsi->i_u1)); | 268 | memset(&ufsi->i_u1, 0, sizeof(ufsi->i_u1)); |
268 | 269 | ||
269 | insert_inode_hash(inode); | 270 | insert_inode_hash(inode); |
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c index 01f754462341..c57612d443d0 100644 --- a/fs/ufs/inode.c +++ b/fs/ufs/inode.c | |||
@@ -628,12 +628,12 @@ void ufs_read_inode (struct inode * inode) | |||
628 | ufsi->i_shadow = fs32_to_cpu(sb, ufs_inode->ui_u3.ui_sun.ui_shadow); | 628 | ufsi->i_shadow = fs32_to_cpu(sb, ufs_inode->ui_u3.ui_sun.ui_shadow); |
629 | ufsi->i_oeftflag = fs32_to_cpu(sb, ufs_inode->ui_u3.ui_sun.ui_oeftflag); | 629 | ufsi->i_oeftflag = fs32_to_cpu(sb, ufs_inode->ui_u3.ui_sun.ui_oeftflag); |
630 | ufsi->i_lastfrag = (inode->i_size + uspi->s_fsize - 1) >> uspi->s_fshift; | 630 | ufsi->i_lastfrag = (inode->i_size + uspi->s_fsize - 1) >> uspi->s_fshift; |
631 | ufsi->i_dir_start_lookup = 0; | ||
631 | 632 | ||
632 | if (S_ISCHR(mode) || S_ISBLK(mode) || inode->i_blocks) { | 633 | if (S_ISCHR(mode) || S_ISBLK(mode) || inode->i_blocks) { |
633 | for (i = 0; i < (UFS_NDADDR + UFS_NINDIR); i++) | 634 | for (i = 0; i < (UFS_NDADDR + UFS_NINDIR); i++) |
634 | ufsi->i_u1.i_data[i] = ufs_inode->ui_u2.ui_addr.ui_db[i]; | 635 | ufsi->i_u1.i_data[i] = ufs_inode->ui_u2.ui_addr.ui_db[i]; |
635 | } | 636 | } else { |
636 | else { | ||
637 | for (i = 0; i < (UFS_NDADDR + UFS_NINDIR) * 4; i++) | 637 | for (i = 0; i < (UFS_NDADDR + UFS_NINDIR) * 4; i++) |
638 | ufsi->i_u1.i_symlink[i] = ufs_inode->ui_u2.ui_symlink[i]; | 638 | ufsi->i_u1.i_symlink[i] = ufs_inode->ui_u2.ui_symlink[i]; |
639 | } | 639 | } |