All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dm: clear BIO_SEG_VALID in clone_bio
@ 2019-02-14  9:19 yangerkun
  2019-02-14 18:55 ` Mike Snitzer
  0 siblings, 1 reply; 3+ messages in thread
From: yangerkun @ 2019-02-14  9:19 UTC (permalink / raw)
  To: agk, snitzer; +Cc: yangerkun, miaoxie, dm-devel, houtao1

Since 57c36519e4("dm: fix clone_bio() to trigger blk_recount_segments()")
has been reverted by fa8db494("dm: don't use bio_trim() afterall"), the
problem that clone bio won't trigger blk_recount_segments will exits
again. So just clean the flag in clone_bio.

Fixes: fa8db4948f522("dm: don't use bio_trim() afterall")
Signed-off-by: yangerkun <yangerkun@huawei.com>
---
 drivers/md/dm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 515e6af..b22ac04 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -1336,6 +1336,7 @@ static int clone_bio(struct dm_target_io *tio, struct bio *bio,
 			return r;
 	}
 
+	bio_clear_flag(clone, BIO_SEG_VALID);
 	bio_advance(clone, to_bytes(sector - clone->bi_iter.bi_sector));
 	clone->bi_iter.bi_size = to_bytes(len);
 
-- 
2.9.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: dm: clear BIO_SEG_VALID in clone_bio
  2019-02-14  9:19 [PATCH] dm: clear BIO_SEG_VALID in clone_bio yangerkun
@ 2019-02-14 18:55 ` Mike Snitzer
  2019-02-18  3:15   ` yangerkun
  0 siblings, 1 reply; 3+ messages in thread
From: Mike Snitzer @ 2019-02-14 18:55 UTC (permalink / raw)
  To: yangerkun; +Cc: dm-devel, miaoxie, Ming Lei, agk, houtao1

On Thu, Feb 14 2019 at  4:19am -0500,
yangerkun <yangerkun@huawei.com> wrote:

> Since 57c36519e4("dm: fix clone_bio() to trigger blk_recount_segments()")
> has been reverted by fa8db494("dm: don't use bio_trim() afterall"), the
> problem that clone bio won't trigger blk_recount_segments will exits
> again. So just clean the flag in clone_bio.
> 
> Fixes: fa8db4948f522("dm: don't use bio_trim() afterall")
> Signed-off-by: yangerkun <yangerkun@huawei.com>
> ---
>  drivers/md/dm.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/md/dm.c b/drivers/md/dm.c
> index 515e6af..b22ac04 100644
> --- a/drivers/md/dm.c
> +++ b/drivers/md/dm.c
> @@ -1336,6 +1336,7 @@ static int clone_bio(struct dm_target_io *tio, struct bio *bio,
>  			return r;
>  	}
>  
> +	bio_clear_flag(clone, BIO_SEG_VALID);
>  	bio_advance(clone, to_bytes(sector - clone->bi_iter.bi_sector));
>  	clone->bi_iter.bi_size = to_bytes(len);
>  
> -- 
> 2.9.5
> 

Yes, when I wrote commit fa8db4948f522 I purposely did _not_ clear
BIO_SEG_VALID.  Commit 57c36519e4 wasn't born out of an observed need to
blk_recount_segments() (e.g. otherwise something would fail).

So I just reverted to what DM has done in clone_bio() for quite a long
time once using bio_trim() became a liability (since fixed in dm-crypt,
but not staged upstream yet).

Anyway: I'm open to reconsidering, by taking your patch, if there is a
genuine benefit/fix associated with triggering blk_recount_segments()
for clones.  I'm unaware of why it's needed...

Mike

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: dm: clear BIO_SEG_VALID in clone_bio
  2019-02-14 18:55 ` Mike Snitzer
@ 2019-02-18  3:15   ` yangerkun
  0 siblings, 0 replies; 3+ messages in thread
From: yangerkun @ 2019-02-18  3:15 UTC (permalink / raw)
  To: Mike Snitzer; +Cc: dm-devel, miaoxie, Ming Lei, agk, houtao1

Hi,

Mike Snitzer wrote on 2019/2/15 2:55:
> On Thu, Feb 14 2019 at  4:19am -0500,
> yangerkun <yangerkun@huawei.com> wrote:
> 
>> Since 57c36519e4("dm: fix clone_bio() to trigger blk_recount_segments()")
>> has been reverted by fa8db494("dm: don't use bio_trim() afterall"), the
>> problem that clone bio won't trigger blk_recount_segments will exits
>> again. So just clean the flag in clone_bio.
>>
>> Fixes: fa8db4948f522("dm: don't use bio_trim() afterall")
>> Signed-off-by: yangerkun <yangerkun@huawei.com>
>> ---
>>   drivers/md/dm.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/md/dm.c b/drivers/md/dm.c
>> index 515e6af..b22ac04 100644
>> --- a/drivers/md/dm.c
>> +++ b/drivers/md/dm.c
>> @@ -1336,6 +1336,7 @@ static int clone_bio(struct dm_target_io *tio, struct bio *bio,
>>   			return r;
>>   	}
>>   
>> +	bio_clear_flag(clone, BIO_SEG_VALID);
>>   	bio_advance(clone, to_bytes(sector - clone->bi_iter.bi_sector));
>>   	clone->bi_iter.bi_size = to_bytes(len);
>>   
>> -- 
>> 2.9.5
>>
> 
> Yes, when I wrote commit fa8db4948f522 I purposely did _not_ clear
> BIO_SEG_VALID.  Commit 57c36519e4 wasn't born out of an observed need to
> blk_recount_segments() (e.g. otherwise something would fail).
> 
> So I just reverted to what DM has done in clone_bio() for quite a long
> time once using bio_trim() became a liability (since fixed in dm-crypt,
> but not staged upstream yet).
> 
> Anyway: I'm open to reconsidering, by taking your patch, if there is a
> genuine benefit/fix associated with triggering blk_recount_segments()
> for clones.  I'm unaware of why it's needed...

Re-read the code, clone_bio won't copy flags from source bio, so the 
flag bio_clear_flag of clone won't set anyway. So no need for this 
patch, Right?

Thanks,
Kun.
> 
> Mike
> 
> .
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-02-18  3:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-14  9:19 [PATCH] dm: clear BIO_SEG_VALID in clone_bio yangerkun
2019-02-14 18:55 ` Mike Snitzer
2019-02-18  3:15   ` yangerkun

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.