buffer.c (2d8ad8719591fa803b0d589ed057fa46f49b7155) | buffer.c (7dd29d8d865efdb00c0542a5d2c87af8c52ea6c7) |
---|---|
1/* 2 * linux/fs/hpfs/buffer.c 3 * 4 * Mikulas Patocka (mikulas@artax.karlin.mff.cuni.cz), 1998-1999 5 * 6 * general buffer i/o 7 */ 8#include <linux/sched.h> --- 18 unchanged lines hidden (view full) --- 27 28/* Map a sector into a buffer and return pointers to it and to the buffer. */ 29 30void *hpfs_map_sector(struct super_block *s, unsigned secno, struct buffer_head **bhp, 31 int ahead) 32{ 33 struct buffer_head *bh; 34 | 1/* 2 * linux/fs/hpfs/buffer.c 3 * 4 * Mikulas Patocka (mikulas@artax.karlin.mff.cuni.cz), 1998-1999 5 * 6 * general buffer i/o 7 */ 8#include <linux/sched.h> --- 18 unchanged lines hidden (view full) --- 27 28/* Map a sector into a buffer and return pointers to it and to the buffer. */ 29 30void *hpfs_map_sector(struct super_block *s, unsigned secno, struct buffer_head **bhp, 31 int ahead) 32{ 33 struct buffer_head *bh; 34 |
35 hpfs_lock_assert(s); 36 |
|
35 cond_resched(); 36 37 *bhp = bh = sb_bread(s, secno); 38 if (bh != NULL) 39 return bh->b_data; 40 else { 41 printk("HPFS: hpfs_map_sector: read error\n"); 42 return NULL; 43 } 44} 45 46/* Like hpfs_map_sector but don't read anything */ 47 48void *hpfs_get_sector(struct super_block *s, unsigned secno, struct buffer_head **bhp) 49{ 50 struct buffer_head *bh; 51 /*return hpfs_map_sector(s, secno, bhp, 0);*/ 52 | 37 cond_resched(); 38 39 *bhp = bh = sb_bread(s, secno); 40 if (bh != NULL) 41 return bh->b_data; 42 else { 43 printk("HPFS: hpfs_map_sector: read error\n"); 44 return NULL; 45 } 46} 47 48/* Like hpfs_map_sector but don't read anything */ 49 50void *hpfs_get_sector(struct super_block *s, unsigned secno, struct buffer_head **bhp) 51{ 52 struct buffer_head *bh; 53 /*return hpfs_map_sector(s, secno, bhp, 0);*/ 54 |
55 hpfs_lock_assert(s); 56 |
|
53 cond_resched(); 54 55 if ((*bhp = bh = sb_getblk(s, secno)) != NULL) { 56 if (!buffer_uptodate(bh)) wait_on_buffer(bh); 57 set_buffer_uptodate(bh); 58 return bh->b_data; 59 } else { 60 printk("HPFS: hpfs_get_sector: getblk failed\n"); --- 4 unchanged lines hidden (view full) --- 65/* Map 4 sectors into a 4buffer and return pointers to it and to the buffer. */ 66 67void *hpfs_map_4sectors(struct super_block *s, unsigned secno, struct quad_buffer_head *qbh, 68 int ahead) 69{ 70 struct buffer_head *bh; 71 char *data; 72 | 57 cond_resched(); 58 59 if ((*bhp = bh = sb_getblk(s, secno)) != NULL) { 60 if (!buffer_uptodate(bh)) wait_on_buffer(bh); 61 set_buffer_uptodate(bh); 62 return bh->b_data; 63 } else { 64 printk("HPFS: hpfs_get_sector: getblk failed\n"); --- 4 unchanged lines hidden (view full) --- 69/* Map 4 sectors into a 4buffer and return pointers to it and to the buffer. */ 70 71void *hpfs_map_4sectors(struct super_block *s, unsigned secno, struct quad_buffer_head *qbh, 72 int ahead) 73{ 74 struct buffer_head *bh; 75 char *data; 76 |
77 hpfs_lock_assert(s); 78 |
|
73 cond_resched(); 74 75 if (secno & 3) { 76 printk("HPFS: hpfs_map_4sectors: unaligned read\n"); 77 return NULL; 78 } 79 80 qbh->data = data = kmalloc(2048, GFP_NOFS); --- 39 unchanged lines hidden (view full) --- 120 121/* Don't read sectors */ 122 123void *hpfs_get_4sectors(struct super_block *s, unsigned secno, 124 struct quad_buffer_head *qbh) 125{ 126 cond_resched(); 127 | 79 cond_resched(); 80 81 if (secno & 3) { 82 printk("HPFS: hpfs_map_4sectors: unaligned read\n"); 83 return NULL; 84 } 85 86 qbh->data = data = kmalloc(2048, GFP_NOFS); --- 39 unchanged lines hidden (view full) --- 126 127/* Don't read sectors */ 128 129void *hpfs_get_4sectors(struct super_block *s, unsigned secno, 130 struct quad_buffer_head *qbh) 131{ 132 cond_resched(); 133 |
134 hpfs_lock_assert(s); 135 |
|
128 if (secno & 3) { 129 printk("HPFS: hpfs_get_4sectors: unaligned read\n"); 130 return NULL; 131 } 132 133 /*return hpfs_map_4sectors(s, secno, qbh, 0);*/ 134 if (!(qbh->data = kmalloc(2048, GFP_NOFS))) { 135 printk("HPFS: hpfs_get_4sectors: out of memory\n"); --- 41 unchanged lines hidden --- | 136 if (secno & 3) { 137 printk("HPFS: hpfs_get_4sectors: unaligned read\n"); 138 return NULL; 139 } 140 141 /*return hpfs_map_4sectors(s, secno, qbh, 0);*/ 142 if (!(qbh->data = kmalloc(2048, GFP_NOFS))) { 143 printk("HPFS: hpfs_get_4sectors: out of memory\n"); --- 41 unchanged lines hidden --- |