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=-7.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 2C9B5C43218 for ; Thu, 25 Apr 2019 15:26:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 60DAF20644 for ; Thu, 25 Apr 2019 15:26:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728313AbfDYP0O (ORCPT ); Thu, 25 Apr 2019 11:26:14 -0400 Received: from mail-oi1-f195.google.com ([209.85.167.195]:36891 "EHLO mail-oi1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727337AbfDYP0O (ORCPT ); Thu, 25 Apr 2019 11:26:14 -0400 Received: by mail-oi1-f195.google.com with SMTP id k6so369609oic.4 for ; Thu, 25 Apr 2019 08:26:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=uFOCO1ItOKWZcZ5F0rbLdP7zIsx0CA40Iqoc/tiShvA=; b=UaB9yP4PDGxSk7LakuRtC3OIiP0JuPwPVdNpr8wVQTzW22x9VGatQJBNWzjKSGJeei +QQM0pHgJvFp6m9ZgAjaALCOM5onMBDchH1eEh1pgeyzTFTI5Kl1qoMS+LhKKimKgkRb p4lzn8qH6/wcezOtgidatzVyDWRbeW4U2EA8l0d4FUbfoR9BDt42Pa+L9EpSVFC2mPgm N/i+oOGTBd0ERuA7bGAeiaDHr1So4qyr0L5SnEWWz6HU92aPnvBve0aIXFgOzYdCRNHH 5KzmkiADP+/e0milPVjyTHkEkcwUgp316L8xVcDFDWbI9N2sJtprITq8HuXskwOU0BWv 4rLg== X-Gm-Message-State: APjAAAVYZhN7uDnc4IJw0DeLVUjBoLtk9bxDH2H7gb5mtDY4HHsB5BqA pz9LL6tRPKjLgE3arPYXWIVj+c1jxR5/RCaNU2Ea7g== X-Google-Smtp-Source: APXvYqwZOItgZVqRXw5Yg2/10aRXjbFFLX1rDfapPu/j4WsnrJ0kcaQVVrzTwTwDgb3w4DqAQ+gGMMv1oCHLTJfrG1o= X-Received: by 2002:a54:4f02:: with SMTP id e2mr3405871oiy.10.1556205972845; Thu, 25 Apr 2019 08:26:12 -0700 (PDT) MIME-Version: 1.0 References: <20190424171804.4305-1-agruenba@redhat.com> <20190425083252.GB21215@quack2.suse.cz> In-Reply-To: <20190425083252.GB21215@quack2.suse.cz> From: Andreas Gruenbacher Date: Thu, 25 Apr 2019 17:26:01 +0200 Message-ID: Subject: Re: [PATCH 1/2] iomap: Add a page_prepare callback To: Jan Kara Cc: cluster-devel , Christoph Hellwig , Bob Peterson , Dave Chinner , Ross Lagerwall , Mark Syms , =?UTF-8?B?RWR3aW4gVMO2csO2aw==?= , linux-fsdevel , linux-mm@kvack.org Content-Type: text/plain; charset="UTF-8" Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Thu, 25 Apr 2019 at 10:32, Jan Kara wrote: > On Wed 24-04-19 19:18:03, Andreas Gruenbacher wrote: > > Add a page_prepare calback that's called before a page is written to. This > > will be used by gfs2 to start a transaction in page_prepare and end it in > > page_done. Other filesystems that implement data journaling will require the > > same kind of mechanism. > > > > Signed-off-by: Andreas Gruenbacher > > Thanks for the patch. Some comments below. > > > diff --git a/fs/iomap.c b/fs/iomap.c > > index 97cb9d486a7d..abd9aa76dbd1 100644 > > --- a/fs/iomap.c > > +++ b/fs/iomap.c > > @@ -684,6 +684,10 @@ iomap_write_begin(struct inode *inode, loff_t pos, unsigned len, unsigned flags, > > status = __block_write_begin_int(page, pos, len, NULL, iomap); > > else > > status = __iomap_write_begin(inode, pos, len, page, iomap); > > + > > + if (likely(!status) && iomap->page_prepare) > > + status = iomap->page_prepare(inode, pos, len, page, iomap); > > + > > if (unlikely(status)) { > > unlock_page(page); > > put_page(page); > > So this gets called after a page is locked. Is it OK for GFS2 to acquire > sd_log_flush_lock under page lock? Because e.g. gfs2_write_jdata_pagevec() > seems to acquire these locks the other way around so that could cause ABBA > deadlocks? Good catch, the callback indeed needs to happen earlier. Thanks, Andreas