From patchwork Tue Jan 8 19:34:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 10752787 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9775D746 for ; Tue, 8 Jan 2019 19:47:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 868E128F4A for ; Tue, 8 Jan 2019 19:47:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7AA5628FB8; Tue, 8 Jan 2019 19:47:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8979928F4A for ; Tue, 8 Jan 2019 19:46:58 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 9A64E211B1F91; Tue, 8 Jan 2019 11:46:57 -0800 (PST) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.115; helo=mga14.intel.com; envelope-from=dan.j.williams@intel.com; receiver=linux-nvdimm@lists.01.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 0C145211A322C for ; Tue, 8 Jan 2019 11:46:56 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Jan 2019 11:46:56 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,455,1539673200"; d="scan'208";a="125295354" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.16]) by orsmga001.jf.intel.com with ESMTP; 08 Jan 2019 11:46:56 -0800 Subject: [fio PATCH] engines/devdax: Make detection of device-dax instances more robust From: Dan Williams To: axboe@kernel.dk Date: Tue, 08 Jan 2019 11:34:19 -0800 Message-ID: <154697605958.939406.14480036379705502215.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.18-2-gc94f MIME-Version: 1.0 X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fio@vger.kernel.org, linux-nvdimm@lists.01.org Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP In preparation for the kernel switching device-dax instances from the "/sys/class/dax" subsystem to "/sys/bus/dax" [1], teach the device-dax instance detection to be subsystem-type agnostic. Note that the subsystem switch will require an administrator, or distro opt-in. The opt-in will either be at kernel compile time by disabling the default compatibility driver in the kernel, or at runtime with a modprobe policy to override which kernel module service device-dax devices. The daxctl utility [2] will ship a command to install the modprobe policy and include a man page that lists the potential regression risk to older FIO and other userspace tools that are hard coded to "/sys/class/dax". [1]: https://lwn.net/Articles/770128/ [2]: https://github.com/pmem/ndctl/tree/master/daxctl Reported-by: Jeff Moyer Signed-off-by: Dan Williams --- engines/dev-dax.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/engines/dev-dax.c b/engines/dev-dax.c index 0660bba563e6..422ea634ff1d 100644 --- a/engines/dev-dax.c +++ b/engines/dev-dax.c @@ -259,7 +259,7 @@ fio_devdax_get_file_size(struct thread_data *td, struct fio_file *f) { char spath[PATH_MAX]; char npath[PATH_MAX]; - char *rpath; + char *rpath, *basename; FILE *sfile; uint64_t size; struct stat st; @@ -289,7 +289,8 @@ fio_devdax_get_file_size(struct thread_data *td, struct fio_file *f) } /* check if DAX device */ - if (strcmp("/sys/class/dax", rpath)) { + basename = strrchr(rpath, '/'); + if (!basename || strcmp("dax", basename+1)) { log_err("%s: %s not a DAX device!\n", td->o.name, f->file_name); }