Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2885343lqz; Wed, 3 Apr 2024 11:15:44 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVe81+iI8LVWFCd0BqRSaIufZUVKMDTmCaEYOJ2b66C76ydhhDNrEjAI0pyfeTs7nDhXUAgVuSqh3mTpIFzCuvKwjmQ5TayUI0m7YvCZQ== X-Google-Smtp-Source: AGHT+IGmuhz8fmpizyCc6O39oJaSdwZKEYOTIKi7gUCcPBoczMKm2HHut5VsA0PuRxaynPjZm84E X-Received: by 2002:ac8:5c07:0:b0:434:389b:4643 with SMTP id i7-20020ac85c07000000b00434389b4643mr130386qti.52.1712168144234; Wed, 03 Apr 2024 11:15:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712168144; cv=pass; d=google.com; s=arc-20160816; b=n6bqVi0kpu+aSwVrndUZrg8EPnaael9ANMG6AihnBJHfPXMuZPrrE05vIXFld8SXOm dIMpfUyIqafhcklS+5eU/Syhnwi0fCOf7QSStqJzNyJOx5UFyxbKA1xbNEmfP/jwUF15 N5KbgGiS5JPjOX8/pXzVulpl3JTiRUsDaLzjBijmN6vv+Beyaq27z/8XOsH56c/Uadl+ 3zx3zZ6gVRS3t3V+nFjNBfH1AjP1mjbR99CJDtrCfDQurNkmUDPP3Llo3xi3bNMInpwe LrK24nfdQyD1f5gL8t4OY/oC0QZytO6+Syw2ATbhDwbK87N5v3WCw4dVLLtGmRHkHdNX Y4Eg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:dkim-signature:date; bh=KugM06W/s0lb++bW7levKHgpFLyEAtmCAECxADz00LA=; fh=r1Y9LJqy8BHuQf2FMoPPPsMcUEoqfFCk3A/LNDpmQos=; b=sz1vDFXEZEiMsUM/gybwdSuktRpEFPsWrSXEG+XsoxeZrACU/J5TkyzuV4n0puNPAo kpTb/hOlX5QTXGuizQEAI0/DNO3CrjPQ2+Pu8IA0NuLIS0Umc267NjCyiiW7TeeJvT/h 2AHgBLjt0m9PhcSCcNCURfmNBVcWJStexbkFoqYSaCzXZCAPC4mRBSHdcBDwEt5h/OEn UBxgzzhdChuej3QvUJSrLDONqnv9t+vyJb2ZjW0jFbd5fIhr0zuMlFVrTWfjejPTI+jP ryl8y48vvO3RCglBLfwBfehzaqFyvh2pzmrchko/kOWUKR5HhsREzE7MbQHSm3ENIBPX x7bA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=O+mF5tSo; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-130429-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130429-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id dp9-20020a05622a47c900b00432c8c1eeeesi10610809qtb.616.2024.04.03.11.15.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 11:15:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-130429-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=O+mF5tSo; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-130429-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130429-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id E271D1C2165E for ; Wed, 3 Apr 2024 18:15:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 77B1A15359B; Wed, 3 Apr 2024 18:15:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="O+mF5tSo" Received: from out-184.mta0.migadu.com (out-184.mta0.migadu.com [91.218.175.184]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E4B021534F5 for ; Wed, 3 Apr 2024 18:15:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.184 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712168130; cv=none; b=ri3FYIwBRtKonbgJ04YMaypdGada5ZT1otdW/rkiwnbvLekJHiS+Zk8UdgDMLminpaEUz5SXrMEgjtXjXShftw/bvazENNOj+g1rly2FaSu5hH9qlIt/FGbMopzaSQ/jyD6Z5+vb2e6T/gZDHt3RieZWcqaSuaIafQncILKEKeM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712168130; c=relaxed/simple; bh=1oV7F1jBmYRZsA6svOOmuWXQI3vYZavB0QFuGC36KRM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=KhRD1TAjOG1U9rzvAca1q9Z/kEEdEowZF0+ME8ZUjCZ4pmsrtHEl49Lwey0duZKWIF0NaWd8+EmMyCST2vQsyJ7FRA476/Ofx4TOfURUaSOJy46sx79ggJOMUqgXgv7StQf52mcFWnztD2bwIn+CNKqxNhHHH2NaTABwEHj/hRM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=O+mF5tSo; arc=none smtp.client-ip=91.218.175.184 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Date: Wed, 3 Apr 2024 14:15:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1712168126; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=KugM06W/s0lb++bW7levKHgpFLyEAtmCAECxADz00LA=; b=O+mF5tSo+kQ3evl6evxwBacTiXzfRDinz7tasCBoCXvkVzg71Eg2Tj11aOOQOvAn2VtbKa 4xDUzXt3vcUN1q4BynOenQTSxBZUR+PUrwJNN863OgeLxrPH8kAqph+irAR/22JqAk8WiC UUHnl3AUbkMRomaUH0xPDBYfDm7mIPM= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Kent Overstreet To: Brian Foster Cc: Sweet Tea Dorminy , Jonathan Corbet , 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?= , 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: Re: [PATCH v3 11/13] bcachefs: fiemap: return correct extent physical length Message-ID: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT On Wed, Apr 03, 2024 at 01:00:11PM -0400, Brian Foster wrote: > On Wed, Apr 03, 2024 at 03:22:52AM -0400, Sweet Tea Dorminy wrote: > > 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), > > Question for Kent perhaps, but what's the functional difference between > bkey_inline_data_bytes() and k->size in this particular case? Not much - k->size will correspond to the size of the original write - that is, the writeback write from the pagecache. inline_data_bytes is the amount of data that wasn't zeroes. So inline_data_bytes is probably the right thing to use here.