Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp1878804ybc; Wed, 20 Nov 2019 05:37:22 -0800 (PST) X-Google-Smtp-Source: APXvYqz5bWTfk6jDMiAunGjPvl9sRn7EFTmJJsUz6l+U9tko6+bVRachwLBSpozOXeR5k4iDAowy X-Received: by 2002:a1c:16:: with SMTP id 22mr3455223wma.0.1574257042682; Wed, 20 Nov 2019 05:37:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574257042; cv=none; d=google.com; s=arc-20160816; b=juRc60pTHg2NWbZUmrw9qR9CwIYlnOBe8WKtOu8N4PvHuOr5OhVXB8hMKYi+EuFOeD FUMHvkPvmpOLyYSA5F7teqlZ2F71nBI+MTBeKjx2klHa8HBiolhADs8CoVlYG6Sqm+iz 7CAH0YYQ4GshWLBoAwHGs8fcpGZQ1vhIASFAxkYiDSyd9hmKPIxzs7I2ZJjCBsb2R7Wt zT7a7Df5MPkPVVf2i12Uu7k1t33Uy7LX8l165IfR83Z7UZ/XzNZI+T9wZGswa7VLiLL/ WqUgRK60+nVEphxhoErndu1Yv0hWj3j5FbldS/ZW1iuwhHR0oGTZYupVZevExXq5QDsF WPzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=zyp196riBzOfnorPGoQhFik6EAtJVduvMwEys4g7XC0=; b=OkhJg/bJOQweQZq9MsS3TaShrJ7r8S/E9T9XXwBwFRv+uh2mMHo2v2v7E2boZR7Wb+ KxE8vXObqVxBVT9r6iDw2HRDuN8Od8jUl2Eo/fSffejmnu17YZrloocp8Vb2nMjzI597 EPrY2nWkrtNtdZ6WHx/g+az9yBCnlwviFxF1/zvnCQaPpyJ7d+TnsiV1oKuMxkMKsJYe GSxSk7ZeoK9RfwGlAvRUdC4UQqevBT1LGFGSBiQ2b1WtZV8tkxBx/Ig+a9h8Du7mM/WM aU8T3EzvO8x568KmG+FQq2SnHCi05vmNNb31sH7u3vHhT23DgH98azgf/A927qNu0k8d VSZw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n29si19759143edb.220.2019.11.20.05.36.57; Wed, 20 Nov 2019 05:37:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729854AbfKTMvS (ORCPT + 99 others); Wed, 20 Nov 2019 07:51:18 -0500 Received: from mx2.suse.de ([195.135.220.15]:38560 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729820AbfKTMvS (ORCPT ); Wed, 20 Nov 2019 07:51:18 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id A57F9B3B6; Wed, 20 Nov 2019 12:51:16 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 4E5B81E484C; Wed, 20 Nov 2019 13:51:16 +0100 (CET) Date: Wed, 20 Nov 2019 13:51:16 +0100 From: Jan Kara To: Ritesh Harjani Cc: jack@suse.cz, tytso@mit.edu, linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, mbobrowski@mbobrowski.org Subject: Re: [RFCv3 1/4] ext4: fix ext4_dax_read/write inode locking sequence for IOCB_NOWAIT Message-ID: <20191120125116.GB9509@quack2.suse.cz> References: <20191120050024.11161-1-riteshh@linux.ibm.com> <20191120050024.11161-2-riteshh@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191120050024.11161-2-riteshh@linux.ibm.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Wed 20-11-19 10:30:21, Ritesh Harjani wrote: > Apparently our current rwsem code doesn't like doing the trylock, then > lock for real scheme. So change our dax read/write methods to just do the > trylock for the RWF_NOWAIT case. > This seems to fix AIM7 regression in some scalable filesystems upto ~25% > in some cases. Claimed in commit 942491c9e6d6 ("xfs: fix AIM7 regression") > > Signed-off-by: Ritesh Harjani Looks good to me. You can add: Reviewed-by: Jan Kara Honza > --- > fs/ext4/file.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/fs/ext4/file.c b/fs/ext4/file.c > index 6a7293a5cda2..977ac58dc718 100644 > --- a/fs/ext4/file.c > +++ b/fs/ext4/file.c > @@ -88,9 +88,10 @@ static ssize_t ext4_dax_read_iter(struct kiocb *iocb, struct iov_iter *to) > struct inode *inode = file_inode(iocb->ki_filp); > ssize_t ret; > > - if (!inode_trylock_shared(inode)) { > - if (iocb->ki_flags & IOCB_NOWAIT) > + if (iocb->ki_flags & IOCB_NOWAIT) { > + if (!inode_trylock_shared(inode)) > return -EAGAIN; > + } else { > inode_lock_shared(inode); > } > /* > @@ -487,9 +488,10 @@ ext4_dax_write_iter(struct kiocb *iocb, struct iov_iter *from) > bool extend = false; > struct inode *inode = file_inode(iocb->ki_filp); > > - if (!inode_trylock(inode)) { > - if (iocb->ki_flags & IOCB_NOWAIT) > + if (iocb->ki_flags & IOCB_NOWAIT) { > + if (!inode_trylock(inode)) > return -EAGAIN; > + } else { > inode_lock(inode); > } > > -- > 2.21.0 > -- Jan Kara SUSE Labs, CR