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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 1ECC3C433F5 for ; Wed, 24 Nov 2021 06:51:01 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4HzWql36w7z2ymc for ; Wed, 24 Nov 2021 17:50:59 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lst.de (client-ip=213.95.11.211; helo=verein.lst.de; envelope-from=hch@lst.de; receiver=) Received: from verein.lst.de (verein.lst.de [213.95.11.211]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4HzWqg4wzVz2yJ5 for ; Wed, 24 Nov 2021 17:50:55 +1100 (AEDT) Received: by verein.lst.de (Postfix, from userid 2407) id E12D568AFE; Wed, 24 Nov 2021 07:50:50 +0100 (CET) Date: Wed, 24 Nov 2021 07:50:50 +0100 From: Christoph Hellwig To: Dan Williams Subject: Re: [PATCH 18/29] fsdax: decouple zeroing from the iomap buffered I/O code Message-ID: <20211124065050.GB7075@lst.de> References: <20211109083309.584081-1-hch@lst.de> <20211109083309.584081-19-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) 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: Linux NVDIMM , Mike Snitzer , linux-s390 , linux-erofs@lists.ozlabs.org, virtualization@lists.linux-foundation.org, linux-xfs , device-mapper development , linux-fsdevel , linux-ext4 , Ira Weiny , Christoph Hellwig Errors-To: linux-erofs-bounces+linux-erofs=archiver.kernel.org@lists.ozlabs.org Sender: "Linux-erofs" On Tue, Nov 23, 2021 at 01:46:35PM -0800, Dan Williams wrote: > > + const struct iomap_ops *ops) > > +{ > > + unsigned int blocksize = i_blocksize(inode); > > + unsigned int off = pos & (blocksize - 1); > > + > > + /* Block boundary? Nothing to do */ > > + if (!off) > > + return 0; > > It took me a moment to figure out why this was correct. I see it was > also copied from iomap_truncate_page(). It makes sense for DAX where > blocksize >= PAGE_SIZE so it's always the case that the amount of > capacity to zero relative to a page is from @pos to the end of the > block. Is there something else that protects the blocksize < PAGE_SIZE > case outside of DAX? > > Nothing to change for this patch, just a question I had while reviewing. This is a helper for truncate ->setattr, where everything outside the block is deallocated. So zeroing is only needed inside the block.