lkml.org 
[lkml]   [2018]   [Jun]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH V6 20/30] fs: conver to bio_for_each_chunk_segment_all()
    Date
    bio_for_each_segment_all() can't be used any more after multipage bvec is
    enabled, so we have to convert to bio_for_each_chunk_segment_all().

    Signed-off-by: Ming Lei <ming.lei@redhat.com>
    ---
    fs/block_dev.c | 6 ++++--
    fs/crypto/bio.c | 3 ++-
    fs/direct-io.c | 4 +++-
    fs/iomap.c | 3 ++-
    fs/mpage.c | 3 ++-
    5 files changed, 13 insertions(+), 6 deletions(-)

    diff --git a/fs/block_dev.c b/fs/block_dev.c
    index bef6934b6189..6726f8297a7b 100644
    --- a/fs/block_dev.c
    +++ b/fs/block_dev.c
    @@ -197,6 +197,7 @@ __blkdev_direct_IO_simple(struct kiocb *iocb, struct iov_iter *iter,
    ssize_t ret;
    blk_qc_t qc;
    int i;
    + struct bvec_chunk_iter citer;

    if ((pos | iov_iter_alignment(iter)) &
    (bdev_logical_block_size(bdev) - 1))
    @@ -242,7 +243,7 @@ __blkdev_direct_IO_simple(struct kiocb *iocb, struct iov_iter *iter,
    }
    __set_current_state(TASK_RUNNING);

    - bio_for_each_segment_all(bvec, &bio, i) {
    + bio_for_each_chunk_segment_all(bvec, &bio, i, citer) {
    if (should_dirty && !PageCompound(bvec->bv_page))
    set_page_dirty_lock(bvec->bv_page);
    put_page(bvec->bv_page);
    @@ -309,8 +310,9 @@ static void blkdev_bio_end_io(struct bio *bio)
    } else {
    struct bio_vec *bvec;
    int i;
    + struct bvec_chunk_iter citer;

    - bio_for_each_segment_all(bvec, bio, i)
    + bio_for_each_chunk_segment_all(bvec, bio, i, citer)
    put_page(bvec->bv_page);
    bio_put(bio);
    }
    diff --git a/fs/crypto/bio.c b/fs/crypto/bio.c
    index 0d5e6a569d58..13bcbdbf3440 100644
    --- a/fs/crypto/bio.c
    +++ b/fs/crypto/bio.c
    @@ -37,8 +37,9 @@ static void completion_pages(struct work_struct *work)
    struct bio *bio = ctx->r.bio;
    struct bio_vec *bv;
    int i;
    + struct bvec_chunk_iter citer;

    - bio_for_each_segment_all(bv, bio, i) {
    + bio_for_each_chunk_segment_all(bv, bio, i, citer) {
    struct page *page = bv->bv_page;
    int ret = fscrypt_decrypt_page(page->mapping->host, page,
    PAGE_SIZE, 0, page->index);
    diff --git a/fs/direct-io.c b/fs/direct-io.c
    index 093fb54cd316..8f7fd985450a 100644
    --- a/fs/direct-io.c
    +++ b/fs/direct-io.c
    @@ -551,7 +551,9 @@ static blk_status_t dio_bio_complete(struct dio *dio, struct bio *bio)
    if (dio->is_async && dio->op == REQ_OP_READ && dio->should_dirty) {
    bio_check_pages_dirty(bio); /* transfers ownership */
    } else {
    - bio_for_each_segment_all(bvec, bio, i) {
    + struct bvec_chunk_iter citer;
    +
    + bio_for_each_chunk_segment_all(bvec, bio, i, citer) {
    struct page *page = bvec->bv_page;

    if (dio->op == REQ_OP_READ && !PageCompound(page) &&
    diff --git a/fs/iomap.c b/fs/iomap.c
    index 206539d369a8..dbc35c40a1c4 100644
    --- a/fs/iomap.c
    +++ b/fs/iomap.c
    @@ -934,8 +934,9 @@ static void iomap_dio_bio_end_io(struct bio *bio)
    } else {
    struct bio_vec *bvec;
    int i;
    + struct bvec_chunk_iter citer;

    - bio_for_each_segment_all(bvec, bio, i)
    + bio_for_each_chunk_segment_all(bvec, bio, i, citer)
    put_page(bvec->bv_page);
    bio_put(bio);
    }
    diff --git a/fs/mpage.c b/fs/mpage.c
    index b7e7f570733a..78b372607650 100644
    --- a/fs/mpage.c
    +++ b/fs/mpage.c
    @@ -48,8 +48,9 @@ static void mpage_end_io(struct bio *bio)
    {
    struct bio_vec *bv;
    int i;
    + struct bvec_chunk_iter citer;

    - bio_for_each_segment_all(bv, bio, i) {
    + bio_for_each_chunk_segment_all(bv, bio, i, citer) {
    struct page *page = bv->bv_page;
    page_endio(page, op_is_write(bio_op(bio)),
    blk_status_to_errno(bio->bi_status));
    --
    2.9.5
    \
     
     \ /
      Last update: 2018-06-09 14:37    [W:4.112 / U:0.420 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site