@@ -1671,24 +1671,13 @@ __acquires(bitmap->lock)
16711671}
16721672
16731673static int bitmap_startwrite (struct mddev * mddev , sector_t offset ,
1674- unsigned long sectors , bool behind )
1674+ unsigned long sectors )
16751675{
16761676 struct bitmap * bitmap = mddev -> bitmap ;
16771677
16781678 if (!bitmap )
16791679 return 0 ;
16801680
1681- if (behind ) {
1682- int bw ;
1683- atomic_inc (& bitmap -> behind_writes );
1684- bw = atomic_read (& bitmap -> behind_writes );
1685- if (bw > bitmap -> behind_writes_used )
1686- bitmap -> behind_writes_used = bw ;
1687-
1688- pr_debug ("inc write-behind count %d/%lu\n" ,
1689- bw , bitmap -> mddev -> bitmap_info .max_write_behind );
1690- }
1691-
16921681 while (sectors ) {
16931682 sector_t blocks ;
16941683 bitmap_counter_t * bmc ;
@@ -1737,21 +1726,13 @@ static int bitmap_startwrite(struct mddev *mddev, sector_t offset,
17371726}
17381727
17391728static void bitmap_endwrite (struct mddev * mddev , sector_t offset ,
1740- unsigned long sectors , bool success , bool behind )
1729+ unsigned long sectors , bool success )
17411730{
17421731 struct bitmap * bitmap = mddev -> bitmap ;
17431732
17441733 if (!bitmap )
17451734 return ;
17461735
1747- if (behind ) {
1748- if (atomic_dec_and_test (& bitmap -> behind_writes ))
1749- wake_up (& bitmap -> behind_wait );
1750- pr_debug ("dec write-behind count %d/%lu\n" ,
1751- atomic_read (& bitmap -> behind_writes ),
1752- bitmap -> mddev -> bitmap_info .max_write_behind );
1753- }
1754-
17551736 while (sectors ) {
17561737 sector_t blocks ;
17571738 unsigned long flags ;
@@ -2062,6 +2043,37 @@ static void md_bitmap_free(void *data)
20622043 kfree (bitmap );
20632044}
20642045
2046+ static void bitmap_start_behind_write (struct mddev * mddev )
2047+ {
2048+ struct bitmap * bitmap = mddev -> bitmap ;
2049+ int bw ;
2050+
2051+ if (!bitmap )
2052+ return ;
2053+
2054+ atomic_inc (& bitmap -> behind_writes );
2055+ bw = atomic_read (& bitmap -> behind_writes );
2056+ if (bw > bitmap -> behind_writes_used )
2057+ bitmap -> behind_writes_used = bw ;
2058+
2059+ pr_debug ("inc write-behind count %d/%lu\n" ,
2060+ bw , bitmap -> mddev -> bitmap_info .max_write_behind );
2061+ }
2062+
2063+ static void bitmap_end_behind_write (struct mddev * mddev )
2064+ {
2065+ struct bitmap * bitmap = mddev -> bitmap ;
2066+
2067+ if (!bitmap )
2068+ return ;
2069+
2070+ if (atomic_dec_and_test (& bitmap -> behind_writes ))
2071+ wake_up (& bitmap -> behind_wait );
2072+ pr_debug ("dec write-behind count %d/%lu\n" ,
2073+ atomic_read (& bitmap -> behind_writes ),
2074+ bitmap -> mddev -> bitmap_info .max_write_behind );
2075+ }
2076+
20652077static void bitmap_wait_behind_writes (struct mddev * mddev )
20662078{
20672079 struct bitmap * bitmap = mddev -> bitmap ;
@@ -2981,6 +2993,9 @@ static struct bitmap_operations bitmap_ops = {
29812993 .dirty_bits = bitmap_dirty_bits ,
29822994 .unplug = bitmap_unplug ,
29832995 .daemon_work = bitmap_daemon_work ,
2996+
2997+ .start_behind_write = bitmap_start_behind_write ,
2998+ .end_behind_write = bitmap_end_behind_write ,
29842999 .wait_behind_writes = bitmap_wait_behind_writes ,
29853000
29863001 .startwrite = bitmap_startwrite ,
0 commit comments