> TIA for your help.
> -Matt
>
> struct buffer_head ** my_bread(kdev_t dev, u64 lba, u64 blockstoread)
> {
> struct buffer_head **bh, *thisbh;
>
> unsigned int blocksize = get_hardblocksize(dev);
> unsigned int i;
> if (!blocksize) blocksize = 512;
> printk(KERN_INFO "about to getblk %d blocks\n", blockstoread);
>
> bh = kmalloc(GFP_KERNEL, blockstoread * sizeof(struct buffer_head *));
> if (!bh) return NULL;
>
> for (i=0; i<blockstoread; i++) {
> bh[i] = getblk(dev, lba+i, blocksize);
> if (!bh[i]) {
> printk(KERN_WARNING, "getblk(lba=%x) failed.\n", lba);
> }
> }
>
> /* at this point, none of the bh[i]s are NULL. */
>
> ll_rw_block(READ, blockstoread, bh);
>
> /* now, all but the first 3 bh[i]s are NULL, and all bh[i]->b_reqnext ==
> NULL */
>
> /* Walk the chain */
> for (i=0; i<blockstoread; i++) {
> if (!bh[i]) continue;
>
> thisbh = bh[i];
> do {
> wait_on_buffer(thisbh);
> if (!buffer_uptodate(thisbh)) {
> printk(KERN_WARNING "bh is not uptodate after waiting!\n");
> }
> thisbh = thisbh->b_reqnext;
> if (thisbh) printk(KERN_INFO "my_bread walking the chain...\n");
> } while (thisbh);
> }
>
> return bh;
> }
>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/