Commit 63447b7
btrfs: scrub: update last_physical after scrubbing one stripe
Currently sctx->stat.last_physical only got updated in the following
cases:
- When the last stripe of a non-RAID56 chunk is scrubbed
This implies a pitfall, if the last stripe is at the chunk boundary,
and we finished the scrub of the whole chunk, we won't update
last_physical at all until the next chunk.
- When a P/Q stripe of a RAID56 chunk is scrubbed
This leads the following two problems:
- sctx->stat.last_physical is not updated for a almost full chunk
This is especially bad, affecting scrub resume, as the resume would
start from last_physical, causing unnecessary re-scrub.
- "btrfs scrub status" will not report any progress for a long time
Fix the problem by properly updating @last_physical after each stripe is
scrubbed.
And since we're here, for the sake of consistency, use spin lock to
protect the update of @last_physical, just like all the remaining
call sites touching sctx->stat.
Reported-by: Michel Palleau <[email protected]>
Link: https://lore.kernel.org/linux-btrfs/CAMFk-+igFTv2E8svg=cQ6o3e6CrR5QwgQ3Ok9EyRaEvvthpqCQ@mail.gmail.com/
Reviewed-by: Johannes Thumshirn <[email protected]>
Signed-off-by: Qu Wenruo <[email protected]>
Reviewed-by: David Sterba <[email protected]>
Signed-off-by: David Sterba <[email protected]>1 parent 33eb1e5 commit 63447b7
1 file changed
+9
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1875 | 1875 | | |
1876 | 1876 | | |
1877 | 1877 | | |
| 1878 | + | |
| 1879 | + | |
| 1880 | + | |
1878 | 1881 | | |
1879 | 1882 | | |
1880 | 1883 | | |
| |||
2143 | 2146 | | |
2144 | 2147 | | |
2145 | 2148 | | |
| 2149 | + | |
2146 | 2150 | | |
| 2151 | + | |
2147 | 2152 | | |
2148 | 2153 | | |
2149 | 2154 | | |
| |||
2340 | 2345 | | |
2341 | 2346 | | |
2342 | 2347 | | |
| 2348 | + | |
| 2349 | + | |
| 2350 | + | |
| 2351 | + | |
2343 | 2352 | | |
2344 | 2353 | | |
2345 | 2354 | | |
| |||
0 commit comments