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=-2.5 required=3.0 tests=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 8C5D4C35280 for ; Mon, 30 Sep 2019 11:07:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6DB8C2190F for ; Mon, 30 Sep 2019 11:07:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730515AbfI3LHf (ORCPT ); Mon, 30 Sep 2019 07:07:35 -0400 Received: from verein.lst.de ([213.95.11.211]:36428 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728214AbfI3LHf (ORCPT ); Mon, 30 Sep 2019 07:07:35 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id B590F68B20; Mon, 30 Sep 2019 13:07:31 +0200 (CEST) Date: Mon, 30 Sep 2019 13:07:31 +0200 From: Christoph Hellwig To: "Darrick J. Wong" Cc: Christoph Hellwig , Goldwyn Rodrigues , linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH 06/19] iomap: use write_begin to read pages to unshare Message-ID: <20190930110731.GA6987@lst.de> References: <20190909182722.16783-1-hch@lst.de> <20190909182722.16783-7-hch@lst.de> <20190916183428.GK2229799@magnolia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190916183428.GK2229799@magnolia> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Mon, Sep 16, 2019 at 11:34:28AM -0700, Darrick J. Wong wrote: > > - if ((from <= poff || from >= poff + plen) && > > + if (!(flags & IOMAP_WRITE_F_UNSHARE) && > > Mmm, archeology of code that I wrote originally and have forgotten > already... :) > > I think the purpose of F_UNSHARE is to mimic the behavior of the code > that's being removed, and the old behavior is that if a user asks to > unshare a page backed by shared extents we'll read in all the blocks > backing the page, even if that means reading in blocks that weren't part > of the original unshare request, right? No. The flag causes the code to always read the page, even if the iomap range covers the whole block. For normal writes that means we don't to read the block in at all, but for unshare we absolutely must do so.