patch-2.2.14 linux/fs/block_dev.c
Next file: linux/fs/buffer.c
Previous file: linux/fs/binfmt_aout.c
Back to the patch index
Back to the overall index
- Lines: 72
- Date:
Tue Jan 4 10:12:22 2000
- Orig file:
v2.2.13/linux/fs/block_dev.c
- Orig date:
Fri May 28 09:20:36 1999
diff -u --recursive --new-file v2.2.13/linux/fs/block_dev.c linux/fs/block_dev.c
@@ -67,39 +67,50 @@
if (chars != blocksize)
fn = bread;
bh = fn(dev, block, blocksize);
+ if (!bh)
+ return written ? written : -EIO;
+ if (!buffer_uptodate(bh))
+ wait_on_buffer(bh);
}
#else
bh = getblk(dev, block, blocksize);
+ if (!bh)
+ return written ? written : -EIO;
- if (chars != blocksize && !buffer_uptodate(bh)) {
- if(!filp->f_reada ||
- !read_ahead[MAJOR(dev)]) {
- /* We do this to force the read of a single buffer */
- brelse(bh);
- bh = bread(dev,block,blocksize);
- } else {
- /* Read-ahead before write */
- blocks = read_ahead[MAJOR(dev)] / (blocksize >> 9) / 2;
- if (block + blocks > size) blocks = size - block;
- if (blocks > NBUF) blocks=NBUF;
+ if (!buffer_uptodate(bh))
+ {
+ if (chars == blocksize)
+ wait_on_buffer(bh);
+ else
+ {
bhlist[0] = bh;
- for(i=1; i<blocks; i++){
- bhlist[i] = getblk (dev, block+i, blocksize);
- if(!bhlist[i]){
- while(i >= 0) brelse(bhlist[i--]);
- return written ? written : -EIO;
- };
- };
+ if (!filp->f_reada || !read_ahead[MAJOR(dev)]) {
+ /* We do this to force the read of a single buffer */
+ blocks = 1;
+ } else {
+ /* Read-ahead before write */
+ blocks = read_ahead[MAJOR(dev)] / (blocksize >> 9) / 2;
+ if (block + blocks > size) blocks = size - block;
+ if (blocks > NBUF) blocks=NBUF;
+ for(i=1; i<blocks; i++)
+ {
+ bhlist[i] = getblk (dev, block+i, blocksize);
+ if (!bhlist[i])
+ {
+ while(i >= 0) brelse(bhlist[i--]);
+ return written ? written : -EIO;
+ }
+ }
+ }
ll_rw_block(READ, blocks, bhlist);
for(i=1; i<blocks; i++) brelse(bhlist[i]);
wait_on_buffer(bh);
-
+ if (!buffer_uptodate(bh))
+ return written ? written : -EIO;
};
};
#endif
block++;
- if (!bh)
- return written ? written : -EIO;
p = offset + bh->b_data;
offset = 0;
*ppos += chars;
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)