Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1678054

Re: [PATCH V4 10/12] block: call __bio_free in bio_endio

From Shaohua Li <shli@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH V4 10/12] block: call __bio_free in bio_endio
Date 2017-06-29 20:40 +0200
Message-ID <tXMwb-2FO-27@gated-at.bofh.it> (permalink)
References <tXppV-t5-19@gated-at.bofh.it> <tXpq3-t5-189@gated-at.bofh.it> <tXsH9-rB-41@gated-at.bofh.it> <tXt0u-yk-3@gated-at.bofh.it> <tXLgK-1X8-27@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Jun 29, 2017 at 07:15:52PM +0200, Christoph Hellwig wrote:
> On Wed, Jun 28, 2017 at 02:42:49PM -0700, Shaohua Li wrote:
> > > bio_integrity_endio -> bio_integrity_verify_fn -> bio_integrity_process
> > > access the integrity data, so I don't think this works as-is.
> > 
> > oh, I probably missed the integrity endio. could we let bio_integrity_verify_fn
> > free integrity info and and bio_endio free cgroup info?
> 
> something like this (will need the cgroup fixes from you still) should
> do the trick, although it's completely untested:
> 
> diff --git a/block/bio-integrity.c b/block/bio-integrity.c
> index b8a3a65f7364..b66eb92b5a00 100644
> --- a/block/bio-integrity.c
> +++ b/block/bio-integrity.c
> @@ -102,7 +102,7 @@ EXPORT_SYMBOL(bio_integrity_alloc);
>   * Description: Used to free the integrity portion of a bio. Usually
>   * called from bio_free().
>   */
> -void bio_integrity_free(struct bio *bio)
> +static void bio_integrity_free(struct bio *bio)
>  {
>  	struct bio_integrity_payload *bip = bio_integrity(bio);
>  	struct bio_set *bs = bio->bi_pool;
> @@ -120,8 +120,8 @@ void bio_integrity_free(struct bio *bio)
>  	}
>  
>  	bio->bi_integrity = NULL;
> +	bio->bi_opf &= ~REQ_INTEGRITY;
>  }
> -EXPORT_SYMBOL(bio_integrity_free);
>  
>  /**
>   * bio_integrity_add_page - Attach integrity metadata
> @@ -340,12 +340,6 @@ int bio_integrity_prep(struct bio *bio)
>  		offset = 0;
>  	}
>  
> -	/* Install custom I/O completion handler if read verify is enabled */
> -	if (bio_data_dir(bio) == READ) {
> -		bip->bip_end_io = bio->bi_end_io;
> -		bio->bi_end_io = bio_integrity_endio;
> -	}
> -
>  	/* Auto-generate integrity metadata if this is a write */
>  	if (bio_data_dir(bio) == WRITE)
>  		bio_integrity_process(bio, bi->profile->generate_fn);
> @@ -370,14 +364,12 @@ static void bio_integrity_verify_fn(struct work_struct *work)
>  	struct blk_integrity *bi = bdev_get_integrity(bio->bi_bdev);
>  
>  	bio->bi_status = bio_integrity_process(bio, bi->profile->verify_fn);
> -
> -	/* Restore original bio completion handler */
> -	bio->bi_end_io = bip->bip_end_io;
> +	bio_integrity_free(bio);
>  	bio_endio(bio);

should we directly call bi_end_io here? Otherwise, looks reasonable to me.

Thanks,
Shaohua

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH V4 00/12] blktrace: output cgroup info Shaohua Li <shli@kernel.org> - 2017-06-28 20:00 +0200
  [PATCH V4 09/12] block: always attach cgroup info into bio Shaohua Li <shli@kernel.org> - 2017-06-28 20:00 +0200
  [PATCH V4 07/12] cgroup: export fhandle info for a cgroup Shaohua Li <shli@kernel.org> - 2017-06-28 20:00 +0200
    Re: [PATCH V4 07/12] cgroup: export fhandle info for a cgroup Tejun Heo <tj@kernel.org> - 2017-06-28 20:20 +0200
  [PATCH V4 06/12] kernfs: add exportfs operations Shaohua Li <shli@kernel.org> - 2017-06-28 20:00 +0200
    Re: [PATCH V4 06/12] kernfs: add exportfs operations Greg KH <gregkh@linuxfoundation.org> - 2017-06-29 15:00 +0200
  Re: [PATCH V4 00/12] blktrace: output cgroup info Jens Axboe <axboe@kernel.dk> - 2017-06-28 20:00 +0200
  [PATCH V4 10/12] block: call __bio_free in bio_endio Shaohua Li <shli@kernel.org> - 2017-06-28 20:00 +0200
    Re: [PATCH V4 10/12] block: call __bio_free in bio_endio Christoph Hellwig <hch@lst.de> - 2017-06-28 23:30 +0200
      Re: [PATCH V4 10/12] block: call __bio_free in bio_endio Shaohua Li <shli@kernel.org> - 2017-06-28 23:50 +0200
        Re: [PATCH V4 10/12] block: call __bio_free in bio_endio Christoph Hellwig <hch@lst.de> - 2017-06-29 19:20 +0200
          Re: [PATCH V4 10/12] block: call __bio_free in bio_endio Shaohua Li <shli@kernel.org> - 2017-06-29 20:40 +0200
            Re: [PATCH V4 10/12] block: call __bio_free in bio_endio Christoph Hellwig <hch@lst.de> - 2017-06-29 22:30 +0200
  [PATCH V4 11/12] blktrace: add an option to allow displying cgroup path Shaohua Li <shli@kernel.org> - 2017-06-28 20:00 +0200
  [PATCH V4 08/12] blktrace: export cgroup info in trace Shaohua Li <shli@kernel.org> - 2017-06-28 20:00 +0200
  [PATCH V4 02/12] kernfs: implement i_generation Shaohua Li <shli@kernel.org> - 2017-06-28 20:00 +0200
    Re: [PATCH V4 02/12] kernfs: implement i_generation Greg KH <gregkh@linuxfoundation.org> - 2017-06-29 15:00 +0200
  [PATCH V4 05/12] kernfs: introduce kernfs_node_id Shaohua Li <shli@kernel.org> - 2017-06-28 20:00 +0200
    Re: [PATCH V4 05/12] kernfs: introduce kernfs_node_id Greg KH <gregkh@linuxfoundation.org> - 2017-06-29 15:00 +0200

csiph-web