diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-07-04 20:22:55 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-07-04 20:22:55 +0200 |
commit | da67db4e55b45690cd283cdbdfa92d3252191108 (patch) | |
tree | f56fc5f922b25a9341850cbf08d91fba5b7009cc /fs/hpfs/buffer.c | |
parent | Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/pow... (diff) | |
parent | hpfs: implement prefetch to improve performance (diff) | |
download | linux-da67db4e55b45690cd283cdbdfa92d3252191108.tar.xz linux-da67db4e55b45690cd283cdbdfa92d3252191108.zip |
Merge branch 'hpfs' from Mikulas Patocka
Merge hpfs patches from Mikulas Patocka.
* emailed patches from Mikulas Patocka <mpatocka@artax.karlin.mff.cuni.cz>:
hpfs: implement prefetch to improve performance
hpfs: use mpage
hpfs: better test for errors
Diffstat (limited to 'fs/hpfs/buffer.c')
-rw-r--r-- | fs/hpfs/buffer.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/fs/hpfs/buffer.c b/fs/hpfs/buffer.c index f49d1498aa2e..4d0a1afa058c 100644 --- a/fs/hpfs/buffer.c +++ b/fs/hpfs/buffer.c @@ -7,8 +7,37 @@ */ #include <linux/sched.h> #include <linux/slab.h> +#include <linux/blkdev.h> #include "hpfs_fn.h" +void hpfs_prefetch_sectors(struct super_block *s, unsigned secno, int n) +{ + struct buffer_head *bh; + struct blk_plug plug; + + if (n <= 0 || unlikely(secno >= hpfs_sb(s)->sb_fs_size)) + return; + + bh = sb_find_get_block(s, secno); + if (bh) { + if (buffer_uptodate(bh)) { + brelse(bh); + return; + } + brelse(bh); + }; + + blk_start_plug(&plug); + while (n > 0) { + if (unlikely(secno >= hpfs_sb(s)->sb_fs_size)) + break; + sb_breadahead(s, secno); + secno++; + n--; + } + blk_finish_plug(&plug); +} + /* Map a sector into a buffer and return pointers to it and to the buffer. */ void *hpfs_map_sector(struct super_block *s, unsigned secno, struct buffer_head **bhp, @@ -18,6 +47,8 @@ void *hpfs_map_sector(struct super_block *s, unsigned secno, struct buffer_head hpfs_lock_assert(s); + hpfs_prefetch_sectors(s, secno, ahead); + cond_resched(); *bhp = bh = sb_bread(s, secno); @@ -67,6 +98,8 @@ void *hpfs_map_4sectors(struct super_block *s, unsigned secno, struct quad_buffe return NULL; } + hpfs_prefetch_sectors(s, secno, 4 + ahead); + qbh->data = data = kmalloc(2048, GFP_NOFS); if (!data) { printk("HPFS: hpfs_map_4sectors: out of memory\n"); |