All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: Dave Jiang <dave.jiang@intel.com>
Cc: linux-nvdimm <linux-nvdimm@lists.01.org>
Subject: Re: [PATCH] dax: adding fsync/msync support for device DAX
Date: Wed, 4 Apr 2018 17:03:07 -0700	[thread overview]
Message-ID: <CAPcyv4hZfNOG15guKE0Lq=QoFr8DZerEH=1=OjnrEY2trPXNcw@mail.gmail.com> (raw)
In-Reply-To: <152287929452.28903.15383389230749046740.stgit@djiang5-desk3.ch.intel.com>

Include lkml on the next posting as well.

On Wed, Apr 4, 2018 at 3:01 PM, Dave Jiang <dave.jiang@intel.com> wrote:
> When msync() is called on a device dax region, eventually ops->fsync() is
> called. By providing fsync in the device dax file operations, we can provide
> support for both. nvdimm_flush() for the nd_region is called when msync/fsync
> is called in order to provide deep flush to the user app through standard POSIX
> calls.
>

Lets clarify the justification:

"Currently, fsdax applications can assume that if they call fsync or
msync on a dax mapped file that any pending writes that have been
flushed out of the cpu cache will be also be flushed to the lowest
possible persistence / failure domain available on the platform. In
typical scenarios the platform ADR capability handles marshaling
writes that have reached global visibility to persistence. In
exceptional cases where ADR fails to complete its operation software
can detect that scenario the the "last shutdown" health status check
and otherwise mitigate the effects of an ADR failure by protecting
metadata with the WPQ flush. In other words, enabling device-dax to
optionally trigger WPQ Flush on msync() allows applications to have
common implementation for persistence domain handling across fs-dax
and device-dax."


> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
> ---
>  drivers/dax/dax-private.h |    1 +
>  drivers/dax/device-dax.h  |    2 ++
>  drivers/dax/device.c      |   19 +++++++++++++++++++
>  drivers/dax/pmem.c        |   10 ++++++++++
>  4 files changed, 32 insertions(+)
>
> diff --git a/drivers/dax/dax-private.h b/drivers/dax/dax-private.h
> index b6fc4f04636d..5fc20191c89e 100644
> --- a/drivers/dax/dax-private.h
> +++ b/drivers/dax/dax-private.h
> @@ -35,6 +35,7 @@ struct dax_region {
>         unsigned int align;
>         struct resource res;
>         unsigned long pfn_flags;
> +       void (*sync)(struct device *);
>  };
>
>  /**
> diff --git a/drivers/dax/device-dax.h b/drivers/dax/device-dax.h
> index 688b051750bd..651f2e763058 100644
> --- a/drivers/dax/device-dax.h
> +++ b/drivers/dax/device-dax.h
> @@ -22,4 +22,6 @@ struct dax_region *alloc_dax_region(struct device *parent,
>                 void *addr, unsigned long flags);
>  struct dev_dax *devm_create_dev_dax(struct dax_region *dax_region,
>                 int id, struct resource *res, int count);
> +void dax_set_sync(struct dax_region *dax_region, void (*sync)(struct device *dev));
> +
>  #endif /* __DEVICE_DAX_H__ */
> diff --git a/drivers/dax/device.c b/drivers/dax/device.c
> index 37be5a306c8f..5341760cc987 100644
> --- a/drivers/dax/device.c
> +++ b/drivers/dax/device.c
> @@ -523,6 +523,24 @@ static int dax_release(struct inode *inode, struct file *filp)
>         return 0;
>  }
>
> +void dax_set_sync(struct dax_region *dax_region, void (*sync)(struct device *))
> +{
> +       dax_region->sync = sync;
> +}
> +EXPORT_SYMBOL_GPL(dax_set_sync);

We don't need dax_set_sync(), the dax_pmem driver set up the
dax_region in the first place, it can set the callback at that time.
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

  reply	other threads:[~2018-04-05  0:03 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-04 22:01 [PATCH] dax: adding fsync/msync support for device DAX Dave Jiang
2018-04-05  0:03 ` Dan Williams [this message]
2018-04-05  7:23   ` Christoph Hellwig
2018-04-05  7:56     ` Dan Williams
2018-04-05  8:01       ` Christoph Hellwig
2018-04-05 14:59         ` Jeff Moyer
2018-04-05 15:10           ` Christoph Hellwig
2018-04-05 22:17         ` Dan Williams
2018-04-06  7:03           ` Christoph Hellwig
2018-04-06 22:41             ` Dan Williams
2018-04-09  9:32               ` Christoph Hellwig
2018-04-11 16:06                 ` Jeff Moyer
2018-04-11 16:27                   ` Dan Williams
2018-04-11 17:27                     ` Jeff Moyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAPcyv4hZfNOG15guKE0Lq=QoFr8DZerEH=1=OjnrEY2trPXNcw@mail.gmail.com' \
    --to=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=linux-nvdimm@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.