Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp3509876pxv; Mon, 26 Jul 2021 05:52:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzxxjKjeSbAwnO9HYkBO0n1E9Hml4un4hbK8G2Tg2FkTm9hTpxDJMzWT/6Udo86OWxHIJ24 X-Received: by 2002:a17:906:d977:: with SMTP id rp23mr16961709ejb.512.1627303973979; Mon, 26 Jul 2021 05:52:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627303973; cv=none; d=google.com; s=arc-20160816; b=kvmOxiaw1h5JM8nAAEuizh8Hb/DRjXGrVIxRI5bCQG3dD17kgarrftdeokfLgJXuL7 rB9LszZ61OcZN8SaxWw/k4fI3M0qifhRgJHpM+faDJ+1TVRLglIRFMr57Ec+vnyFJEWR kM9CTdMfuWmi7K9+XD29XRB2JH58BrCISuvHfqKVXInhEAskcvzMPSaC8cR+ELrREPt8 j93U1KAq9FlDSamrKRr9vRSBX81pMAHPPdhglp0lyhZ6EuxLTdG8SYc/jJm4L8iuSVIW vuBUY1loOEU1QsFg/cs+lPPeyHmzfXWRJNc7vXkCiVd6HyMMNs22NlXnIzN18hQJ1A3S GDFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date; bh=qBGLtgrSIJzdxz3pACobLvP6OY+pqix+tRJIOgWLBx8=; b=hnLEfN8oe/rztxpz8dHiGWEkqfgQskoIEuFqT0ZHEN7xJ5+f+UDc3XaifCflvGRDoW /8AqAYNqt05hnMqR3X5e/GdIHCRgeU84owI2b5LaN+LRlIp6uHYHDmHXdsxkskJ+yfEi SGkbwKyTfrH95668vhcwm1joOZCQWpmuyEVggM+dDrO5IKWhW/QPKpRfFuUuAgK9LpsR i06IXxOSqkRUkGrDRfUBBt3cPN2R6q7urv6UfJGRbmV/jZcj9cB/vW1OwEBIIQVy5V5Z EFBI/hJYBAJUVkJbs2H8EuyE2Rx21nsDlT3Tkq1wwWZ9jlSnlQ9a2nlkWqCkIfsrtY5R QJfA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s10si18982364ejz.82.2021.07.26.05.52.30; Mon, 26 Jul 2021 05:52:53 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234147AbhGZMKg (ORCPT + 99 others); Mon, 26 Jul 2021 08:10:36 -0400 Received: from out30-57.freemail.mail.aliyun.com ([115.124.30.57]:56602 "EHLO out30-57.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234031AbhGZMKf (ORCPT ); Mon, 26 Jul 2021 08:10:35 -0400 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?= Cc: 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 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: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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