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 <bo.li.liu@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Liu Bo 2016-12-13 12:15:19 -08:00 committed by David Sterba
parent 19fd2df5b1
commit 5416034f7a

View file

@ -9060,11 +9060,11 @@ int btrfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
} }
/* /*
* XXX - page_mkwrite gets called every time the page is dirtied, even * page_mkwrite gets called when the page is firstly dirtied after it's
* if it was already dirty, so for space accounting reasons we need to * faulted in, but write(2) could also dirty a page and set delalloc
* clear any delalloc bits for the range we are fixing to save. There * bits, thus in this case for space account reason, we still need to
* is probably a better way to do this, but for now keep consistent with * clear any delalloc bits within this page range since we have to
* prepare_pages in the normal write path. * reserve data&meta space before lock_page() (see above comments).
*/ */
clear_extent_bit(&BTRFS_I(inode)->io_tree, page_start, end, clear_extent_bit(&BTRFS_I(inode)->io_tree, page_start, end,
EXTENT_DIRTY | EXTENT_DELALLOC | EXTENT_DIRTY | EXTENT_DELALLOC |