diff options
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 @@ | |||
7 | */ | 7 | */ |
8 | #include <linux/sched.h> | 8 | #include <linux/sched.h> |
9 | #include <linux/slab.h> | 9 | #include <linux/slab.h> |
10 | #include <linux/blkdev.h> | ||
10 | #include "hpfs_fn.h" | 11 | #include "hpfs_fn.h" |
11 | 12 | ||
13 | void hpfs_prefetch_sectors(struct super_block *s, unsigned secno, int n) | ||
14 | { | ||
15 | struct buffer_head *bh; | ||
16 | struct blk_plug plug; | ||
17 | |||
18 | if (n <= 0 || unlikely(secno >= hpfs_sb(s)->sb_fs_size)) | ||
19 | return; | ||
20 | |||
21 | bh = sb_find_get_block(s, secno); | ||
22 | if (bh) { | ||
23 | if (buffer_uptodate(bh)) { | ||
24 | brelse(bh); | ||
25 | return; | ||
26 | } | ||
27 | brelse(bh); | ||
28 | }; | ||
29 | |||
30 | blk_start_plug(&plug); | ||
31 | while (n > 0) { | ||
32 | if (unlikely(secno >= hpfs_sb(s)->sb_fs_size)) | ||
33 | break; | ||
34 | sb_breadahead(s, secno); | ||
35 | secno++; | ||
36 | n--; | ||
37 | } | ||
38 | blk_finish_plug(&plug); | ||
39 | } | ||
40 | |||
12 | /* Map a sector into a buffer and return pointers to it and to the buffer. */ | 41 | /* Map a sector into a buffer and return pointers to it and to the buffer. */ |
13 | 42 | ||
14 | void *hpfs_map_sector(struct super_block *s, unsigned secno, struct buffer_head **bhp, | 43 | 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 | |||
18 | 47 | ||
19 | hpfs_lock_assert(s); | 48 | hpfs_lock_assert(s); |
20 | 49 | ||
50 | hpfs_prefetch_sectors(s, secno, ahead); | ||
51 | |||
21 | cond_resched(); | 52 | cond_resched(); |
22 | 53 | ||
23 | *bhp = bh = sb_bread(s, secno); | 54 | *bhp = bh = sb_bread(s, secno); |
@@ -67,6 +98,8 @@ void *hpfs_map_4sectors(struct super_block *s, unsigned secno, struct quad_buffe | |||
67 | return NULL; | 98 | return NULL; |
68 | } | 99 | } |
69 | 100 | ||
101 | hpfs_prefetch_sectors(s, secno, 4 + ahead); | ||
102 | |||
70 | qbh->data = data = kmalloc(2048, GFP_NOFS); | 103 | qbh->data = data = kmalloc(2048, GFP_NOFS); |
71 | if (!data) { | 104 | if (!data) { |
72 | printk("HPFS: hpfs_map_4sectors: out of memory\n"); | 105 | printk("HPFS: hpfs_map_4sectors: out of memory\n"); |