]> www.infradead.org Git - users/hch/block.git/commitdiff
nfs: use bvec_set_page to initialize bvecs
authorChristoph Hellwig <hch@lst.de>
Wed, 25 Jan 2023 16:34:20 +0000 (17:34 +0100)
committerChristoph Hellwig <hch@lst.de>
Wed, 25 Jan 2023 17:29:50 +0000 (18:29 +0100)
Use the bvec_set_page helper to initialize bvecs.

Signed-off-by: Christoph Hellwig <hch@lst.de>
fs/nfs/fscache.c

index e731c00a9fcbc3b2c869e18d93fc0f75d5843218..ea5f2976dfaba4ed1b3c178a4a6891c4b6fd80b2 100644 (file)
@@ -245,14 +245,12 @@ static int fscache_fallback_read_page(struct inode *inode, struct page *page)
        struct netfs_cache_resources cres;
        struct fscache_cookie *cookie = nfs_i_fscache(inode);
        struct iov_iter iter;
-       struct bio_vec bvec[1];
+       struct bio_vec bvec;
        int ret;
 
        memset(&cres, 0, sizeof(cres));
-       bvec[0].bv_page         = page;
-       bvec[0].bv_offset       = 0;
-       bvec[0].bv_len          = PAGE_SIZE;
-       iov_iter_bvec(&iter, ITER_DEST, bvec, ARRAY_SIZE(bvec), PAGE_SIZE);
+       bvec_set_page(&bvec, page, PAGE_SIZE, 0);
+       iov_iter_bvec(&iter, ITER_DEST, &bvec, 1, PAGE_SIZE);
 
        ret = fscache_begin_read_operation(&cres, cookie);
        if (ret < 0)
@@ -273,16 +271,14 @@ static int fscache_fallback_write_page(struct inode *inode, struct page *page,
        struct netfs_cache_resources cres;
        struct fscache_cookie *cookie = nfs_i_fscache(inode);
        struct iov_iter iter;
-       struct bio_vec bvec[1];
+       struct bio_vec bvec;
        loff_t start = page_offset(page);
        size_t len = PAGE_SIZE;
        int ret;
 
        memset(&cres, 0, sizeof(cres));
-       bvec[0].bv_page         = page;
-       bvec[0].bv_offset       = 0;
-       bvec[0].bv_len          = PAGE_SIZE;
-       iov_iter_bvec(&iter, ITER_SOURCE, bvec, ARRAY_SIZE(bvec), PAGE_SIZE);
+       bvec_set_page(&bvec, page, PAGE_SIZE, 0);
+       iov_iter_bvec(&iter, ITER_SOURCE, &bvec, 1, PAGE_SIZE);
 
        ret = fscache_begin_write_operation(&cres, cookie);
        if (ret < 0)