aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLiu Bo <[email protected]>2016-12-13 12:15:19 -0800
committerDavid Sterba <[email protected]>2017-02-14 15:50:58 +0100
commit5416034f7acf9ead993198dcfb1df7e0b0b8436a (patch)
treec7470b0cf3a82edbd540821125c5f6d5e7524e8e
parent19fd2df5b1167eeb6ae8912cdfe9532e3b2c8bbe (diff)
Btrfs: fix comment in btrfs_page_mkwrite
The comment about "page_mkwrite gets called every time the page is dirtied" in btrfs_page_mkwrite is not correct, it only gets called the first time the page gets dirtied after the page faults in. However, we don't need to touch the code because it works well, although the proper logic is to check if delalloc bits has been set and if so, go free reserved space, if not, set the delalloc bits for dirty page range. Signed-off-by: Liu Bo <[email protected]> Signed-off-by: David Sterba <[email protected]>
-rw-r--r--fs/btrfs/inode.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 3944346265e8..29ad99a2e287 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -9060,11 +9060,11 @@ again:
}
/*
- * XXX - page_mkwrite gets called every time the page is dirtied, even
- * if it was already dirty, so for space accounting reasons we need to
- * clear any delalloc bits for the range we are fixing to save. There
- * is probably a better way to do this, but for now keep consistent with
- * prepare_pages in the normal write path.
+ * page_mkwrite gets called when the page is firstly dirtied after it's
+ * faulted in, but write(2) could also dirty a page and set delalloc
+ * bits, thus in this case for space account reason, we still need to
+ * clear any delalloc bits within this page range since we have to
+ * reserve data&meta space before lock_page() (see above comments).
*/
clear_extent_bit(&BTRFS_I(inode)->io_tree, page_start, end,
EXTENT_DIRTY | EXTENT_DELALLOC |