[PATCH] md/bitmap: Use 'atomic_inc_return' instead of hand-writing it

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



'atomic_inc/atomic_read' is equivalent to 'atomic_inc_return' which is
less verbose.
So use the later.

Signed-off-by: Christophe JAILLET <christophe.jaillet@xxxxxxxxxx>
---
First time a play with atomic functions, so apologies if I misunderstood
something
---
 drivers/md/md-bitmap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/md/md-bitmap.c b/drivers/md/md-bitmap.c
index e29c6298ef5c..9d47a2ca1cf3 100644
--- a/drivers/md/md-bitmap.c
+++ b/drivers/md/md-bitmap.c
@@ -1396,8 +1396,8 @@ int md_bitmap_startwrite(struct bitmap *bitmap, sector_t offset, unsigned long s
 
 	if (behind) {
 		int bw;
-		atomic_inc(&bitmap->behind_writes);
-		bw = atomic_read(&bitmap->behind_writes);
+
+		bw = atomic_inc_return(&bitmap->behind_writes);
 		if (bw > bitmap->behind_writes_used)
 			bitmap->behind_writes_used = bw;
 
-- 
2.30.2




[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux