bufmgr->blkh.blkaddr = NULL_ADDR;
bufmgr->last_mapped_block = &bufmgr->blkh;
- for (i = 0; i < ARRAY_SIZE(bufmgr->mapped_buckets); i++)
- for (j = 0; j < ARRAY_SIZE(bufmgr->mapped_buckets[0]); j++)
- init_list_head(&bufmgr->mapped_buckets[i][j]);
+ for (i = 0; i < ARRAY_SIZE(bufmgr->watermeter); i++)
+ for (j = 0; j < (1 << sbi->blkszbits); j++)
+ init_list_head(&bufmgr->watermeter[i][j]);
bufmgr->tail_blkaddr = startblk;
bufmgr->sbi = sbi;
return bufmgr;
}
-static void erofs_bupdate_mapped(struct erofs_buffer_block *bb)
+static void erofs_update_bwatermeter(struct erofs_buffer_block *bb)
{
struct erofs_bufmgr *bmgr = bb->buffers.fsprivate;
struct erofs_sb_info *sbi = bmgr->sbi;
if (bb->blkaddr == NULL_ADDR)
return;
- bkt = bmgr->mapped_buckets[bb->type] +
+ bkt = bmgr->watermeter[bb->type] +
(bb->buffers.off & (erofs_blksiz(sbi) - 1));
- list_del(&bb->mapped_list);
- list_add_tail(&bb->mapped_list, bkt);
+ list_del(&bb->sibling);
+ list_add_tail(&bb->sibling, bkt);
}
/* return occupied bytes in specific buffer block if succeed */
/* need to update the tail_blkaddr */
if (tailupdate)
bmgr->tail_blkaddr = blkaddr + bb->buffers.nblocks;
- erofs_bupdate_mapped(bb);
+ erofs_update_bwatermeter(bb);
}
return ((alignedoffset + incr + blkmask) & blkmask) + 1;
}
used_before = rounddown(blksiz - (size + inline_ext), alignsize);
for (; used_before; --used_before) {
- struct list_head *bt = bmgr->mapped_buckets[type] + used_before;
+ struct list_head *bt = bmgr->watermeter[type] + used_before;
if (list_empty(bt))
continue;
- cur = list_first_entry(bt, struct erofs_buffer_block,
- mapped_list);
+ cur = list_first_entry(bt, struct erofs_buffer_block, sibling);
/* last mapped block can be expended, don't handle it here */
if (list_next_entry(cur, list)->blkaddr == NULL_ADDR) {
&bmgr->last_mapped_block->list);
else
list_add_tail(&bb->list, &bmgr->blkh.list);
- init_list_head(&bb->mapped_list);
+ init_list_head(&bb->sibling);
bh = malloc(sizeof(struct erofs_buffer_head));
if (!bh) {
}
}
bmgr->last_mapped_block = bb;
- erofs_bupdate_mapped(bb);
+ erofs_update_bwatermeter(bb);
}
blkaddr = bb->blkaddr + bb->buffers.nblocks;
if (bb == bmgr->last_mapped_block)
bmgr->last_mapped_block = list_prev_entry(bb, list);
- list_del(&bb->mapped_list);
+ list_del(&bb->sibling);
list_del(&bb->list);
free(bb);
}