{
struct block *bhead = bio->bi_private;
- while (!list_empty(&bhead->lru)) {
- struct block *b = list_first_entry(&bhead->lru,
- struct block,
- lru);
- list_del_init(&b->lru);
+ while (bhead->chain) {
+ struct block *b = bhead->chain;
+ bhead->chain = b->chain;
+ b->chain = NULL;
bio->bi_private = b;
block_loaded(bio, error);
}
return 0;
}
+ LAFS_BUG(b->chain != NULL, b);
if (bio->bi_size == 0) {
bio->bi_sector = sect;
bio->bi_bdev = bdev;
bio_add_page(bio, page, fs->blocksize, offset);
bio->bi_private = b;
bio->bi_end_io = blocks_loaded;
- BUG_ON(!list_empty(&b->lru));
return 0;
}
if (bio->bi_sector + (bio->bi_size / 512) != sect
return -EINVAL;
/* added the block successfully */
headb = bio->bi_private;
- list_add_tail(&b->lru, &headb->lru);
+ b->chain = headb->chain;
+ headb->chain = b;
return 0;
}
* in storage (i.e. in another snapshot)
*/
- struct block *chain; /* on list of unincorporated changes */
+ struct block *chain; /* on list of unincorporated changes, or list of blocks
+ * being read in */
#if DEBUG_REF
struct ref {int cnt; char *name; } holders[16];