aboutsummaryrefslogtreecommitdiffstats
path: root/fs/hpfs/map.c
diff options
context:
space:
mode:
authorMikulas Patocka <mikulas@artax.karlin.mff.cuni.cz>2013-07-04 13:04:01 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-07-04 14:22:46 -0400
commit275f495dbe34300d793466a7d96c70f83fbae1bc (patch)
tree75785e0623188c52360f845419354b3b7cd67051 /fs/hpfs/map.c
parenta0c1b7596323a2323d5f5c7d2404af7b58a1ef4e (diff)
hpfs: implement prefetch to improve performance
This patch implements prefetch to improve performance. It helps mostly when scanning the bitmaps to calculate free space. Signed-off-by: Mikulas Patocka <mpatocka@artax.karlin.mff.cuni.cz> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/hpfs/map.c')
-rw-r--r--fs/hpfs/map.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/fs/hpfs/map.c b/fs/hpfs/map.c
index 803d3da3a0fe..3aa66ae1031e 100644
--- a/fs/hpfs/map.c
+++ b/fs/hpfs/map.c
@@ -17,6 +17,7 @@ __le32 *hpfs_map_bitmap(struct super_block *s, unsigned bmp_block,
17 struct quad_buffer_head *qbh, char *id) 17 struct quad_buffer_head *qbh, char *id)
18{ 18{
19 secno sec; 19 secno sec;
20 __le32 *ret;
20 unsigned n_bands = (hpfs_sb(s)->sb_fs_size + 0x3fff) >> 14; 21 unsigned n_bands = (hpfs_sb(s)->sb_fs_size + 0x3fff) >> 14;
21 if (hpfs_sb(s)->sb_chk) if (bmp_block >= n_bands) { 22 if (hpfs_sb(s)->sb_chk) if (bmp_block >= n_bands) {
22 hpfs_error(s, "hpfs_map_bitmap called with bad parameter: %08x at %s", bmp_block, id); 23 hpfs_error(s, "hpfs_map_bitmap called with bad parameter: %08x at %s", bmp_block, id);
@@ -27,7 +28,23 @@ __le32 *hpfs_map_bitmap(struct super_block *s, unsigned bmp_block,
27 hpfs_error(s, "invalid bitmap block pointer %08x -> %08x at %s", bmp_block, sec, id); 28 hpfs_error(s, "invalid bitmap block pointer %08x -> %08x at %s", bmp_block, sec, id);
28 return NULL; 29 return NULL;
29 } 30 }
30 return hpfs_map_4sectors(s, sec, qbh, 4); 31 ret = hpfs_map_4sectors(s, sec, qbh, 4);
32 if (ret) hpfs_prefetch_bitmap(s, bmp_block + 1);
33 return ret;
34}
35
36void hpfs_prefetch_bitmap(struct super_block *s, unsigned bmp_block)
37{
38 unsigned to_prefetch, next_prefetch;
39 unsigned n_bands = (hpfs_sb(s)->sb_fs_size + 0x3fff) >> 14;
40 if (unlikely(bmp_block >= n_bands))
41 return;
42 to_prefetch = le32_to_cpu(hpfs_sb(s)->sb_bmp_dir[bmp_block]);
43 if (unlikely(bmp_block + 1 >= n_bands))
44 next_prefetch = 0;
45 else
46 next_prefetch = le32_to_cpu(hpfs_sb(s)->sb_bmp_dir[bmp_block + 1]);
47 hpfs_prefetch_sectors(s, to_prefetch, 4 + 4 * (to_prefetch + 4 == next_prefetch));
31} 48}
32 49
33/* 50/*