Messages in this thread Patch in this message | | | Date | Tue, 26 Jan 1999 08:39:53 +0000 (GMT) | From | Tigran Aivazian <> | Subject | [patch] getblk() == NULL removed in fs/buffer.c |
| |
Hello,
Having a look at getblk() it would seem it can never return NULL. But bread() and breada() do check for that (but not always). To make things more consistent and a tiny bit more compact I removed those checks.
The patch for fs/buffer.c is below (against 2.2.0-pre8 but should be ok against 2.2.0).
One could also remove calls to touch_buffer() but I did not, because as things may change the need for them (in bread and breada) may come back.
Regards, ------ Tigran A. Aivazian | http://www.sco.com Escalations Research Group | tel: +44-(0)1923-813796 Santa Cruz Operation Ltd | http://www.aivazian.demon.co.uk
--- buffer.c.0 Tue Jan 26 08:29:13 1999 +++ buffer.c Tue Jan 26 08:30:30 1999 @@ -862,18 +862,14 @@ { struct buffer_head * bh = getblk(dev, block, size); - if (bh) { - touch_buffer(bh); - if (buffer_uptodate(bh)) - return bh; - ll_rw_block(READ, 1, &bh); - wait_on_buffer(bh); - if (buffer_uptodate(bh)) - return bh; - brelse(bh); - return NULL; - } - printk("VFS: bread: impossible error\n"); + touch_buffer(bh); + if (buffer_uptodate(bh)) + return bh; + ll_rw_block(READ, 1, &bh); + wait_on_buffer(bh); + if (buffer_uptodate(bh)) + return bh; + brelse(bh); return NULL; } @@ -897,9 +893,10 @@ if (pos >= filesize) return NULL; - if (block < 0 || !(bh = getblk(dev,block,bufsize))) + if (block < 0) return NULL; + bh = getblk(dev,block,bufsize); index = BUFSIZE_INDEX(bh->b_size); touch_buffer(bh);
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |