Commit 53474a2
btrfs: raid56: prepare steal_rbio() to support bs > ps cases
The function steal_rbio() assume each fs block can be mapped by
one page, blocking bs > ps support for raid56.
Prepare it for bs > ps cases by:
- Introduce two helpers to calculate the sector number
Previously we assume one page will contain at least one fs block, thus
can use something like "sectors_per_page = PAGE_SIZE / sectorsize;",
but with bs > ps support that above number will be 0.
Instead introduce two helpers:
* page_nr_to_sector_nr()
Returns the sector number of the first sector covered by the page.
* page_nr_to_num_sectors()
Return how many sectors are covered by the page.
And use the returned values for bitmap operations other than
open-coded "PAGE_SIZE / sectorsize".
Those helpers also have extra ASSERT()s to catch weird numbers.
- Use above helpers
The involved functions are:
* steal_rbio_page()
* is_data_stripe_page()
* full_page_sectors_uptodate()
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>1 parent 05ddf35 commit 53474a2
1 file changed
Lines changed: 41 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
300 | 300 | | |
301 | 301 | | |
302 | 302 | | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
303 | 333 | | |
304 | 334 | | |
305 | 335 | | |
306 | | - | |
307 | | - | |
| 336 | + | |
| 337 | + | |
308 | 338 | | |
309 | 339 | | |
310 | 340 | | |
| 341 | + | |
311 | 342 | | |
312 | | - | |
313 | | - | |
314 | | - | |
| 343 | + | |
315 | 344 | | |
316 | 345 | | |
317 | 346 | | |
| |||
345 | 374 | | |
346 | 375 | | |
347 | 376 | | |
348 | | - | |
349 | | - | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
350 | 382 | | |
351 | 383 | | |
352 | 384 | | |
353 | 385 | | |
354 | 386 | | |
355 | 387 | | |
356 | 388 | | |
357 | | - | |
| 389 | + | |
358 | 390 | | |
359 | 391 | | |
360 | 392 | | |
361 | 393 | | |
362 | | - | |
363 | | - | |
| 394 | + | |
364 | 395 | | |
365 | 396 | | |
366 | 397 | | |
| |||
0 commit comments