Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1617893
| From | Christoph Hellwig <hch@infradead.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 5/9] bio-integrity: fold bio_integrity_enabled to bio_integrity_prep |
| Date | 2017-04-06 13:50 +0200 |
| Message-ID | <tte5k-7Y4-9@gated-at.bofh.it> (permalink) |
| References | <tsBQl-hL-3@gated-at.bofh.it> <tsBQm-hL-25@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
> --- a/Documentation/block/data-integrity.txt
> +++ b/Documentation/block/data-integrity.txt
> @@ -202,9 +202,6 @@ will require extra work due to the application tag.
> added. It is up to the caller to ensure that the bio does not
> change while I/O is in progress.
>
> - bio_integrity_prep() should only be called if
> - bio_integrity_enabled() returned 1.
> -
This should grow a blurb that bio_integrity_prep will complete the bio
if an error occurs.
> /**
> - * bio_integrity_prep - Prepare bio for integrity I/O
> + * bio_integrity_setup - Prepare bio for integrity I/O
> * @bio: bio to prepare
> *
> * Description: Allocates a buffer for integrity metadata, maps the
> @@ -269,7 +231,7 @@ static int bio_integrity_process(struct bio *bio,
> * block device's integrity function. In the READ case, the buffer
> * will be prepared for DMA and a suitable end_io handler set up.
> */
> -int bio_integrity_prep(struct bio *bio)
> +static int bio_integrity_setup(struct bio *bio)
Instead of renaming the function I'd suggest simply merging the two,
the end result will be smaller and more readable.
> + if (bio_data_dir(bio) == READ && bi->profile->verify_fn != NULL &&
> + (bi->flags & BLK_INTEGRITY_VERIFY))
> + goto need_prep;
> +
> + if (bio_data_dir(bio) == WRITE && bi->profile->generate_fn != NULL &&
> + (bi->flags & BLK_INTEGRITY_GENERATE))
> + goto need_prep;
I'd invert the conditions to avoid the goto:
if (bio_data_dir(bio) == READ) {
if (!bi->profile->verify_fn ||
!(bi->flags & BLK_INTEGRITY_VERIFY))
return 0;
} else {
if (!bi->profile->generate_fn ||
!(bi->flags & BLK_INTEGRITY_GENERATE))
return 0;
}
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/9] block: T10/DIF Fixes and cleanups v3 Dmitry Monakhov <dmonakhov@openvz.org> - 2017-04-04 21:00 +0200
[PATCH 4/9] bio-integrity: fix interface for bio_integrity_trim v2 Dmitry Monakhov <dmonakhov@openvz.org> - 2017-04-04 21:00 +0200
Re: [PATCH 4/9] bio-integrity: fix interface for bio_integrity_trim v2 Hannes Reinecke <hare@suse.de> - 2017-04-05 08:40 +0200
Re: [PATCH 4/9] bio-integrity: fix interface for bio_integrity_trim v2 Christoph Hellwig <hch@infradead.org> - 2017-04-06 13:40 +0200
[PATCH 8/9] bio: add bvec_iter rewind API Dmitry Monakhov <dmonakhov@openvz.org> - 2017-04-04 21:00 +0200
Re: [PATCH 8/9] bio: add bvec_iter rewind API Christoph Hellwig <hch@infradead.org> - 2017-04-06 13:50 +0200
[PATCH 2/9] bio-integrity: bio_trim should truncate integrity vector accordingly Dmitry Monakhov <dmonakhov@openvz.org> - 2017-04-04 21:00 +0200
Re: [PATCH 2/9] bio-integrity: bio_trim should truncate integrity vector accordingly Hannes Reinecke <hare@suse.de> - 2017-04-05 08:40 +0200
[PATCH 6/9] T10: Move opencoded contants to common header Dmitry Monakhov <dmonakhov@openvz.org> - 2017-04-04 21:00 +0200
Re: [PATCH 6/9] T10: Move opencoded contants to common header Hannes Reinecke <hare@suse.de> - 2017-04-05 08:40 +0200
Re: [PATCH 6/9] T10: Move opencoded contants to common header Christoph Hellwig <hch@infradead.org> - 2017-04-06 13:50 +0200
[PATCH 1/9] bio-integrity: Do not allocate integrity context for bio w/o data Dmitry Monakhov <dmonakhov@openvz.org> - 2017-04-04 21:00 +0200
[PATCH 5/9] bio-integrity: fold bio_integrity_enabled to bio_integrity_prep Dmitry Monakhov <dmonakhov@openvz.org> - 2017-04-04 21:00 +0200
Re: [PATCH 5/9] bio-integrity: fold bio_integrity_enabled to bio_integrity_prep Hannes Reinecke <hare@suse.de> - 2017-04-05 08:40 +0200
Re: [PATCH 5/9] bio-integrity: fold bio_integrity_enabled to bio_integrity_prep Christoph Hellwig <hch@infradead.org> - 2017-04-06 13:50 +0200
[PATCH 9/9] bio-integrity: Restore original iterator on verify stage Dmitry Monakhov <dmonakhov@openvz.org> - 2017-04-04 21:00 +0200
Re: [PATCH 9/9] bio-integrity: Restore original iterator on verify stage Christoph Hellwig <hch@infradead.org> - 2017-04-06 13:50 +0200
[PATCH 3/9] bio-integrity: bio_integrity_advance must update integrity seed Dmitry Monakhov <dmonakhov@openvz.org> - 2017-04-04 21:00 +0200
Re: [PATCH 3/9] bio-integrity: bio_integrity_advance must update integrity seed Hannes Reinecke <hare@suse.de> - 2017-04-05 08:40 +0200
Re: [PATCH 3/9] bio-integrity: bio_integrity_advance must update integrity seed Christoph Hellwig <hch@infradead.org> - 2017-04-06 13:40 +0200
csiph-web