orangefs: use bvec_set_{page,folio} to initialize bvecs
Use the bvec_set_page and bvec_set_folio helpers to initialize bvecs. Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20230203150634.3199647-17-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
8bb7cd842c
commit
8ead80b2c5
|
@ -49,10 +49,8 @@ static int orangefs_writepage_locked(struct page *page,
|
|||
/* Should've been handled in orangefs_invalidate_folio. */
|
||||
WARN_ON(off == len || off + wlen > len);
|
||||
|
||||
bv.bv_page = page;
|
||||
bv.bv_len = wlen;
|
||||
bv.bv_offset = off % PAGE_SIZE;
|
||||
WARN_ON(wlen == 0);
|
||||
bvec_set_page(&bv, page, wlen, off % PAGE_SIZE);
|
||||
iov_iter_bvec(&iter, ITER_SOURCE, &bv, 1, wlen);
|
||||
|
||||
ret = wait_for_direct_io(ORANGEFS_IO_WRITE, inode, &off, &iter, wlen,
|
||||
|
@ -102,15 +100,11 @@ static int orangefs_writepages_work(struct orangefs_writepages *ow,
|
|||
|
||||
for (i = 0; i < ow->npages; i++) {
|
||||
set_page_writeback(ow->pages[i]);
|
||||
ow->bv[i].bv_page = ow->pages[i];
|
||||
ow->bv[i].bv_len = min(page_offset(ow->pages[i]) + PAGE_SIZE,
|
||||
ow->off + ow->len) -
|
||||
max(ow->off, page_offset(ow->pages[i]));
|
||||
if (i == 0)
|
||||
ow->bv[i].bv_offset = ow->off -
|
||||
page_offset(ow->pages[i]);
|
||||
else
|
||||
ow->bv[i].bv_offset = 0;
|
||||
bvec_set_page(&ow->bv[i], ow->pages[i],
|
||||
min(page_offset(ow->pages[i]) + PAGE_SIZE,
|
||||
ow->off + ow->len) -
|
||||
max(ow->off, page_offset(ow->pages[i])),
|
||||
i == 0 ? ow->off - page_offset(ow->pages[i]) : 0);
|
||||
}
|
||||
iov_iter_bvec(&iter, ITER_SOURCE, ow->bv, ow->npages, ow->len);
|
||||
|
||||
|
@ -300,9 +294,7 @@ static int orangefs_read_folio(struct file *file, struct folio *folio)
|
|||
orangefs_launder_folio(folio);
|
||||
|
||||
off = folio_pos(folio);
|
||||
bv.bv_page = &folio->page;
|
||||
bv.bv_len = folio_size(folio);
|
||||
bv.bv_offset = 0;
|
||||
bvec_set_folio(&bv, folio, folio_size(folio), 0);
|
||||
iov_iter_bvec(&iter, ITER_DEST, &bv, 1, folio_size(folio));
|
||||
|
||||
ret = wait_for_direct_io(ORANGEFS_IO_READ, inode, &off, &iter,
|
||||
|
|
Loading…
Reference in New Issue