Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp8134024ybl; Thu, 16 Jan 2020 11:13:06 -0800 (PST) X-Google-Smtp-Source: APXvYqw2DKL3L6C+khkqra5MgDzPTiPkgLJcJxhVdxjTLbspqConG1zZLtqQvDuoxJ9qZMS3WrxE X-Received: by 2002:a9d:4e97:: with SMTP id v23mr3056982otk.201.1579201986047; Thu, 16 Jan 2020 11:13:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579201986; cv=none; d=google.com; s=arc-20160816; b=EjFJ800GNkOaJ/0Eui0DRQUIxf0fEEFw4huL2PvY8goI0kUtd/v+DUoPORIR3S54tq DK9yfz1b+EgwM+pZez1bD3i2IET5eyYhld/UZWOztGHqD5DJnaswrrw4V2wl7uBeE4fK Dp1sjRTiozNQ4AgbxRqfiLeZBBkYPEMZlmYP6E3ue+VOWLNUgOLUiRGw4w6KKAfC1X6p alp5GjsxOoB7SG5wmIhSj6PZ3rUem/ZUTagq4VYn99IXWZgcazAyNNTB9YxF7Hvl0mgk m35jnC2jExkU6Z5YSG9JdmMorsr7ii8dwPR7JeLfYC7o8VdwnBenU8Y9nwNIDVpRKs0x LQiQ== 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=8HoQI8SQmSQKX1mMOR/Av2YRifIgJ/2aVWst0rS2lpw=; b=oGfJqP/PThAxGsohnxKTH00ZOPBaNXZ3W4Z8b9rS/Jl+pP1wjd+usjfmhIqCo6tu0H QmMOa9GO5keorCGamqudeJf1dwqh9tHBXgUE374VSHFdAE89f2yj8DxmzbpODskReUdC GtSsZ7Mp6nxbct42W9jrdfNjcPgLdLXpQxJpy3FhErCW60vldeJzRVL0ZxSybsf+iT82 qkOmIbClP3j6zi3BdMIhPJWhsZYsgPf0v3tffSG9tirF+eADjdKO9XDEdg1FrEKf5O7S JmgchF7Z0QK6stPMsnepma8PjM53paMKxfxCuxQxUXjksMhjTBLcZ4lSSl4CblVjstV9 Sj2w== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d17si12096891oib.174.2020.01.16.11.12.53; Thu, 16 Jan 2020 11:13:06 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732785AbgAPTMO (ORCPT + 99 others); Thu, 16 Jan 2020 14:12:14 -0500 Received: from mga05.intel.com ([192.55.52.43]:25859 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387645AbgAPTML (ORCPT ); Thu, 16 Jan 2020 14:12:11 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Jan 2020 11:12:11 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,327,1574150400"; d="scan'208";a="424162125" Received: from iweiny-desk2.sc.intel.com ([10.3.52.157]) by fmsmga005.fm.intel.com with ESMTP; 16 Jan 2020 11:12:11 -0800 Date: Thu, 16 Jan 2020 11:12:10 -0800 From: Ira Weiny To: Jan Kara Cc: linux-kernel@vger.kernel.org, Alexander Viro , "Darrick J. Wong" , Dan Williams , Dave Chinner , Christoph Hellwig , "Theodore Y. Ts'o" , 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: <20200116191210.GG24522@iweiny-DESK2.sc.intel.com> References: <20200110192942.25021-1-ira.weiny@intel.com> <20200110192942.25021-9-ira.weiny@intel.com> <20200116092446.GA8446@quack2.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200116092446.GA8446@quack2.suse.cz> User-Agent: Mutt/1.11.1 (2018-12-01) Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Thu, Jan 16, 2020 at 10:24:46AM +0100, Jan Kara wrote: > 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. Wow! > That's not > going to fly. Probably not... > 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. Sounds reasonable to me. I'll convert it. Thanks for pointing this out, that would have been bad indeed. Ira