Btrfs: handle unaligned tail of data ranges more efficient
RFC PATCH 1/1 Btrfs: handle unaligned tail of data ranges more efficient
At now while switch page bits in data ranges we always hande +1 page, for cover case where end of data range is not page aligned
Let's handle that case more obvious and efficient Check end aligment directly and touch +1 page only then needed
--- fs/btrfs/extent_io.c | 12 ++++++++++-- fs/btrfs/inode.c | 6 +++++- 2 files changed, 15 insertions(+), 3 deletions(-)
fs/btrfs/extent_io.c +10 -2
@@ -1360,7 +1360,11 @@ void extent_range_clear_dirty_for_io(struct inode *inode, u64 start, u64 end)unsigned long end_index = end >>PAGE_SHIFT ;struct page *page; -while (index <= end_index) { +/* Don't miss unaligned end */ +if (end%PAGE_SIZE >0 ) + end_index++; + +while (index < end_index) { page =find_get_page (inode->i_mapping, index);BUG_ON (!page);/* Pages should be in the extent_io_tree */ clear_page_dirty_for_io (page);
@@ -1375,7 +1379,11 @@ void extent_range_redirty_for_io(struct inode *inode, u64 start, u64 end)unsigned long end_index = end >>PAGE_SHIFT ;struct page *page; -while (index <= end_index) { +/* Don't miss unaligned end */ +if (end%PAGE_SIZE >0 ) + end_index++; + +while (index < end_index) { page =find_get_page (inode->i_mapping, index);BUG_ON (!page);/* Pages should be in the extent_io_tree */ __set_page_dirty_nobuffers (page);
fs/btrfs/inode.c +5 -1
@@ -10745,7 +10745,11 @@ void btrfs_set_range_writeback(void *private_data, u64 start, u64 end)unsigned long end_index = end >>PAGE_SHIFT ;struct page *page; -while (index <= end_index) { +/* Don't miss unaligned end */ +if (end%PAGE_SIZE >0 ) + end_index++; + +while (index < end_index) { page =find_get_page (inode->i_mapping, index);ASSERT (page);/* Pages should be in the extent_io_tree */ set_page_writeback (page);
--
2.14.1
Quoted 19 lines · Timofey Titovets
At now while switch page bits in data ranges
we always hande +1 page, for cover case
where end of data range is not page alignedLet's handle that case more obvious and efficient
Check end aligment directly and touch +1 page
only then neededSigned-off-by Timofey Titovets <[email protected]>--- fs/btrfs/extent_io.c | 12 ++++++++++-- fs/btrfs/inode.c | 6 +++++- 2 files changed, 15 insertions(+), 3 deletions(-)fs/btrfs/extent_io.c +0
-0
fs/btrfs/extent_io.c void extent_range_clear_dirty_for_io(struct inode *inode, u64 start, u64 end) · line 1365
Quoted 7 lines
fs/btrfs/extent_io.c +3
-1@@ -1360,7 +1360,11 @@ void extent_range_clear_dirty_for_io(struct inode *inode, u64 start, u64 end)unsigned long end_index = end >>PAGE_SHIFT ;struct page *page; -while (index <= end_index) { +/* Don't miss unaligned end */ +if (end%PAGE_SIZE >0 ) + end_index++;
if (!IS_ALIGNED(end, PAGE_SIZE)).
fs/btrfs/extent_io.c void extent_range_redirty_for_io(struct inode *inode, u64 start, u64 end) · line 1384
Quoted 13 lines
fs/btrfs/extent_io.c +5
-1+ +while (index < end_index) { page =find_get_page (inode->i_mapping, index);BUG_ON (!page);/* Pages should be in the extent_io_tree */ clear_page_dirty_for_io (page);@@ -1375,7 +1379,11 @@ void extent_range_redirty_for_io(struct inode *inode, u64 start, u64 end)unsigned long end_index = end >>PAGE_SHIFT ;struct page *page; -while (index <= end_index) { +/* Don't miss unaligned end */ +if (end%PAGE_SIZE >0 ) + end_index++;
ditto
Quoted 10 lines
fs/btrfs/extent_io.c +2
-0+ +while (index < end_index) { page =find_get_page (inode->i_mapping, index);BUG_ON (!page);/* Pages should be in the extent_io_tree */ __set_page_dirty_nobuffers (page);fs/btrfs/inode.c +0
-0
fs/btrfs/inode.c void btrfs_set_range_writeback(void *private_data, u64 start, u64 end) · line 10750
Quoted 7 lines
fs/btrfs/inode.c +3
-1@@ -10745,7 +10745,11 @@ void btrfs_set_range_writeback(void *private_data, u64 start, u64 end)unsigned long end_index = end >>PAGE_SHIFT ;struct page *page; -while (index <= end_index) { +/* Don't miss unaligned end */ +if (end%PAGE_SIZE >0 ) + end_index++;
Ditto
Quoted 12 lines
fs/btrfs/inode.c +2
-1+ +while (index < end_index) { page =find_get_page (inode->i_mapping, index);ASSERT (page);/* Pages should be in the extent_io_tree */ set_page_writeback (page); --2.14.1
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html