summaryrefslogtreecommitdiffstats
path: root/fs/hpfs/map.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-07-04 20:22:55 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2013-07-04 20:22:55 +0200
commitda67db4e55b45690cd283cdbdfa92d3252191108 (patch)
treef56fc5f922b25a9341850cbf08d91fba5b7009cc /fs/hpfs/map.c
parentMerge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/pow... (diff)
parenthpfs: implement prefetch to improve performance (diff)
downloadlinux-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/map.c')
-rw-r--r--fs/hpfs/map.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/fs/hpfs/map.c b/fs/hpfs/map.c
index 4acb19d78359..3aa66ae1031e 100644
--- a/fs/hpfs/map.c
+++ b/fs/hpfs/map.c
@@ -17,7 +17,9 @@ __le32 *hpfs_map_bitmap(struct super_block *s, unsigned bmp_block,
struct quad_buffer_head *qbh, char *id)
{
secno sec;
- if (hpfs_sb(s)->sb_chk) if (bmp_block * 16384 > hpfs_sb(s)->sb_fs_size) {
+ __le32 *ret;
+ unsigned n_bands = (hpfs_sb(s)->sb_fs_size + 0x3fff) >> 14;
+ if (hpfs_sb(s)->sb_chk) if (bmp_block >= n_bands) {
hpfs_error(s, "hpfs_map_bitmap called with bad parameter: %08x at %s", bmp_block, id);
return NULL;
}
@@ -26,7 +28,23 @@ __le32 *hpfs_map_bitmap(struct super_block *s, unsigned bmp_block,
hpfs_error(s, "invalid bitmap block pointer %08x -> %08x at %s", bmp_block, sec, id);
return NULL;
}
- return hpfs_map_4sectors(s, sec, qbh, 4);
+ ret = hpfs_map_4sectors(s, sec, qbh, 4);
+ if (ret) hpfs_prefetch_bitmap(s, bmp_block + 1);
+ return ret;
+}
+
+void hpfs_prefetch_bitmap(struct super_block *s, unsigned bmp_block)
+{
+ unsigned to_prefetch, next_prefetch;
+ unsigned n_bands = (hpfs_sb(s)->sb_fs_size + 0x3fff) >> 14;
+ if (unlikely(bmp_block >= n_bands))
+ return;
+ to_prefetch = le32_to_cpu(hpfs_sb(s)->sb_bmp_dir[bmp_block]);
+ if (unlikely(bmp_block + 1 >= n_bands))
+ next_prefetch = 0;
+ else
+ next_prefetch = le32_to_cpu(hpfs_sb(s)->sb_bmp_dir[bmp_block + 1]);
+ hpfs_prefetch_sectors(s, to_prefetch, 4 + 4 * (to_prefetch + 4 == next_prefetch));
}
/*