diff mbox

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

Message ID 20180228011058.23906-1-bo.li.liu@oracle.com (mailing list archive)
State New, archived
Headers show

Commit Message

Liu Bo Feb. 28, 2018, 1:10 a.m. UTC
It doens't make sense to process prealloc extents as pages will be
filled with zero when reading prealloc extents.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
---
 fs/btrfs/scrub.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Filipe Manana March 1, 2018, 12:52 p.m. UTC | #1
On Wed, Feb 28, 2018 at 1:10 AM, Liu Bo <bo.li.liu@oracle.com> wrote:
> It doens't make sense to process prealloc extents as pages will be
> filled with zero when reading prealloc extents.
>
> Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>

Makes sense.

> ---
>  fs/btrfs/scrub.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
> index ec56f33..9882513 100644
> --- a/fs/btrfs/scrub.c
> +++ b/fs/btrfs/scrub.c
> @@ -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 majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Sterba March 1, 2018, 1:38 p.m. UTC | #2
On Thu, Mar 01, 2018 at 12:52:11PM +0000, Filipe Manana wrote:
> On Wed, Feb 28, 2018 at 1:10 AM, Liu Bo <bo.li.liu@oracle.com> wrote:
> > It doens't make sense to process prealloc extents as pages will be
> > filled with zero when reading prealloc extents.
> >
> > Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
> Reviewed-by: Filipe Manana <fdmanana@suse.com>
> 
> Makes sense.

Added to next, thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index ec56f33..9882513 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -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;