lkml.org 
[lkml]   [2015]   [Nov]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC] block: change to use atomic_inc_return_release()
From
Date
On 11/16/2015 08:24 PM, yalin wang wrote:
> Some arch define this atomic_inc_return_release() OP.

That is a very vague commit message, you'll need a whole lot more than
that... A commit message is supposed to describe the reason for the
change. You provide no reason for the change.

> diff --git a/block/bio.c b/block/bio.c
> index fbc558b..b251857 100644
> --- a/block/bio.c
> +++ b/block/bio.c
> @@ -310,8 +310,7 @@ static void bio_chain_endio(struct bio *bio, int error)
> static inline void bio_inc_remaining(struct bio *bio)
> {
> bio->bi_flags |= (1 << BIO_CHAIN);
> - smp_mb__before_atomic();
> - atomic_inc(&bio->__bi_remaining);
> + atomic_inc_return_release(&bio->__bi_remaining);

Are these equivalent? Where's the documentation for this primitive? The
previous code ensured that we ordered the dec of the remaining count
with the update of the flags.

--
Jens Axboe



\
 
 \ /
  Last update: 2015-11-17 04:41    [W:0.055 / U:0.608 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site