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=-0.5 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,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 8FD52C63797 for ; Thu, 22 Jul 2021 17:55:23 +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 47CE46109D; Thu, 22 Jul 2021 17:55:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 47CE46109D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1m6cun-0001p1-Ns; Thu, 22 Jul 2021 17:55:21 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m6cum-0001ov-S9 for linux-f2fs-devel@lists.sourceforge.net; Thu, 22 Jul 2021 17:55:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Type:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version: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=QcpK9ch02+t5jW2VhUyRF6PTj5Oemzwke0kZKif9bvo=; b=b3uPOKaeZ4t4K1vjpMBjBvz158 +ehMjbDbig5KL13D1RxLV4e5mgk00HncQng14WsO0XPCnH0f0uE7YMJRO5sjtiIuRDR4aR1HCcsmz qbAc22W+AAKXlJlibid9+jPs5fdfYmIgJrCvbzzNsbt/weQyfIjC0I5ZNqUp7tz1zVo8=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To:References: MIME-Version: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=QcpK9ch02+t5jW2VhUyRF6PTj5Oemzwke0kZKif9bvo=; b=fbKc7xWaDORBw06VKIxKeR9+L6 rQWcOlZ/yTDwFzmj5ZGNdiXmzSdpPsCR/pYplOnCO3SmhmB/2lTikob1M1ckXtjGIF4F+316BZ4wI 8xPgxYIbGOkpX0KezTRbtE7Ovn8n4PgA0u2tKddlHo5DL4kABEC3o4o5E1lYSL0HE0AU=; Received: from mail-lj1-f170.google.com ([209.85.208.170]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.92.3) id 1m6cuk-0004ib-Ov for linux-f2fs-devel@lists.sourceforge.net; Thu, 22 Jul 2021 17:55:20 +0000 Received: by mail-lj1-f170.google.com with SMTP id x24so4694502ljm.4 for ; Thu, 22 Jul 2021 10:55:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=QcpK9ch02+t5jW2VhUyRF6PTj5Oemzwke0kZKif9bvo=; b=I2hzBcNlxSkDlkdYw4zACsvib0R1SV7nPU75UN/d8HBw25jLhzVPUX3vkaw4Ry45fB at1yNn471Z/st7RHkpFCz1hK87cg9cJ8uGOe4L+wZMZjAWh9Yr8wgwOlkdD4K6XCwXFh uv9eWmOHTAwTxqTR/ilSP4vY0tA6X1RFx/rTgcVKLgI6qPsCwwyap7zQpAnsOsR0DYcl x1KkWIWnqkZCWJ+5ei4Cjsz0VmqV9swdRJpvxQMhxyaNzhjzsLXe2hGcn27gVkg2w/cQ thoi/R58AvhZxGEIA2dtubptORchw8BV1XYAraLLTSCrbcL4Wab49/BV6vYO3v03+cBj 9fFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=QcpK9ch02+t5jW2VhUyRF6PTj5Oemzwke0kZKif9bvo=; b=RbAwVpsrK08dlZUIr96IKjC3wSf8xPK6IeavI9COQzMygpQcCFN9UwNEoDPP3wR7X0 I8qYALHSU5qlraCEl+b4wDBWoQd1Qn256mTLIxzsoOUtn9v3gXlSBDaVczVNU50kwnpz SyVcYjbADcA2VwgDxB5whpwZgGPs6wZq8/g3kF33LESSaY4U7k80Z7msj9RGi4yRsU8W RPZE5hX2UHVVm34r/HeGgaeSgAFGZykOiVgBsIKGoUuPvCzFMUSAJO6l+oa6kF7qEqyn Bi8fQdYREy7bN8n3vZbb7jKmi80a2Z4bJFDmaRNtEqudhGk2pta27jizQlek2lEk4Drh Id7w== X-Gm-Message-State: AOAM533KSi379AsTMlINfXKaU46Ai7bllyRzffybZTG5+rdrZBDobc1c +N+gRH67h2hyjjtereRX5I8sbS8F17+Q8nHE3PE= X-Google-Smtp-Source: ABdhPJyI2/UWgeQcJWYc37/P4Rhh/SIEwGjxkoNDpNpi6lUDKT2RVSvZkIyYpNf4CEXh0tLyBOK+oezKzdmn5j4qsJE= X-Received: by 2002:a2e:a815:: with SMTP id l21mr792307ljq.400.1626976512148; Thu, 22 Jul 2021 10:55:12 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Daeho Jeong Date: Thu, 22 Jul 2021 10:55:01 -0700 Message-ID: To: Eric Biggers X-Headers-End: 1m6cuk-0004ib-Ov 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: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 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel