From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B86E1C6377D for ; Thu, 22 Jul 2021 17:57:37 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 5B6F761409; Thu, 22 Jul 2021 17:57:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5B6F761409 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linux-f2fs-devel-bounces@lists.sourceforge.net Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.92.3) (envelope-from ) id 1m6cwx-0001kJ-TR; Thu, 22 Jul 2021 17:57:35 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.3) (envelope-from ) id 1m6cww-0001kC-Ik for linux-f2fs-devel@lists.sourceforge.net; Thu, 22 Jul 2021 17:57:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=In-Reply-To:Content-Type:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding: 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=TqDa+BTwjADl5/M4HO3Rx6uCbS+wXPUy+HIWshjFpdI=; b=koO3bARGepJV3X01kCj2YuWF4F 8JdiHo792UlCMM5nIvRvnlwYfIxyOLeXxwC/ULZaJCw0pRMDVXRXBZgJktBffkJ9sgNi9m03iH4sk QVT98SOLju1pEs3aE/bCbXPpsbnJwTnjeoWSW6VuXcIHsans7z1AMz9c8NgKiZrYHWZU=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To :From:Date:Sender:Reply-To:Content-Transfer-Encoding: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=TqDa+BTwjADl5/M4HO3Rx6uCbS+wXPUy+HIWshjFpdI=; b=Dxp6Sgfjs9IJhwIDRwndOddvcv Jo9+/18Bkilidp4bvr7jzh2MZYoufW6vy6UFvJPyNOH/DT6BYPhOx5AMtyYyJ1dGZD2AMZ8FNOn80 lUnoHlPzxEOnOeYqtjRygXL4gjz+Ch06hqN7AJt8xE4YQ5uec5p6F/uvG93BR34u6HBs=; Received: from mail.kernel.org ([198.145.29.99]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.3) id 1m6cwv-00H4a3-9H for linux-f2fs-devel@lists.sourceforge.net; Thu, 22 Jul 2021 17:57:34 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id C524261409; Thu, 22 Jul 2021 17:57:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1626976647; bh=Av+Kg+qo1h87X98XcxKgXhZ8WVVGKok4e5W9b5kj9n4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Kd0vHy9MvLBeqi1w8pZV6DG+Y7qotFJDEO8c2DuMlYHgmPK2tvrVSCpmOifeQTIaw YFY8eNdR6c0nPoJ3uTziUEtBHR5QqMqXki9QlK7mP8DwAmG/3QGy3lHy9DHIvbIXyp aOumGiebLkUTgiHiB9FTeVm0jChh/5TiVwCibjIc7WssqYZ1vLh/wg7oi0/Y8+tRX0 j5YFrQbh5EnmCMI3oCLuziI8zjjuXFVoZx0YIotUz2NEnp5p0phNCRg/C5EoTCbk10 FozccR0fBqRC6svIB87FbnGoLaqNvGvPWG4co9NurqH8PLWunFVWNvVKu2KKl0/GbO vmiIY+8BcpY9A== Date: Thu, 22 Jul 2021 10:57:26 -0700 From: Eric Biggers To: Daeho Jeong Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Headers-End: 1m6cwv-00H4a3-9H Subject: Re: [f2fs-dev] [PATCH] f2fs: change fiemap way in printing compression chunk 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: , Cc: linux-f2fs-devel@lists.sourceforge.net Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net On Thu, Jul 22, 2021 at 10:55:01AM -0700, Daeho Jeong wrote: > On Thu, Jul 22, 2021 at 10:36 AM Eric Biggers wrote: > > > > On Thu, Jul 22, 2021 at 09:33:59AM -0700, Daeho Jeong wrote: > > > On Thu, Jul 22, 2021 at 9:26 AM Eric Biggers wrote: > > > > > > > > On Thu, Jul 22, 2021 at 09:17:54AM -0700, Eric Biggers wrote: > > > > > > I think it matches with FIEMAP_EXTENT_UNWRITTEN. Otherwise, we should > > > > > > shorten the last extent like below. > > > > > > > > > > > > fe_logical=0 fe_physical=16384 length=4096 > > > > > > fe_logical=4096 fe_physical=81920 length=4096 > > > > > > fe_logical=8192 fe_physical=147456 length=4096 > > > > > > > > > > > > > > > > > > Unwritten extent - the extent is allocated but its data has not been > > > > > > initialized. This indicates the extent's data will be all zero if read > > > > > > through the filesystem but the contents are undefined if read directly from > > > > > > the device. > > > > > > > > > > Well, as I said before, using UNWRITTEN isn't appropriate because it indicates > > > > > that the data is all zeroes, which in this case it is not. Similarly, reporting > > > > > a hole isn't appropriate because it also indicates that the data is all zeroes > > > > > and also that it has no space allocated on-disk at all. > > > > > > > > > > I think we should just over-report the physical length of the last extent in the > > > > > cluster, which is what btrfs does... > > > > > > > > > > > > > Also keep in mind that as far as fiemap is concerned, when FIEMAP_EXTENT_ENCODED > > > > is set (indicating that the data is compressed or encrypted), then reading the > > > > data from disk will have "undefined results"; see > > > > Documentation/filesystems/fiemap.rst. As such, when someone decides to do so > > > > anyway (which is necessary for encryption testing), they really need to know > > > > *exactly* what they're doing. So I think it's less bad to bend the rules on > > > > extents where FIEMAP_EXTENT_ENCODED is already set. > > > > > > > > In contrast, your suggestion would incorreectly report some parts of the file as > > > > standard extents (or holes) without FIEMAP_EXTENT_ENCODED, so it would be > > > > expected that the standard meaning would apply to those parts. > > > > > > > > - Eric > > > > > > I also think it is okay with the FIEMAP_EXTENT_ENCODED flag. > > > It is actually all zero in a view of the filesystem internal and still > > > undefined if read directly from the device. > > > If we remove this extent, it might be confusing to understand the layout of it. > > > > FIEMAP_EXTENT_ENCODED | FIEMAP_EXTENT_UNWRITTEN is contradictory, so that > > doesn't seem like a good option. And no, the range is *not* zero when read from > > the file by userspace, which is what UNWRITTEN is supposed to indicate. > > > > Compressed data is terminated by an end-of-stream marker, so it is possible to > > decompress even if extra data is appended to it. So that's another reason why I > > feel that my suggestion is not as bad as the other options. > > > > > Plus, I think we need to remove the last extent, when we return back > > > the block to the free space pool to filesystem using releasing > > > reserved space ioctl. > > > > This seems to be a filesystem implementation detail. Again, FS_IOC_FIEMAP is > > just about returning the actual extent mapping, not about other filesystem > > implementation details. > > > > - Eric > > Understood. For confirmation, is this your final suggestion? > > fe_logical=0 fe_physical=16384 length=4096 > fe_logical=4096 fe_physical=81920 length=4096 > fe_logical=8192 fe_physical=147456 length=8192 Yes. - Eric _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel