btrfs: make page Ordered bit to be subpage compatible

This involves the following modification:

- Ordered extent creation
  This is done in process_one_page(), now PAGE_SET_ORDERED will call
  subpage helper to do the work.

- endio functions
  This is done in btrfs_mark_ordered_io_finished().

- btrfs_invalidatepage()

- btrfs_cleanup_ordered_extents()
  Use the subpage page helper, and add an extra branch to exit if the
  locked page have covered the full range.

Now the usage of page Ordered flag for ordered extent accounting is fully
subpage compatible.

Tested-by: Ritesh Harjani <riteshh@linux.ibm.com> # [ppc64]
Tested-by: Anand Jain <anand.jain@oracle.com> # [aarch64]
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Qu Wenruo
2021-05-31 16:50:46 +08:00
committed by David Sterba
parent 6f17400bd9
commit b945a4637e
3 changed files with 18 additions and 8 deletions

View File

@@ -16,6 +16,7 @@
#include "compression.h"
#include "delalloc-space.h"
#include "qgroup.h"
#include "subpage.h"
static struct kmem_cache *btrfs_ordered_extent_cache;
@@ -395,11 +396,11 @@ void btrfs_mark_ordered_io_finished(struct btrfs_inode *inode,
*
* If there's no such bit, we need to skip to next range.
*/
if (!PageOrdered(page)) {
if (!btrfs_page_test_ordered(fs_info, page, cur, len)) {
cur += len;
continue;
}
ClearPageOrdered(page);
btrfs_page_clear_ordered(fs_info, page, cur, len);
}
/* Now we're fine to update the accounting */