Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp73369pxk; Sat, 29 Aug 2020 16:45:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQeypXvhWkCg+jd2RSgmHOoUDVupGuw3jhf51OE/qq6N9Yo8owy58C2Q7lTZeM43s/DpZ8 X-Received: by 2002:a05:6402:1d97:: with SMTP id dk23mr5349485edb.350.1598744724484; Sat, 29 Aug 2020 16:45:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598744724; cv=none; d=google.com; s=arc-20160816; b=xXq+dM6Qe/J6vcKTWS8f36FlciUpNmB7aa+cF8tcoamyU2dZ+XwctjNXqe7RVj1qmU 3drgVB3uwTOWJs3sI+Ahc9NbYCk1DtgT190Q9NYtfyvERgTZXMszbRwMo6zk8jLOm3zT Fs53F7038usNcTwH7u9Zldqgr/NhIEjuMoBrmd7XknZakY158j+CLEKF5rFl7PLB0jI7 tIjw2TjuE1HP1SvdpU9rflxC4jcx6apfhTpa4zjqkU2xOvcdkCS/hA8CjRVKO5DNogTx DISZqp5n0WjmKuioA2ojITjfUV3z/npZqW+Go5WY2OVd1gIsBaSXK2iqznEwD2Hkqy5W 1m9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject:dkim-signature; bh=83Iz99SHGFnxWdZNnURe7yKQIiJNbe/r+PVI6vGEjo4=; b=kezWl3kTdnzlzqTYPpGJ+XxOG0f9qqDbn8dWW8ScNO34TFVcF42fi1uU2YU8QTfsBr csoTHZJJS3+YLYHaqu13xF9HAYKctlIGYNzdAGSITiJ0GxmXZjkjuxsT2RvGF02c3tjX nGZAflu0A60fpiFTjWCQ+/F/mdwldLwF4IT1Cieh2nhFlTCZAnaL21hM9Xvu6VY/qUQT EXvrtGQAcJmg5YrjMrn7V9Fg9uP/XocoxaT+GWmE76HFolFWVnM/fk+p8g+5BvcfyLEM HySYYsxMsidJM2L/sd4E5BArd87QmPKPX57L8z9nT7LwsqV6imDSmlHAhXNJSY1Zf+m3 n4Xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zFklHNGv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w19si2372202eds.303.2020.08.29.16.45.01; Sat, 29 Aug 2020 16:45:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zFklHNGv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728095AbgH2Xo0 (ORCPT + 99 others); Sat, 29 Aug 2020 19:44:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:52478 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726995AbgH2XoW (ORCPT ); Sat, 29 Aug 2020 19:44:22 -0400 Received: from [192.168.0.108] (unknown [49.65.245.85]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A889F20776; Sat, 29 Aug 2020 23:44:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598744661; bh=T86btTIeJaz0WbqNY52QJxthzlK/IGB8x+5hfU2xFp8=; h=Subject:To:References:Cc:From:Date:In-Reply-To:From; b=zFklHNGvPl0pOPdTnZD3JhNvOL4h4+J49XNOxGF2GJBikhRfXdEW2W4OpoA4TR/xG NB3vt3NUBVzHIWKFtPd8F3Ot1VclaeQZT7ofqsEz8ZuppSFOTDZ5u/iGBD6RLTpafH xi9N4F8Oddy+Meu4Al3H6+Ngz/h1R1rlG9nOVZHo= Subject: Re: [f2fs-dev] [PATCH] f2fs: make fibmap consistent with fiemap for compression chunk To: Daeho Jeong , linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, kernel-team@android.com References: <20200828034953.354267-1-daeho43@gmail.com> Cc: Daeho Jeong From: Chao Yu Message-ID: <44f8d9f3-9438-fdfe-bbc3-f5347a9aaa29@kernel.org> Date: Sun, 30 Aug 2020 07:44:09 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <20200828034953.354267-1-daeho43@gmail.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-8-28 11:49, Daeho Jeong wrote: > From: Daeho Jeong > > Currently fibmap returns zero address for compression chunk. But it > is not consistent with the output of fiemap, since fiemap returns > real pysical block address related to the compression chunk. Therefore > I suggest fibmap returns the same output with fiemap. We can return real physical block address in fiemap, because we have set FIEMAP_EXTENT_ENCODED flag in extent.fe_flags, then user can be noticed that he can not just read/write that block address for access/update in-there data. Quoted from Documentation/filesystems/fiemap.rst " FIEMAP_EXTENT_ENCODED This extent does not consist of plain filesystem blocks but is encoded (e.g. encrypted or compressed). Reading the data in this extent via I/O to the block device will have undefined results. " However, there is no such flag in fibmap interface, so I just return block address for those logical pages in non-compressed cluster. Thanks, > > Signed-off-by: Daeho Jeong > --- > fs/f2fs/data.c | 33 --------------------------------- > 1 file changed, 33 deletions(-) > > diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c > index c1b676be67b9..8c26c5d0c778 100644 > --- a/fs/f2fs/data.c > +++ b/fs/f2fs/data.c > @@ -3708,36 +3708,6 @@ static int f2fs_set_data_page_dirty(struct page *page) > return 0; > } > > - > -static sector_t f2fs_bmap_compress(struct inode *inode, sector_t block) > -{ > -#ifdef CONFIG_F2FS_FS_COMPRESSION > - struct dnode_of_data dn; > - sector_t start_idx, blknr = 0; > - int ret; > - > - start_idx = round_down(block, F2FS_I(inode)->i_cluster_size); > - > - set_new_dnode(&dn, inode, NULL, NULL, 0); > - ret = f2fs_get_dnode_of_data(&dn, start_idx, LOOKUP_NODE); > - if (ret) > - return 0; > - > - if (dn.data_blkaddr != COMPRESS_ADDR) { > - dn.ofs_in_node += block - start_idx; > - blknr = f2fs_data_blkaddr(&dn); > - if (!__is_valid_data_blkaddr(blknr)) > - blknr = 0; > - } > - > - f2fs_put_dnode(&dn); > - return blknr; > -#else > - return 0; > -#endif > -} > - > - > static sector_t f2fs_bmap(struct address_space *mapping, sector_t block) > { > struct inode *inode = mapping->host; > @@ -3753,9 +3723,6 @@ static sector_t f2fs_bmap(struct address_space *mapping, sector_t block) > if (mapping_tagged(mapping, PAGECACHE_TAG_DIRTY)) > filemap_write_and_wait(mapping); > > - if (f2fs_compressed_file(inode)) > - blknr = f2fs_bmap_compress(inode, block); > - > if (!get_data_block_bmap(inode, block, &tmp, 0)) > blknr = tmp.b_blocknr; > out: >