Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1413275 > unrolled thread
| Started by | Jens Axboe <axboe@kernel.dk> |
|---|---|
| First post | 2016-06-03 16:40 +0200 |
| Last post | 2016-06-06 07:10 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [RFC v2 1/3] block: Introduce blk_bio_map_sg() to map one bio Jens Axboe <axboe@kernel.dk> - 2016-06-03 16:40 +0200
Re: [RFC v2 1/3] block: Introduce blk_bio_map_sg() to map one bio Baolin Wang <baolin.wang@linaro.org> - 2016-06-06 07:10 +0200
| From | Jens Axboe <axboe@kernel.dk> |
|---|---|
| Date | 2016-06-03 16:40 +0200 |
| Subject | Re: [RFC v2 1/3] block: Introduce blk_bio_map_sg() to map one bio |
| Message-ID | <rFYqu-4lp-19@gated-at.bofh.it> |
On 05/27/2016 05:11 AM, Baolin Wang wrote:
> +/*
> + * Map a bio to scatterlist, return number of sg entries setup. Caller must
> + * make sure sg can hold bio segments entries.
> + */
> +int blk_bio_map_sg(struct request_queue *q, struct bio *bio,
> + struct scatterlist *sglist)
> +{
> + struct scatterlist *sg = NULL;
> + int nsegs = 0;
> +
> + if (bio)
> + nsegs = __blk_bios_map_sg(q, bio, sglist, &sg, true);
> +
> + if (sg)
> + sg_mark_end(sg);
Put that if (sg) inside the if (bio) section, 'sg' isn't going to be
non-NULL outside of that.
Additionally, who would call this with a NULL bio? That seems odd, I'd
get rid of that check completely.
--
Jens Axboe
[toc] | [next] | [standalone]
| From | Baolin Wang <baolin.wang@linaro.org> |
|---|---|
| Date | 2016-06-06 07:10 +0200 |
| Message-ID | <rGUXv-u6-1@gated-at.bofh.it> |
| In reply to | #1413275 |
On 3 June 2016 at 22:38, Jens Axboe <axboe@kernel.dk> wrote:
> On 05/27/2016 05:11 AM, Baolin Wang wrote:
>>
>> +/*
>> + * Map a bio to scatterlist, return number of sg entries setup. Caller
>> must
>> + * make sure sg can hold bio segments entries.
>> + */
>> +int blk_bio_map_sg(struct request_queue *q, struct bio *bio,
>> + struct scatterlist *sglist)
>> +{
>> + struct scatterlist *sg = NULL;
>> + int nsegs = 0;
>> +
>> + if (bio)
>> + nsegs = __blk_bios_map_sg(q, bio, sglist, &sg, true);
>> +
>> + if (sg)
>> + sg_mark_end(sg);
>
>
> Put that if (sg) inside the if (bio) section, 'sg' isn't going to be
> non-NULL outside of that.
>
> Additionally, who would call this with a NULL bio? That seems odd, I'd
> get rid of that check completely.
OK. I'll fix these in next version. Thanks for your comments.
--
Baolin.wang
Best Regards
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web