Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2947979lqz; Wed, 3 Apr 2024 13:17:29 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUyHkUWt8K8HLIwaZ03E2m5R5w4Qiiau8mq2gmSBgbXJwCWq15ugamA4AyrbqeKrfHXpdZWOO+C10hMm8w7hx+jm1e1JJcWx0CY0VSvFw== X-Google-Smtp-Source: AGHT+IE9QXc+WAjYZOZDLn9GwvJy6m7J4BMTcw+o6o3SA7l868Na/AOANz07lYd9v1L5Mnjwy2XP X-Received: by 2002:a17:902:c947:b0:1e0:a784:f965 with SMTP id i7-20020a170902c94700b001e0a784f965mr254555pla.65.1712175449592; Wed, 03 Apr 2024 13:17:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712175449; cv=pass; d=google.com; s=arc-20160816; b=keiHximplHHzdkD/G/9PVd1PXmS706LnmVTs3R6R9+34eW8ggGahaaKUgBE0f/3MxQ OSPVODLhpju63ugGD0YOgdy5UtjJ8Z6kVDpheB1ouBNDvRE7O8mxTKwa9lEneaahwiV8 CdLt9k+LBjLzOISMBildWNwcfOk/9vS4/spbeEFgJjzUZISPhQV6qm2iJb0r81rg06wD O5bi4i38f5craSIt6bZeXIFGaQ+Oumla6BZLdeKux06odY6c9o5TMuLIw6Uhbvn1rQmN xx5/B32CfBdDh/IKnjTbT62FymJTSxNmElFbNKmNY7+nWSI0sYXCCavwvlbdXvnB+IWG OZXA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:to:from:dkim-signature; bh=DbnwEYctC+JK8P/EWPZTBgKnomIWJC9/OakieGz83Y4=; fh=5xpXEVHA7ULft/JHqM87S8vqz30WiVdsBWxEbwY87G4=; b=zESL8s0OODJyFpBALV2iSaaw0ADTtHTEGmiQ+SE7X3xLakzPuRKn15wi9gJeFoGTfx xcvEkiveXLbZ2Q7FT8SSWlZns7Fpd7NrlvRWgz1o9crWHR2xgk6JS3aGw4UiSgyrVMaK o19zY/5Q9kNbAW4LjhkbG+i0w8EsPXafOJYklSny2BzheOYGyiIqD0TCGAhNIW7lm6M4 5mZnI22RlvoJydmIlRInvdP4uoDaZ2tk6Mzx6rqCpgbd72jdf7I7ZO1olPrYIY4y0LtP 31WCQ5neXTbdHrPgkh1IRIkX+9djt2SsTecv6sH4x3NoFqrkpNwvCPjoCVB1CH5dVgNV 0cLQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@dorminy.me header.s=mail header.b=XAboOI1g; arc=pass (i=1 spf=pass spfdomain=dorminy.me dkim=pass dkdomain=dorminy.me dmarc=pass fromdomain=dorminy.me); spf=pass (google.com: domain of linux-kernel+bounces-129181-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-129181-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=dorminy.me Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id c12-20020a170903234c00b001e2624072dfsi4366564plh.616.2024.04.03.13.17.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 13:17:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-129181-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@dorminy.me header.s=mail header.b=XAboOI1g; arc=pass (i=1 spf=pass spfdomain=dorminy.me dkim=pass dkdomain=dorminy.me dmarc=pass fromdomain=dorminy.me); spf=pass (google.com: domain of linux-kernel+bounces-129181-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-129181-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=dorminy.me Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id EA28CB24F9C for ; Wed, 3 Apr 2024 07:37:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E266883CA4; Wed, 3 Apr 2024 07:33:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=dorminy.me header.i=@dorminy.me header.b="XAboOI1g" Received: from box.fidei.email (box.fidei.email [71.19.144.250]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A1D24839E1; Wed, 3 Apr 2024 07:33:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=71.19.144.250 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712129622; cv=none; b=tJycywj2ewbGgualgewBQoz8qcJwQNA6JM7QyGQH/ih0dWrFeSj4WlrphZvN7uoPJBVvT4lytlBCiiW9/vEj3ACQcGUkTZxAXtpANxSoZnANMsirkXp2DG0CmsbiSnIERuJAkyMK8tIS2p+qD6gKwc4mBTTK7catlvmOAUorVxk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712129622; c=relaxed/simple; bh=SgpqdEQktNmIE/si/SsUXivp3OLO9RykBmr/owEiMwk=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hw9tBf6Kc3CCsShXEAa/jfToCXroZTFCJ1rASlmsGY3nMeRsKugIzbdCSS5BaG9O+oVS17ZY4SmOzHphZcRZZWZCPObqIhl/qFBKYmnHDV0qvwtWHRFvVV5m2Qvo1qShm/znzWqQQZAckHiUnjvacyIBnzaOb3V2G2PKkIA0wLY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=dorminy.me; spf=pass smtp.mailfrom=dorminy.me; dkim=pass (2048-bit key) header.d=dorminy.me header.i=@dorminy.me header.b=XAboOI1g; arc=none smtp.client-ip=71.19.144.250 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=dorminy.me Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=dorminy.me Received: from authenticated-user (box.fidei.email [71.19.144.250]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by box.fidei.email (Postfix) with ESMTPSA id CBFF38083F; Wed, 3 Apr 2024 03:33:39 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=dorminy.me; s=mail; t=1712129620; bh=SgpqdEQktNmIE/si/SsUXivp3OLO9RykBmr/owEiMwk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=XAboOI1gOEYEeFHrK1IrQoakMcUXsIMd5sSfqTDBehMhEAI8iLj2M4cvGuZWOnlea sptYc4MV8Ozdb9aTADpJGN+8wTnZ7a4nquwTvUU7Fg8MmCD8svm0CoyTyh7cz/SBD+ ZMFxSNY4lqBJ9+dz+mPFPmrNmB+z57J2Ezal//nHLbJPn2kpBB/DeRdnynt73/ONre w1nx6Q9inAxG9UN8ga9ww6DJNwFqfSLAGdGXdXScTmCspAGRxQd722JIdIuqf41v1U vpPKduXjNxy+o5h6VMKoOcFf5LJdNmM7bXsHLaUDtdElsmkXjDqye/eAoNu2dZVkZX f6UzUKP6VJHVQ== From: Sweet Tea Dorminy To: Jonathan Corbet , Kent Overstreet , Brian Foster , Chris Mason , Josef Bacik , David Sterba , Jaegeuk Kim , Chao Yu , Alexander Viro , Christian Brauner , Jan Kara , =?UTF-8?q?Micka=C3=ABl=20Sala=C3=BCn?= , Sweet Tea Dorminy , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-bcachefs@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-fsdevel@vger.kernel.org, kernel-team@meta.com Subject: [PATCH v3 11/13] bcachefs: fiemap: return correct extent physical length Date: Wed, 3 Apr 2024 03:22:52 -0400 Message-ID: In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Signed-off-by: Sweet Tea Dorminy --- fs/bcachefs/fs.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/fs/bcachefs/fs.c b/fs/bcachefs/fs.c index f830578a9cd1..d2793bae842d 100644 --- a/fs/bcachefs/fs.c +++ b/fs/bcachefs/fs.c @@ -913,15 +913,17 @@ static int bch2_fill_extent(struct bch_fs *c, flags |= FIEMAP_EXTENT_SHARED; bkey_for_each_ptr_decode(k.k, ptrs, p, entry) { - int flags2 = 0; + int flags2 = FIEMAP_EXTENT_HAS_PHYS_LEN; + u64 phys_len = k.k->size << 9; u64 offset = p.ptr.offset; if (p.ptr.unwritten) flags2 |= FIEMAP_EXTENT_UNWRITTEN; - if (p.crc.compression_type) + if (p.crc.compression_type) { flags2 |= FIEMAP_EXTENT_ENCODED; - else + phys_len = p.crc.compressed_size << 9; + } else offset += p.crc.offset; if ((offset & (block_sectors(c) - 1)) || @@ -931,7 +933,7 @@ static int bch2_fill_extent(struct bch_fs *c, ret = fiemap_fill_next_extent(info, bkey_start_offset(k.k) << 9, offset << 9, - k.k->size << 9, 0, + k.k->size << 9, phys_len, flags|flags2); if (ret) return ret; @@ -941,14 +943,18 @@ static int bch2_fill_extent(struct bch_fs *c, } else if (bkey_extent_is_inline_data(k.k)) { return fiemap_fill_next_extent(info, bkey_start_offset(k.k) << 9, - 0, k.k->size << 9, 0, + 0, k.k->size << 9, + bkey_inline_data_bytes(k.k), flags| + FIEMAP_EXTENT_HAS_PHYS_LEN| FIEMAP_EXTENT_DATA_INLINE); } else if (k.k->type == KEY_TYPE_reservation) { return fiemap_fill_next_extent(info, bkey_start_offset(k.k) << 9, - 0, k.k->size << 9, 0, + 0, k.k->size << 9, + k.k->size << 9, flags| + FIEMAP_EXTENT_HAS_PHYS_LEN| FIEMAP_EXTENT_DELALLOC| FIEMAP_EXTENT_UNWRITTEN); } else { -- 2.43.0