diff mbox

[6/7] btrfs: subpagesize-blocksize: Handle relocation clusters appropriately

Message ID 1386805122-23972-7-git-send-email-sekharan@us.ibm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Chandra Seetharaman Dec. 11, 2013, 11:38 p.m. UTC
For relocation clusters boundaries are at blocks, hence in the case
of subpagesize-blocksize, we need to make sure the data in the page
is handled correctly with the cluster boundary.

This patch does that.

Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com>
---
 fs/btrfs/relocation.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index ce459a7..fb5752a 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -3149,11 +3149,13 @@  static int relocate_file_extent_cluster(struct inode *inode,
 		set_page_extent_mapped(page);
 
 		if (nr < cluster->nr &&
-		    page_start + offset == cluster->boundary[nr]) {
+		    page_start + offset <= cluster->boundary[nr] &&
+		    page_end + offset >= cluster->boundary[nr]) {
 			set_extent_bits(&BTRFS_I(inode)->io_tree,
 					page_start, page_end,
 					EXTENT_BOUNDARY, GFP_NOFS);
-			nr++;
+			while (page_end + offset < cluster->boundary[nr])
+				nr++;
 		}
 
 		btrfs_set_extent_delalloc(inode, page_start, page_end, NULL);