#include "block-group.h"
#include "space-info.h"
#include "zoned.h"
+#include "subpage.h"
struct btrfs_iget_args {
u64 ino;
* range, then __endio_write_update_ordered() will handle
* the ordered extent accounting for the range.
*/
- ClearPageOrdered(page);
+ btrfs_page_clamp_clear_ordered(inode->root->fs_info, page,
+ offset, bytes);
put_page(page);
}
+ /* The locked page covers the full range, nothing needs to be done */
+ if (bytes + offset <= page_offset(locked_page) + PAGE_SIZE)
+ return;
/*
* In case this page belongs to the delalloc range being instantiated
* then skip it, since the first page of a range is going to be
* properly cleaned up by the caller of run_delalloc_range
*/
if (page_start >= offset && page_end <= (offset + bytes - 1)) {
- offset += PAGE_SIZE;
- bytes -= PAGE_SIZE;
+ bytes = offset + bytes - page_offset(locked_page) - PAGE_SIZE;
+ offset = page_offset(locked_page) + PAGE_SIZE;
}
return __endio_write_update_ordered(inode, offset, bytes, false);
unsigned int length)
{
struct btrfs_inode *inode = BTRFS_I(page->mapping->host);
+ struct btrfs_fs_info *fs_info = inode->root->fs_info;
struct extent_io_tree *tree = &inode->io_tree;
struct extent_state *cached_state = NULL;
u64 page_start = page_offset(page);
struct btrfs_ordered_extent *ordered;
bool delete_states;
u64 range_end;
+ u32 range_len;
ordered = btrfs_lookup_first_ordered_range(inode, cur,
page_end + 1 - cur);
range_end = min(ordered->file_offset + ordered->num_bytes - 1,
page_end);
- if (!PageOrdered(page)) {
+ ASSERT(range_end + 1 - cur < U32_MAX);
+ range_len = range_end + 1 - cur;
+ if (!btrfs_page_test_ordered(fs_info, page, cur, range_len)) {
/*
* If Ordered (Private2) is cleared, it means endio has
* already been executed for the range.
delete_states = false;
goto next;
}
- ClearPageOrdered(page);
+ btrfs_page_clear_ordered(fs_info, page, cur, range_len);
/*
* IO on this page will never be started, so we need to account
#include "compression.h"
#include "delalloc-space.h"
#include "qgroup.h"
+#include "subpage.h"
static struct kmem_cache *btrfs_ordered_extent_cache;
*
* 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 */