/*
* blocks are contiguous in bio but pages added to bio
- * could have a gap comparing to iobuf->dr_pages.
+ * could have a gap comparing to pages.
* e.g. a page mapped to a hole in the middle.
*/
for (i = index; i < iobuf->dr_npages; i++) {
- if (iobuf->dr_pages[i] == bv->bv_page)
+ if (iobuf->dr_lnbs[i]->lnb_page == bv->bv_page)
return iobuf->dr_lnbs[i];
}
total = 0;
bio_for_each_segment_all(bv, bio, iter_all) {
for (i = index; i < iobuf->dr_npages; i++) {
- if (iobuf->dr_pages[i] == bv->bv_page) {
+ if (iobuf->dr_lnbs[i]->lnb_page == bv->bv_page) {
lnb = iobuf->dr_lnbs[i];
break;
}
blocks = pages * (PAGE_SIZE >> osd_sb(d)->s_blocksize_bits);
if (iobuf->dr_bl_buf.lb_len >= blocks * sizeof(iobuf->dr_blocks[0])) {
- LASSERT(iobuf->dr_pg_buf.lb_len >=
- pages * sizeof(iobuf->dr_pages[0]));
return 0;
}
i <<= 1;
CDEBUG(D_OTHER, "realloc %u for %u (%u) pages\n",
- (unsigned int)(pages * sizeof(iobuf->dr_pages[0])), i, pages);
+ (unsigned int)(pages * sizeof(iobuf->dr_lnbs[0])), i, pages);
pages = i;
blocks = pages * (PAGE_SIZE >> osd_sb(d)->s_blocksize_bits);
iobuf->dr_max_pages = 0;
if (unlikely(iobuf->dr_blocks == NULL))
return -ENOMEM;
- lu_buf_realloc(&iobuf->dr_pg_buf, pages * sizeof(iobuf->dr_pages[0]));
- iobuf->dr_pages = iobuf->dr_pg_buf.lb_buf;
- if (unlikely(iobuf->dr_pages == NULL))
- return -ENOMEM;
-
lu_buf_realloc(&iobuf->dr_lnb_buf,
pages * sizeof(iobuf->dr_lnbs[0]));
iobuf->dr_lnbs = iobuf->dr_lnb_buf.lb_buf;
struct niobuf_local *lnb)
{
LASSERT(iobuf->dr_npages < iobuf->dr_max_pages);
- iobuf->dr_pages[iobuf->dr_npages] = lnb->lnb_page;
iobuf->dr_lnbs[iobuf->dr_npages] = lnb;
iobuf->dr_npages++;
}
sector_t count)
{
int blocks_per_page = PAGE_SIZE >> inode->i_blkbits;
- struct page **pages = iobuf->dr_pages;
+ struct niobuf_local **lnbs = iobuf->dr_lnbs;
int npages = iobuf->dr_npages;
sector_t *blocks = iobuf->dr_blocks;
struct super_block *sb = inode->i_sb;
* "blocks_left_page" is reduced), and the last page may
* skip some blocks at the end (limited by "count").
*/
- page = pages[page_idx];
+ page = lnbs[page_idx]->lnb_page;
LASSERT(page_idx < iobuf->dr_npages);
i = block_idx % blocks_per_page;
handle_t *handle = NULL;
sector_t start_blocks = 0, count = 0;
loff_t disk_size = 0;
- struct page **page = iobuf->dr_pages;
+ struct niobuf_local **lnbs = iobuf->dr_lnbs;
int pages = iobuf->dr_npages;
sector_t *blocks = iobuf->dr_blocks;
struct niobuf_local *lnb1, *lnb2;
max_page_index = inode->i_sb->s_maxbytes >> PAGE_SHIFT;
CDEBUG(D_OTHER, "inode %lu: map %d pages from %lu\n",
- inode->i_ino, pages, (*page)->index);
+ inode->i_ino, pages, (*lnbs)->lnb_page->index);
if (create) {
create = LDISKFS_GET_BLOCKS_CREATE;
ktime_t time;
if (fp == NULL) { /* start new extent */
- fp = *page++;
+ fp = (*lnbs)->lnb_page;
+ lnbs++;
clen = 1;
iobuf->dr_lextents++;
if (++i != pages)
continue;
- } else if (fp->index + clen == (*page)->index) {
+ } else if (fp->index + clen == (*lnbs)->lnb_page->index) {
/* continue the extent */
- page++;
+ lnbs++;
clen++;
if (++i != pages)
continue;
/* early release to let others read data during the bulk */
for (i = 0; i < iobuf->dr_npages; i++) {
- LASSERT(PageLocked(iobuf->dr_pages[i]));
- if (!PagePrivate2(iobuf->dr_pages[i]))
- unlock_page(iobuf->dr_pages[i]);
+ struct page *page = iobuf->dr_lnbs[i]->lnb_page;
+ LASSERT(PageLocked(page));
+ if (!PagePrivate2(page))
+ unlock_page(page);
}
}