From patchwork Wed Apr 3 07:22:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sweet Tea Dorminy X-Patchwork-Id: 13615192 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 14CA5CD1288 for ; Wed, 3 Apr 2024 07:52:39 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1rrvQE-0002nk-97; Wed, 03 Apr 2024 07:52:38 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1rrvQ9-0002mV-UI for linux-f2fs-devel@lists.sourceforge.net; Wed, 03 Apr 2024 07:52:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=DbnwEYctC+JK8P/EWPZTBgKnomIWJC9/OakieGz83Y4=; b=EYAElkzrs0pN/SWdf2uXeyP+Pk a1qQcXXMtUW65HXNwpM9Db6YerJ+nnPGo/OrhQUkQ3xyDNFRm98ihXt3P90n8i78zVFBACKLRgA5l yovwmhdmBdUor8qZAxU3xVCzv7pK5mP8dqtnsVupz1fP9VQm0OY/irxO3v7mZoSjV95Y=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID: Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=DbnwEYctC+JK8P/EWPZTBgKnomIWJC9/OakieGz83Y4=; b=hronlmkdlXPq3/m1lOT75qLPMr QxydsmdtgqD7sYpwfSxy8rb2unKhG0U7RpgjOGPOH5epMeq2Sv6hWbBDkVZXcFzW7LbUY/YNNXIIe ZN7j29XORL5bW331/rILVfdhCNhlcLAVOyco2Wv/1gyqio/anEFuJM5mhkERyuLlilcg=; Received: from box.fidei.email ([71.19.144.250]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.95) id 1rrvQ3-0001lb-Vo for linux-f2fs-devel@lists.sourceforge.net; Wed, 03 Apr 2024 07:52:28 +0000 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== 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_Sala=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 Date: Wed, 3 Apr 2024 03:22:52 -0400 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Headers-End: 1rrvQ3-0001lb-Vo Subject: [f2fs-dev] [PATCH v3 11/13] bcachefs: fiemap: return correct extent physical length X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Sweet Tea Dorminy via Linux-f2fs-devel From: Sweet Tea Dorminy Reply-To: Sweet Tea Dorminy Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net 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 {