Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1015844yba; Wed, 15 May 2019 14:09:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqx6n+MCMsHfyasK9i1T44bvRovrb+2v06KpcfTe3sEPZ103lSCBrpG5CxT3bmkwJMvl0cby X-Received: by 2002:a63:fc08:: with SMTP id j8mr46266941pgi.432.1557954552830; Wed, 15 May 2019 14:09:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557954552; cv=none; d=google.com; s=arc-20160816; b=KIVTvnF98p5GKM2gD4ivlwpoCH/9ejNvQitzZu6MIgyw/CB17xclf4sBIczrHnrwrZ PTXKlSOk6yXENsZ4nDT3Rco9ubC8ddqYzNNUJ8O0huHXYW6JFersp0duVfedkZPrLSUL J6hBOKJmNqIJt3PNNqfT6KVBrO4HtFUqWfgFazWYzhsba1qpLbes9r8+tsYYl8ak/IOe kNDykMCMmPm1TIQ3R76FwH/s3PdOQDdTc2q+Ily8uRYFXZDfrqeLw0Hkm9yd+irsTJnC RiHQca8JpGPxAypBsh91iRJJEywx/jxUH0p7PGxAnTQbDXzPGOmZK+K3gjQhcf1nK/Ik Prng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=zEAiaEFTDEo5AHTXNi1igG//m3yl73MYATUt/TyQM/s=; b=ARTM1BwL9jOmxdn5p4RmctyhD8Tx8gLL2Vd1uBHwG2NTozza3U4xZ4ukch4f+9pCDr DbWj3wQFZrm/3B1TxKrdFrPfyjZY523U2jpPT79Ra7LHGBKce9KvieaH1tKptv/6bYn1 dkfIJHd9fUFXBNdFDQRGJ8YjBEaTdFc4PgU+xAIBlchSRDxwvZVU57ps0ltwhxNWeXNC F7IrILGghxC6nF6Q4EXHl4q+eSx9aqSA799HhIh08uWUIrSltGuw9eqjOnIcBqlBJTu+ HQb6A8jWRk1NRyeaZOn5dttqwUL/l7fIX552DMrNBTtLSAsRpGe5GUbziK2IU1Mcz7rd aWLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=JldDYW+L; 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 o11si2564918plk.413.2019.05.15.14.08.55; Wed, 15 May 2019 14:09:12 -0700 (PDT) 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; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=JldDYW+L; 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 S1726913AbfEOVHh (ORCPT + 99 others); Wed, 15 May 2019 17:07:37 -0400 Received: from mail-ot1-f67.google.com ([209.85.210.67]:35600 "EHLO mail-ot1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726780AbfEOVHh (ORCPT ); Wed, 15 May 2019 17:07:37 -0400 Received: by mail-ot1-f67.google.com with SMTP id n14so1425053otk.2 for ; Wed, 15 May 2019 14:07:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=zEAiaEFTDEo5AHTXNi1igG//m3yl73MYATUt/TyQM/s=; b=JldDYW+LTAR5BoMmvzt3GhFBKSNFCQljO95A7CQF8h7lezT59wkCmoZR8HlZNeo3ZX ACz18is11PqZLJkpbZTbPrVApVsXuwCwQzpumDKhMYUGYyeEKSs4shc89Funjj7rmnrR zPCblVOMVW4B/FdfDdDBm0eQtlDpcEoDreFJYHB2TrhXh9porw+VCF0gkgtOPIdPF4AY hPK/m0cAXNVhKubNUJt+B+Ge41ks183CJ7yggGXayFgFqQhy+nfr59BSRoNiAIUor77P UmqXqpMAHdjAUWsPGhNLbi9iUpZ9FsKZwds3Nd3zmasJxQ+15Rm38l4yGAgNrmpf7grH OFBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=zEAiaEFTDEo5AHTXNi1igG//m3yl73MYATUt/TyQM/s=; b=UseWMYJQUEB6toXTAMuA7z3SOUxYIBtI95vrQYM4sjc49HFjE6jICE2A1dj8QDXAiD huVk6kszqHDALcd5GAcxqNKwZvg+lvTPDkSTCJ4DXBLPPYKG+XsP6VwS6ogtD/Yb0rrL 5gSE16cybEmmqMemmPW3l/uJG8O4ktLrDjI6CK/kh+4Amhan/LkqTyowe9i+mynHpCNG 2fPs7nfBpFtcVQh/8KeiIVS53yCdEmOS509xcdmMIJhMDBUOMuPbxMEueflGwDat2WcV eN3zczAMr1VbbM6uaLCq40nU7FjMDK0sUXCBd+vvFWNM3kT9pDdBBcBwTB0B7Pid95Xv dy4Q== X-Gm-Message-State: APjAAAUnoihbBzjXIxmLHwpBudJr8nYIVnhI3lnANBDBtYzXV22PYu2p yotKA1qH24MVNXZm1tzvklXD/YLeV1l+Aui6MlaVSQ== X-Received: by 2002:a05:6830:14d3:: with SMTP id t19mr27993804otq.57.1557954454945; Wed, 15 May 2019 14:07:34 -0700 (PDT) MIME-Version: 1.0 References: <20190514145422.16923-1-pagupta@redhat.com> <20190514145422.16923-2-pagupta@redhat.com> In-Reply-To: <20190514145422.16923-2-pagupta@redhat.com> From: Dan Williams Date: Wed, 15 May 2019 14:07:23 -0700 Message-ID: Subject: Re: [PATCH v9 1/7] libnvdimm: nd_region flush callback support To: Pankaj Gupta Cc: linux-nvdimm , Linux Kernel Mailing List , virtualization@lists.linux-foundation.org, KVM list , linux-fsdevel , Linux ACPI , Qemu Developers , linux-ext4 , linux-xfs , Ross Zwisler , Vishal L Verma , Dave Jiang , "Michael S. Tsirkin" , Jason Wang , Matthew Wilcox , "Rafael J. Wysocki" , Christoph Hellwig , Len Brown , Jan Kara , "Theodore Ts'o" , Andreas Dilger , "Darrick J. Wong" , lcapitulino@redhat.com, Kevin Wolf , Igor Mammedov , jmoyer , Nitesh Narayan Lal , Rik van Riel , Stefan Hajnoczi , Andrea Arcangeli , David Hildenbrand , david , cohuck@redhat.com, Xiao Guangrong , Paolo Bonzini , Adam Borowski , yuval shaia , jstaron@google.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Tue, May 14, 2019 at 7:55 AM Pankaj Gupta wrote: > > This patch adds functionality to perform flush from guest > to host over VIRTIO. We are registering a callback based > on 'nd_region' type. virtio_pmem driver requires this special > flush function. For rest of the region types we are registering > existing flush function. Report error returned by host fsync > failure to userspace. > > Signed-off-by: Pankaj Gupta > --- > drivers/acpi/nfit/core.c | 4 ++-- > drivers/nvdimm/claim.c | 6 ++++-- > drivers/nvdimm/nd.h | 1 + > drivers/nvdimm/pmem.c | 13 ++++++++----- > drivers/nvdimm/region_devs.c | 26 ++++++++++++++++++++++++-- > include/linux/libnvdimm.h | 8 +++++++- > 6 files changed, 46 insertions(+), 12 deletions(-) > > diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c > index 5a389a4f4f65..08dde76cf459 100644 > --- a/drivers/acpi/nfit/core.c > +++ b/drivers/acpi/nfit/core.c > @@ -2434,7 +2434,7 @@ static void write_blk_ctl(struct nfit_blk *nfit_blk= , unsigned int bw, > offset =3D to_interleave_offset(offset, mmio); > > writeq(cmd, mmio->addr.base + offset); > - nvdimm_flush(nfit_blk->nd_region); > + nvdimm_flush(nfit_blk->nd_region, NULL); > > if (nfit_blk->dimm_flags & NFIT_BLK_DCR_LATCH) > readq(mmio->addr.base + offset); > @@ -2483,7 +2483,7 @@ static int acpi_nfit_blk_single_io(struct nfit_blk = *nfit_blk, > } > > if (rw) > - nvdimm_flush(nfit_blk->nd_region); > + nvdimm_flush(nfit_blk->nd_region, NULL); > > rc =3D read_blk_stat(nfit_blk, lane) ? -EIO : 0; > return rc; > diff --git a/drivers/nvdimm/claim.c b/drivers/nvdimm/claim.c > index fb667bf469c7..13510bae1e6f 100644 > --- a/drivers/nvdimm/claim.c > +++ b/drivers/nvdimm/claim.c > @@ -263,7 +263,7 @@ static int nsio_rw_bytes(struct nd_namespace_common *= ndns, > struct nd_namespace_io *nsio =3D to_nd_namespace_io(&ndns->dev); > unsigned int sz_align =3D ALIGN(size + (offset & (512 - 1)), 512)= ; > sector_t sector =3D offset >> 9; > - int rc =3D 0; > + int rc =3D 0, ret =3D 0; > > if (unlikely(!size)) > return 0; > @@ -301,7 +301,9 @@ static int nsio_rw_bytes(struct nd_namespace_common *= ndns, > } > > memcpy_flushcache(nsio->addr + offset, buf, size); > - nvdimm_flush(to_nd_region(ndns->dev.parent)); > + ret =3D nvdimm_flush(to_nd_region(ndns->dev.parent), NULL); > + if (ret) > + rc =3D ret; > > return rc; > } > diff --git a/drivers/nvdimm/nd.h b/drivers/nvdimm/nd.h > index a5ac3b240293..0c74d2428bd7 100644 > --- a/drivers/nvdimm/nd.h > +++ b/drivers/nvdimm/nd.h > @@ -159,6 +159,7 @@ struct nd_region { > struct badblocks bb; > struct nd_interleave_set *nd_set; > struct nd_percpu_lane __percpu *lane; > + int (*flush)(struct nd_region *nd_region, struct bio *bio); So this triggers: In file included from drivers/nvdimm/e820.c:7: ./include/linux/libnvdimm.h:140:51: warning: =E2=80=98struct bio=E2=80=99 d= eclared inside parameter list will not be visible outside of this definition or declaration int (*flush)(struct nd_region *nd_region, struct bio *bio); ^~~ I was already feeling uneasy about trying to squeeze this into v5.2, but this warning and the continued drip of comments leads me to conclude that this driver would do well to wait one more development cycle. Lets close out the final fixups and let this driver soak in -next. Then for the v5.3 cycle I'll redouble my efforts towards the goal of closing patch acceptance at the -rc6 / -rc7 development milestone.