Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2839636lqz; Wed, 3 Apr 2024 09:58:48 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUXTwVZ6oEPr2vhsFFTqU5s/S2k2enJcOiwrksknYY3hameHGoW/xbqNGDQScrPvzDU2MvzgGf5aAoY7r09Tv8iFLijveUoVt7VC7s8Yg== X-Google-Smtp-Source: AGHT+IH/nSqZVJ5bCcZeanlU/41pqbB+1c2rP3lI3p1SHg7W35jKk5EXMR39U096Z0JUUeLbjW3g X-Received: by 2002:a81:a00d:0:b0:609:ef57:2266 with SMTP id x13-20020a81a00d000000b00609ef572266mr3094960ywg.34.1712163528588; Wed, 03 Apr 2024 09:58:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712163528; cv=pass; d=google.com; s=arc-20160816; b=pDDA8IMdiGni4dN09ZH2mmGaIVE0eXZ1/hTSg8gqtOYSqdLdLbo+1Tlc0HBs+3RcVj 95OlVPSl3hBP+1KNRvE/PVw3zGu/8cEh0RUuh++s/5NdXEcWK8kKQWx8SLCFNU8tUxh9 0KbBfLLkGKap9RE5VslsbfJZwseuzHYPVbo74cBq6klIZtWtVdVdUyugUyAZx6HmYfXL 2bDMz7gWIu+hjb6hvGmWi1YbzrTBLw7RfnSiPrN56hTC+5gaWuAKlLQI8eMxPrCq5Ilu 3WQee042+RW6dVO9Q/Md5N4Uw5d3pbGxtWW18YyUUEaA/zK66etT7bStO0IGBjtDhahU 9AlA== 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:date:dkim-signature; bh=M0vlp5zqKNWczSf5uwQPJWCYRlyw0wuDQPwNGC+8xK8=; fh=1thV8l99qO2A5E8JO0BgagrRJmoEa41CKOgzlhIKDZ4=; b=oz7oEr9HsrCg2bJHCKef1CJC6JqEQLMPvYNIb2yNm40YRRfqatgSDdJhPKvh7jn7fC tuFd6dIdTomPvoQzDopqZUbKdmVaiqmo7jDHAbauI6Nw8jzZaxy04Ofjb+29dIVMwtLs 9WTLX486/4SuPD1iHb0RTWM8gHbHtWHG7+IJamSeQN9hgSS37qzcglPagIWhTExobM4K w+PAHa7sS/KbxPDff8OvVTIuV8TRdV/9wDTe8Xo8m4aKzisLXpQzRUxVXeidHlEPIfHT dAtFDRIHRDCiuCFNW30O/gXo9bdOA/Uok74iLS7Gvo3HbYrdhz41o9z17zbbfWvM+g9n Z2dw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fOIBUJBy; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-130233-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130233-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id y10-20020a05622a004a00b004318e8e160csi1223983qtw.647.2024.04.03.09.58.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 09:58:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-130233-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=@redhat.com header.s=mimecast20190719 header.b=fOIBUJBy; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-130233-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130233-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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 44A911C21C7F for ; Wed, 3 Apr 2024 16:58:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9827D152512; Wed, 3 Apr 2024 16:58:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="fOIBUJBy" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 3D4C23E487 for ; Wed, 3 Apr 2024 16:58:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712163503; cv=none; b=e5TDfsBDNr+Cw3AGZVL2VGxaWt2+OKQcIOhFib3zAuZ+325gTFiXfkIAYWnz377lQgweq2WiEiUSr+NriZ05Kf9Wk1WsSSZKzM2D78OxeNQWcSOYxgtdG2qr/YYoaEtbdMtJNhJo5SwOwmU0ksIBRYjPCpJ8TNK0fbwQSDIkkMY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712163503; c=relaxed/simple; bh=AnaON3b/vCZPnX5n53LzayRcIw1CUYQ6URv93NPOgQI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=YkYGV2o07HNCRDflB45Xa4yVRPNUm9M7+Yn1tFclQX2s8+nig/V/14bskozi+tSulZgZ4QIDfh+F2bXzKTpWZDfWuMMoEt3O67w78dzpm2s6kBSsuB1jWZ4fDxhDekbTaQwKbHjr1UGtEtHuog+aQ5DVCEr13gr7RBfNVvwy+bQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=fOIBUJBy; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712163501; 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=M0vlp5zqKNWczSf5uwQPJWCYRlyw0wuDQPwNGC+8xK8=; b=fOIBUJByalQSeSW6Fan2gddF9EBLdjZk0PCNbm4jYZ/mR1UHskxMba0IFcFi4vk6kRyqSD FBGwTtN1cwUtFyIMeK5MCtHzqAzC7RD25OZ1SYb9cKaBxFMlxY9HU3Ze+r3/4VyumL2kyE nrO9VYy9wGJqFbdhLQ3z4mmvgjpPYUw= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-588-b9Sqe5VQNbSAgN0m4F60cA-1; Wed, 03 Apr 2024 12:58:14 -0400 X-MC-Unique: b9Sqe5VQNbSAgN0m4F60cA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6496A383CD7A; Wed, 3 Apr 2024 16:58:13 +0000 (UTC) Received: from bfoster (unknown [10.22.16.57]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A6F3C40C6CB5; Wed, 3 Apr 2024 16:58:12 +0000 (UTC) Date: Wed, 3 Apr 2024 13:00:11 -0400 From: Brian Foster To: Sweet Tea Dorminy Cc: Jonathan Corbet , Kent Overstreet , Chris Mason , Josef Bacik , David Sterba , Jaegeuk Kim , Chao Yu , Alexander Viro , Christian Brauner , Jan Kara , =?iso-8859-1?Q?Micka=EBl_Sala=FCn?= , 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-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 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? FWIW that and the other couple nitty questions aside, this all LGTM. Thanks. Brian > 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 > >