Skip to contentSkip to conversation

Btrfs: dev-replace: skip prealloc extents when copy nocow pages

PATCH In review Liu Bo 3 participants 3 messages Feb 28, 2018 – Mar 1, 2018 Btrfs file system

lore
Share & tools
lore

Liu Bo

author
#0 lore raw

PATCH 1/1 Btrfs: dev-replace: skip prealloc extents when copy nocow pages

It doens't make sense to process prealloc extents as pages will be filled with zero when reading prealloc extents.

---
 fs/btrfs/scrub.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/btrfs/scrub.c +2 -1
index ec56f33..9882513 100644
@@ -4480,7 +4480,8 @@ static int check_extent_to_block(struct btrfs_inode *inode, u64 start, u64 len,
 	 * move on to the next inode.
 	 */
 	if (em->block_start > logical ||
-	    em->block_start + em->block_len < logical + len) {
+	    em->block_start + em->block_len < logical + len ||
+	    test_bit(EXTENT_FLAG_PREALLOC, &em->flags)) {
 		free_extent_map(em);
 		ret = 1;
 		goto out_unlock;
Signature · 1 line
2.9.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Liu Bo

It doens't make sense to process prealloc extents as pages will be filled with zero when reading prealloc extents.

Makes sense.

Quoted 25 lines
---
 fs/btrfs/scrub.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/btrfs/scrub.c +2 -2
index ec56f33..9882513 100644
@@ -4480,7 +4480,8 @@ static int check_extent_to_block(struct btrfs_inode *inode, u64 start, u64 len,
         * move on to the next inode.
         */
        if (em->block_start > logical ||
-           em->block_start + em->block_len < logical + len) {
+           em->block_start + em->block_len < logical + len ||
+           test_bit(EXTENT_FLAG_PREALLOC, &em->flags)) {
                free_extent_map(em);
                ret = 1;
                goto out_unlock;
--

2.9.4

--
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

Signature · 3 lines
Filipe David Manana,

“Whether you think you can, or you think you can't — you're right.”