Received: by 2002:a05:6a10:144:0:0:0:0 with SMTP id 4csp39502pxw; Thu, 7 Apr 2022 23:56:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxneKwE22C7+W7CXlZdJXE0/MXt+7XQRv9wnD8haCAPrDvFFmlvsIFOCrCtadEg/pCkxebW X-Received: by 2002:a63:4405:0:b0:382:173c:1b97 with SMTP id r5-20020a634405000000b00382173c1b97mr14255437pga.532.1649400974209; Thu, 07 Apr 2022 23:56:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649400974; cv=none; d=google.com; s=arc-20160816; b=tb3HD4rz4SnchGAgwg4c6Qlksx5X/4lguDb++x7mSUwX6Nhd7D7gLg4/J4wXlIC+l6 OgA84npK4hPX8BlrPo3OpnPeDuICFxIatf8iQpaUNGDuZNVibF3jbS7hDiZg0XZKycNG jCAvfigVZsqjZZVNxMtCh4MVxFCnfCeHz4Pni5PsWl6HeyGCJa0Y6LrsN2R5K/5V64Qq 9EZlzkEkwlaCaLPIhaFuDgzyl9MX9cTCMoINlfyIgA0+TKdmq96UOSQXFcJxeT3S/VAQ dEgjB0YPON4VmAi2FxIaGeAEEAM3tzHcC/2VYh4xgs72EHT5/TDL6BE6OQWDlI31nsae NhIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=gpTt04knjFi7/r4rdhBFpeWlnWTTiUe1d93mQq2Do3I=; b=YfW4JvmeptCroZVi49o6RchWYDRDx4twwXWIGTqmUrE874fB6B/6/V4pEAwOwcvyZ/ XG244q1CDAOKZnMUWuY/ko+sOXVjG0z3QUVf8YUwX4lQYSY2ltxZJh8VZP6AggtcW0Zh q+gDLwPq/NWhcSoppDDcQyqMz+kib9U1RBgARj4eJ9eXTAklBeXresHBuMlEai6ymCg2 8hU3xZ/TpPZC7XjEKtVSuBbzdRMJmhsuyE5gJyTJUnbGTGbMd/SkF6PjNdDSbmr6Chs/ iAq1zCGJMKbmVqtsogi3OEqKjdHLxftrgOJc+uzRSD8qyMESTjemmNsL9X4aTHJtTMXy p5dQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20210112.gappssmtp.com header.s=20210112 header.b=MAz6RPib; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id l15-20020a170902f68f00b00153b2d164a5si116882plg.173.2022.04.07.23.56.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Apr 2022 23:56:14 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@intel-com.20210112.gappssmtp.com header.s=20210112 header.b=MAz6RPib; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C163A185473; Thu, 7 Apr 2022 23:25:52 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232856AbiDHG10 (ORCPT + 99 others); Fri, 8 Apr 2022 02:27:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232371AbiDHG1X (ORCPT ); Fri, 8 Apr 2022 02:27:23 -0400 Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2AB616CE6F for ; Thu, 7 Apr 2022 23:25:17 -0700 (PDT) Received: by mail-pl1-x62a.google.com with SMTP id l9so636874plg.9 for ; Thu, 07 Apr 2022 23:25:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=gpTt04knjFi7/r4rdhBFpeWlnWTTiUe1d93mQq2Do3I=; b=MAz6RPib3bcwbnw7VOzDKsX4M+0+QU+QgCQSRlXjmf8Y1j5E82C3MrTGAgpPQP7x2/ 7b9XV/2KcaXsvw+GrapP/fImELYl5GNzN9cbv9exuPksDfOeysAV7CzrjAFcCFLdpyD4 cv20aVQbMuVGhrrBsMZl3Y8jzXtJorYiwaZ6s95JJpE0/CNVsbKtdGQ2lozCaCX2Z2jj aCCws8x6/Q4nlxvNHMQu8EzHC848KqfeK37XWl/JO83aKLXIaLW6At4fR5a2AYuvw90o YBWxQySI3dDSIpAkhSAUDAIqcG8Am5xjHEv3dQvB8v6T2tmLMTp34RjSYln0W0Mrb2aR fI4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=gpTt04knjFi7/r4rdhBFpeWlnWTTiUe1d93mQq2Do3I=; b=gKPU7ZXNlRHTmI2jEHXksNIpXcx4hBRx0rYyHLWUgQqRizKyOmnOVhuUlEw4ETnBo4 V3RPST2/JBrbpYirbFoQWd7nfW0hxwce4jxnugSuc1khC9s/95UiqRw97pfzASfXI/da avjrjoglIvrkGli3o7UL7l8GpjBFsAB0BVlci6pVVa/H2gq8Acv+sobiKJS+9DWE0Hvo TM96HmAhMHiuywfdM0P1bnvrJMxDVRaA5VVEn/eJgX7f3i00Y0aE64Q4dUrJcMDX4hh8 1KGnV7md/102q9C7h9eCLcQNcdJclPyeOo9I6mzWftonrOPfcem4QIIy2kFXDRjtbpfC qdQQ== X-Gm-Message-State: AOAM531abSNFrmX1qsl6O9REAJLuQMVjiZjsKCeW5oe33Y4SPMCXtD3h vrzD+anPFVKmP3vbhggv0QV0MiHlatInyjudGCrm/Q== X-Received: by 2002:a17:90a:c083:b0:1c6:a164:fd5d with SMTP id o3-20020a17090ac08300b001c6a164fd5dmr20043007pjs.8.1649399116938; Thu, 07 Apr 2022 23:25:16 -0700 (PDT) MIME-Version: 1.0 References: <20220227120747.711169-1-ruansy.fnst@fujitsu.com> <20220227120747.711169-8-ruansy.fnst@fujitsu.com> In-Reply-To: From: Dan Williams Date: Thu, 7 Apr 2022 23:25:06 -0700 Message-ID: Subject: Re: [PATCH v11 7/8] xfs: Implement ->notify_failure() for XFS To: Christoph Hellwig Cc: Shiyang Ruan , Linux Kernel Mailing List , linux-xfs , Linux NVDIMM , Linux MM , linux-fsdevel , "Darrick J. Wong" , david , Jane Chu Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 29, 2022 at 11:01 PM Christoph Hellwig wrote: > > > @@ -1892,6 +1893,8 @@ xfs_free_buftarg( > > list_lru_destroy(&btp->bt_lru); > > > > blkdev_issue_flush(btp->bt_bdev); > > + if (btp->bt_daxdev) > > + dax_unregister_holder(btp->bt_daxdev, btp->bt_mount); > > fs_put_dax(btp->bt_daxdev); > > > > kmem_free(btp); > > @@ -1939,6 +1942,7 @@ xfs_alloc_buftarg( > > struct block_device *bdev) > > { > > xfs_buftarg_t *btp; > > + int error; > > > > btp = kmem_zalloc(sizeof(*btp), KM_NOFS); > > > > @@ -1946,6 +1950,14 @@ xfs_alloc_buftarg( > > btp->bt_dev = bdev->bd_dev; > > btp->bt_bdev = bdev; > > btp->bt_daxdev = fs_dax_get_by_bdev(bdev, &btp->bt_dax_part_off); > > + if (btp->bt_daxdev) { > > + error = dax_register_holder(btp->bt_daxdev, mp, > > + &xfs_dax_holder_operations); > > + if (error) { > > + xfs_err(mp, "DAX device already in use?!"); > > + goto error_free; > > + } > > + } > > It seems to me that just passing the holder and holder ops to > fs_dax_get_by_bdev and the holder to dax_unregister_holder would > significantly simply the interface here. > > Dan, what do you think? Yes, makes sense, just like the optional holder arguments to blkdev_get_by_*(). > > > +#if IS_ENABLED(CONFIG_MEMORY_FAILURE) && IS_ENABLED(CONFIG_FS_DAX) > > No real need for the IS_ENABLED. Also any reason to even build this > file if the options are not set? It seems like > xfs_dax_holder_operations should just be defined to NULL and the > whole file not supported if we can't support the functionality. > > Dan: not for this series, but is there any reason not to require > MEMORY_FAILURE for DAX to start with? Given that DAX ties some storage semantics to memory and storage supports EIO I can see an argument to require memory_failure() for DAX, and especially for DAX on CXL where hotplug is supported it will be necessary. Linux currently has no facility to consult PCI drivers about removal actions, so the only recourse for a force removed CXL device is mass memory_failure(). > > > + > > + ddev_start = mp->m_ddev_targp->bt_dax_part_off; > > + ddev_end = ddev_start + > > + (mp->m_ddev_targp->bt_bdev->bd_nr_sectors << SECTOR_SHIFT) - 1; > > This should use bdev_nr_bytes. > > But didn't we say we don't want to support notifications on partitioned > devices and thus don't actually need all this? Right.