On Thu, Mar 25, 2021 at 03:14:37PM +0800, Qu Wenruo wrote:
> --- a/fs/btrfs/subpage.h
> +++ b/fs/btrfs/subpage.h
> @@ -20,6 +20,7 @@ struct btrfs_subpage {
> spinlock_t lock;
> u16 uptodate_bitmap;
> u16 error_bitmap;
> + u16 dirty_bitmap;
> union {
> /*
> * Structures only used by metadata
> @@ -87,5 +88,19 @@ bool btrfs_page_test_##name(const struct btrfs_fs_info
> *fs_info, \
>
> DECLARE_BTRFS_SUBPAGE_OPS(uptodate);
> DECLARE_BTRFS_SUBPAGE_OPS(error);
> +DECLARE_BTRFS_SUBPAGE_OPS(dirty);
> +
> +/*
> + * Extra clear_and_test function for subpage dirty bitmap.
> + *
> + * Return true if we're the last bits in the dirty_bitmap and clear the
> + * dirty_bitmap.
> + * Return false otherwise.
> + *
> + * NOTE: Callers should manually clear page dirty for true case, as we have
> + * extra handling for tree blocks.
> + */
I've moved the function comment to subpage.c
> +bool btrfs_subpage_clear_and_test_dirty(const struct btrfs_fs_info *fs_info,
> + struct page *page, u64 start, u32 len);
>
> #endif
> --
> 2.30.1