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 8D110C63797 for ; Thu, 22 Jul 2021 17:36:52 +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 489EE61003; Thu, 22 Jul 2021 17:36:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 489EE61003 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 1m6ccs-00011g-B6; Thu, 22 Jul 2021 17:36:50 +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 1m6ccq-00011X-33 for linux-f2fs-devel@lists.sourceforge.net; Thu, 22 Jul 2021 17:36:48 +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=lM51MEKLQm03GtKRhihGMXCZ70gqYMvs8DnRjb4VjtE=; b=KiEH7Mpc6zWgqIJIucS5i0UoVP 105E4AUMJISpTRkS/fk2Y6YMTy1RCgb+hKDC5mD2ioopOSg30ODTd/Omtp9YKcJXDTxLw+RvNqZ9m QDKpzNJFtfwZqtk+r1aDFSYnSumX5qPxBPsy/6iuF3y/rVWX1OrKEd9ha5/4/ZdbE00M=; 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=lM51MEKLQm03GtKRhihGMXCZ70gqYMvs8DnRjb4VjtE=; b=FqBIdZhhcUM+1FHdTXYVqpkrjr bFgkviVM1wjwl7icO8HBEsgdeEpacd9furAoKL3fDTKeY3iN2OwmkUabM9NPEHQk5tpk3GtGbLQDK 9yT0xDlafAIoVTeCr7Rq4pKPBLMPdJWRbtxPG+XUv8C5Vk6mqtx6WNwVESWNREHkfRe4=; 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 1m6ccj-00H3x7-OR for linux-f2fs-devel@lists.sourceforge.net; Thu, 22 Jul 2021 17:36:47 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4980B611C1; Thu, 22 Jul 2021 17:36:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1626975391; bh=JHEzmorgHIE3uvJSz7raB+MO1KUcxcyBX18Nk8l7ovk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=aPpP8IaOgC+RO8+sjg+7wYCZ3Aolz/VqsSo+EWEclAaKsp0ywAK/tKTsuvkhV+Kvx ByKWF2CFfiuDsmDG5MHfoWvetG/e8z7qNftgxqLyFQ2vl95Ap1XW2/YqMoAzmJV5AM SnplNKCG3cAHtmF5BKr2G/lvADcXNjnoy3STV5mBLj9xbY/92t+z6Cz/pu8IuGQm8W 7gtVZ1Obqus8iQ6+bfYmcbmnowkvIHiWnk5QOLVddSBxKW6B7BpZBtT8dK0rc4ZMtF FaCG3UZFRpGKksH3vKbz/nldTfznicYLRdiiJ0in1dXGDRQgCPay16X0CID1jaeyAc 4AzbNmrLunt3Q== Date: Thu, 22 Jul 2021 10:36:29 -0700 From: Eric Biggers To: Daeho Jeong Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Headers-End: 1m6ccj-00H3x7-OR 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 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 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel