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.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,URIBL_BLOCKED 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 BE6FEC4338F for ; Mon, 26 Jul 2021 12:51:28 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (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 1B5B160F4F for ; Mon, 26 Jul 2021 12:51:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 1B5B160F4F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.ozlabs.org Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4GYKYV5mzxz3019 for ; Mon, 26 Jul 2021 22:51:26 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linux.alibaba.com (client-ip=115.124.30.43; helo=out30-43.freemail.mail.aliyun.com; envelope-from=hsiangkao@linux.alibaba.com; receiver=) Received: from out30-43.freemail.mail.aliyun.com (out30-43.freemail.mail.aliyun.com [115.124.30.43]) (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 lists.ozlabs.org (Postfix) with ESMTPS id 4GYKYN4v3cz3019 for ; Mon, 26 Jul 2021 22:51:18 +1000 (AEST) X-Alimail-AntiSpam: AC=PASS; BC=-1|-1; BR=01201311R931e4; CH=green; DM=||false|; DS=||; FP=0|-1|-1|-1|0|-1|-1|-1; HT=alimailimapcm10staff010182156082; MF=hsiangkao@linux.alibaba.com; NM=1; PH=DS; RN=9; SR=0; TI=SMTPD_---0Uh2wpJ9_1627303860; Received: from B-P7TQMD6M-0146.local(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0Uh2wpJ9_1627303860) by smtp.aliyun-inc.com(127.0.0.1); Mon, 26 Jul 2021 20:51:01 +0800 Date: Mon, 26 Jul 2021 20:50:59 +0800 From: Gao Xiang To: Andreas =?utf-8?Q?Gr=C3=BCnbacher?= Subject: Re: [PATCH v7] iomap: make inline data support more flexible Message-ID: Mail-Followup-To: Andreas =?utf-8?Q?Gr=C3=BCnbacher?= , Christoph Hellwig , Andreas Gruenbacher , "Darrick J . Wong" , Matthew Wilcox , Huang Jianan , linux-erofs@lists.ozlabs.org, Linux FS-devel Mailing List , Linux Kernel Mailing List References: <20210723174131.180813-1-hsiangkao@linux.alibaba.com> <20210725221639.426565-1-agruenba@redhat.com> <20210726110611.459173-1-agruenba@redhat.com> <20210726121702.GA528@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-BeenThere: linux-erofs@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development of Linux EROFS file system List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andreas Gruenbacher , "Darrick J . Wong" , Linux Kernel Mailing List , Matthew Wilcox , Linux FS-devel Mailing List , linux-erofs@lists.ozlabs.org, Christoph Hellwig Errors-To: linux-erofs-bounces+linux-erofs=archiver.kernel.org@lists.ozlabs.org Sender: "Linux-erofs" Hi Andreas, Christoph, On Mon, Jul 26, 2021 at 02:27:12PM +0200, Andreas Grünbacher wrote: > Am Mo., 26. Juli 2021 um 14:17 Uhr schrieb Christoph Hellwig : > > > > > Subject: iomap: Support tail packing > > > > I can't say I like this "tail packing" language here when we have the > > perfectly fine inline wording. Same for various comments in the actual > > code. > > > > > + /* inline and tail-packed data must start page aligned in the file */ > > > + if (WARN_ON_ONCE(offset_in_page(iomap->offset))) > > > + return -EIO; > > > + if (WARN_ON_ONCE(size > PAGE_SIZE - offset_in_page(iomap->inline_data))) > > > + return -EIO; > > > > Why can't we use iomap_inline_data_size_valid here? > > We can now. Gao, can you change that? Thank you all taking so much time on this! much appreciated. I'm fine to update that. > > > That is how can size be different from iomap->length? > > Quoting from my previous reply, > > "In the iomap_readpage case (iomap_begin with flags == 0), > iomap->length will be the amount of data up to the end of the inode. For tail-packing cases, iomap->length is just the length of tail-packing inline extent. > In the iomap_file_buffered_write case (iomap_begin with flags == > IOMAP_WRITE), iomap->length will be the size of iomap->inline_data. > (For extending writes, we need to write beyond the current end of > inode.) So iomap->length isn't all that useful for > iomap_read_inline_data." Ok, now it seems I get your point. For the current gfs2 inline cases: iomap_write_begin iomap_write_begin_inline iomap_read_inline_data here, gfs2 passes a buffer instead with "iomap->length", maybe it could be larger than i_size_read(inode) for gfs2. Is that correct? loff_t max_size = gfs2_max_stuffed_size(ip); iomap->length = max_size; If that is what gfs2 currently does, I think it makes sense to temporarily use as this, but IMO, iomap->inline_bufsize is not iomap->length. These are 2 different concepts. > > > Shouldn't the offset_in_page also go into iomap_inline_data_size_valid, > > which should probably be called iomap_inline_data_valid then? > > Hmm, not sure what you mean: iomap_inline_data_size_valid does take > offset_in_page(iomap->inline_data) into account. > > > > if (iomap->type == IOMAP_INLINE) { > > > + int ret = iomap_read_inline_data(inode, page, iomap); > > > + return ret ?: PAGE_SIZE; > > > The ?: expression without the first leg is really confuing. Especially > > if a good old if is much more readable here. > > I'm sure Gao can change this. > > > int ret = iomap_read_inline_data(inode, page, iomap); > > > > if (ret) > > return ret; > > return PAGE_SIZE; I'm fine to update it if no strong opinion. > > > > > + copied = copy_from_iter(iomap_inline_data(iomap, pos), length, iter); > > > > > > > + copied = copy_to_iter(iomap_inline_data(iomap, pos), length, iter); > > > > Pleae avoid the overly long lines. > > I thought people were okay with 80 character long lines? Christoph mentioned before as below: https://lore.kernel.org/linux-fsdevel/YPVe41YqpfGLNsBS@infradead.org/ We also need to take the offset into account for the write side. I guess it would be nice to have a local variable for the inline address to not duplicate that calculation multiple times. Thanks, Gao Xiang > > Thanks, > Andreas