Commit 8ead80b2 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

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: default avatarChristoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20230203150634.3199647-17-hch@lst.deSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 8bb7cd84
...@@ -49,10 +49,8 @@ static int orangefs_writepage_locked(struct page *page, ...@@ -49,10 +49,8 @@ static int orangefs_writepage_locked(struct page *page,
/* Should've been handled in orangefs_invalidate_folio. */ /* Should've been handled in orangefs_invalidate_folio. */
WARN_ON(off == len || off + wlen > len); 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); WARN_ON(wlen == 0);
bvec_set_page(&bv, page, wlen, off % PAGE_SIZE);
iov_iter_bvec(&iter, ITER_SOURCE, &bv, 1, wlen); iov_iter_bvec(&iter, ITER_SOURCE, &bv, 1, wlen);
ret = wait_for_direct_io(ORANGEFS_IO_WRITE, inode, &off, &iter, 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, ...@@ -102,15 +100,11 @@ static int orangefs_writepages_work(struct orangefs_writepages *ow,
for (i = 0; i < ow->npages; i++) { for (i = 0; i < ow->npages; i++) {
set_page_writeback(ow->pages[i]); set_page_writeback(ow->pages[i]);
ow->bv[i].bv_page = ow->pages[i]; bvec_set_page(&ow->bv[i], ow->pages[i],
ow->bv[i].bv_len = min(page_offset(ow->pages[i]) + PAGE_SIZE, min(page_offset(ow->pages[i]) + PAGE_SIZE,
ow->off + ow->len) - ow->off + ow->len) -
max(ow->off, page_offset(ow->pages[i])); max(ow->off, page_offset(ow->pages[i])),
if (i == 0) i == 0 ? ow->off - page_offset(ow->pages[i]) : 0);
ow->bv[i].bv_offset = ow->off -
page_offset(ow->pages[i]);
else
ow->bv[i].bv_offset = 0;
} }
iov_iter_bvec(&iter, ITER_SOURCE, ow->bv, ow->npages, ow->len); 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) ...@@ -300,9 +294,7 @@ static int orangefs_read_folio(struct file *file, struct folio *folio)
orangefs_launder_folio(folio); orangefs_launder_folio(folio);
off = folio_pos(folio); off = folio_pos(folio);
bv.bv_page = &folio->page; bvec_set_folio(&bv, folio, folio_size(folio), 0);
bv.bv_len = folio_size(folio);
bv.bv_offset = 0;
iov_iter_bvec(&iter, ITER_DEST, &bv, 1, folio_size(folio)); iov_iter_bvec(&iter, ITER_DEST, &bv, 1, folio_size(folio));
ret = wait_for_direct_io(ORANGEFS_IO_READ, inode, &off, &iter, ret = wait_for_direct_io(ORANGEFS_IO_READ, inode, &off, &iter,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment