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=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 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 A9FB3C4320A for ; Mon, 26 Jul 2021 12:17:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8F64660F46 for ; Mon, 26 Jul 2021 12:17:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233897AbhGZLgi (ORCPT ); Mon, 26 Jul 2021 07:36:38 -0400 Received: from verein.lst.de ([213.95.11.211]:44953 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233713AbhGZLgg (ORCPT ); Mon, 26 Jul 2021 07:36:36 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id DA9AA67373; Mon, 26 Jul 2021 14:17:02 +0200 (CEST) Date: Mon, 26 Jul 2021 14:17:02 +0200 From: Christoph Hellwig To: Andreas Gruenbacher Cc: Gao Xiang , Christoph Hellwig , "Darrick J . Wong" , Matthew Wilcox , Huang Jianan , linux-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Andreas Gruenbacher Subject: Re: [PATCH v7] iomap: make inline data support more flexible Message-ID: <20210726121702.GA528@lst.de> References: <20210723174131.180813-1-hsiangkao@linux.alibaba.com> <20210725221639.426565-1-agruenba@redhat.com> <20210726110611.459173-1-agruenba@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210726110611.459173-1-agruenba@redhat.com> User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > 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? That is how can size be different from iomap->legth? Shouldn't the offset_in_page also go into iomap_inline_data_size_valid, which should probably be called iomap_inline_data_valid then? > 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. int ret = iomap_read_inline_data(inode, page, iomap); if (ret) return ret; return PAGE_SIZE; > + 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.