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=-8.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=unavailable 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 3FD4DC33CB6 for ; Thu, 16 Jan 2020 09:24:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1536C2073A for ; Thu, 16 Jan 2020 09:24:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730635AbgAPJYt (ORCPT ); Thu, 16 Jan 2020 04:24:49 -0500 Received: from mx2.suse.de ([195.135.220.15]:55526 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726684AbgAPJYt (ORCPT ); Thu, 16 Jan 2020 04:24:49 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id BEE2FAE95; Thu, 16 Jan 2020 09:24:46 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 517A11E0CBC; Thu, 16 Jan 2020 10:24:46 +0100 (CET) Date: Thu, 16 Jan 2020 10:24:46 +0100 From: Jan Kara To: ira.weiny@intel.com Cc: linux-kernel@vger.kernel.org, Alexander Viro , "Darrick J. Wong" , Dan Williams , Dave Chinner , Christoph Hellwig , "Theodore Y. Ts'o" , Jan Kara , linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [RFC PATCH V2 08/12] fs/xfs: Add lock/unlock mode to xfs Message-ID: <20200116092446.GA8446@quack2.suse.cz> References: <20200110192942.25021-1-ira.weiny@intel.com> <20200110192942.25021-9-ira.weiny@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200110192942.25021-9-ira.weiny@intel.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 10-01-20 11:29:38, ira.weiny@intel.com wrote: > From: Ira Weiny > > XFS requires regular files to be locked while changing to/from DAX mode. > > Define a new DAX lock type and implement the [un]lock_mode() inode > operation callbacks. > > We define a new XFS_DAX_* lock type to carry the lock through the > transaction because we don't want to use IOLOCK as that would cause > performance issues with locking of the inode itself. > > Signed-off-by: Ira Weiny ... > diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h > index 492e53992fa9..693ca66bd89b 100644 > --- a/fs/xfs/xfs_inode.h > +++ b/fs/xfs/xfs_inode.h > @@ -67,6 +67,9 @@ typedef struct xfs_inode { > spinlock_t i_ioend_lock; > struct work_struct i_ioend_work; > struct list_head i_ioend_list; > + > + /* protect changing the mode to/from DAX */ > + struct percpu_rw_semaphore i_dax_sem; > } xfs_inode_t; This adds overhead of ~32k per inode for typical distro kernel. That's not going to fly. That's why ext4 has similar kind of lock in the superblock shared by all inodes. For read side it does not matter because that's per-cpu and shared lock. For write side we don't care as changing inode access mode should be rare. Honza -- Jan Kara SUSE Labs, CR