All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ross Zwisler <ross.zwisler@linux.intel.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>,
	linux-xfs <linux-xfs@vger.kernel.org>,
	linux-nvdimm <linux-nvdimm@lists.01.org>,
	fstests <fstests@vger.kernel.org>, Jan Kara <jack@suse.cz>,
	Dave Chinner <david@fromorbit.com>,
	Dan Williams <dan.j.williams@intel.com>
Subject: Re: [xfsprogs PATCH 1/2] xfs_io: add MAP_SYNC support to mmap()
Date: Fri, 17 Nov 2017 14:44:00 -0700	[thread overview]
Message-ID: <20171117214400.GB3910@linux.intel.com> (raw)
In-Reply-To: <20171117204021.GO5119@magnolia>

On Fri, Nov 17, 2017 at 12:40:21PM -0800, Darrick J. Wong wrote:
> On Fri, Nov 17, 2017 at 01:25:23PM -0700, Ross Zwisler wrote:
> > Add support for a new -S flag to xfs_io's mmap command.  This opens the
> > mapping with the (MAP_SYNC | MAP_SHARED_VALIDATE) flags instead of the
> > standard MAP_SHARED flag.
> > 
> > Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
> > Suggested-by: Dave Chinner <david@fromorbit.com>
> > ---
<>
> > diff --git a/include/linux.h b/include/linux.h
> > index 6ce344c..4ee03ed 100644
> > --- a/include/linux.h
> > +++ b/include/linux.h
> > @@ -327,4 +327,9 @@ fsmap_advance(
> >  #define HAVE_GETFSMAP
> >  #endif /* HAVE_GETFSMAP */
> >  
> > +#ifndef HAVE_MAP_SYNC
> > +#define MAP_SYNC 0x80000
> > +#define MAP_SHARED_VALIDATE 0x3
> > +#endif /* HAVE_MAP_SYNC */
> 
> Hmm, what's the point of ifndef/define if you have an configure.ac check?

I'm following the example of HAVE_GETFSMAP.  It does a check to see if the
headers have proper support in m4/package_libcdev.m4, then has code in this
file to provide defines if they aren't provided in the system.

> > diff --git a/io/mmap.c b/io/mmap.c
> > index 7a8150e..520b037 100644
> > --- a/io/mmap.c
> > +++ b/io/mmap.c
> > @@ -42,7 +42,7 @@ print_mapping(
> >  	int		index,
> >  	int		braces)
> >  {
> > -	unsigned char	buffer[8] = { 0 };
> > +	char		buffer[8] = { 0 };
> >  	int		i;
> >  
> >  	static struct {
> > @@ -57,6 +57,10 @@ print_mapping(
> >  
> >  	for (i = 0, p = pflags; p->prot != PROT_NONE; i++, p++)
> >  		buffer[i] = (map->prot & p->prot) ? p->mode : '-';
> > +
> > +	if (map->map_sync)
> > +		sprintf(&buffer[i], " S");
> 
> Does buffer need enlarging here?

Nope.  The buffer is 8 chars, and the 'rwx\0' string only uses 4.
"rwx S\0" uses 6, so we're still good to go.

WARNING: multiple messages have this Message-ID (diff)
From: Ross Zwisler <ross.zwisler@linux.intel.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: Jan Kara <jack@suse.cz>, linux-nvdimm <linux-nvdimm@lists.01.org>,
	Dave Chinner <david@fromorbit.com>,
	fstests <fstests@vger.kernel.org>,
	linux-xfs <linux-xfs@vger.kernel.org>
Subject: Re: [xfsprogs PATCH 1/2] xfs_io: add MAP_SYNC support to mmap()
Date: Fri, 17 Nov 2017 14:44:00 -0700	[thread overview]
Message-ID: <20171117214400.GB3910@linux.intel.com> (raw)
In-Reply-To: <20171117204021.GO5119@magnolia>

On Fri, Nov 17, 2017 at 12:40:21PM -0800, Darrick J. Wong wrote:
> On Fri, Nov 17, 2017 at 01:25:23PM -0700, Ross Zwisler wrote:
> > Add support for a new -S flag to xfs_io's mmap command.  This opens the
> > mapping with the (MAP_SYNC | MAP_SHARED_VALIDATE) flags instead of the
> > standard MAP_SHARED flag.
> > 
> > Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
> > Suggested-by: Dave Chinner <david@fromorbit.com>
> > ---
<>
> > diff --git a/include/linux.h b/include/linux.h
> > index 6ce344c..4ee03ed 100644
> > --- a/include/linux.h
> > +++ b/include/linux.h
> > @@ -327,4 +327,9 @@ fsmap_advance(
> >  #define HAVE_GETFSMAP
> >  #endif /* HAVE_GETFSMAP */
> >  
> > +#ifndef HAVE_MAP_SYNC
> > +#define MAP_SYNC 0x80000
> > +#define MAP_SHARED_VALIDATE 0x3
> > +#endif /* HAVE_MAP_SYNC */
> 
> Hmm, what's the point of ifndef/define if you have an configure.ac check?

I'm following the example of HAVE_GETFSMAP.  It does a check to see if the
headers have proper support in m4/package_libcdev.m4, then has code in this
file to provide defines if they aren't provided in the system.

> > diff --git a/io/mmap.c b/io/mmap.c
> > index 7a8150e..520b037 100644
> > --- a/io/mmap.c
> > +++ b/io/mmap.c
> > @@ -42,7 +42,7 @@ print_mapping(
> >  	int		index,
> >  	int		braces)
> >  {
> > -	unsigned char	buffer[8] = { 0 };
> > +	char		buffer[8] = { 0 };
> >  	int		i;
> >  
> >  	static struct {
> > @@ -57,6 +57,10 @@ print_mapping(
> >  
> >  	for (i = 0, p = pflags; p->prot != PROT_NONE; i++, p++)
> >  		buffer[i] = (map->prot & p->prot) ? p->mode : '-';
> > +
> > +	if (map->map_sync)
> > +		sprintf(&buffer[i], " S");
> 
> Does buffer need enlarging here?

Nope.  The buffer is 8 chars, and the 'rwx\0' string only uses 4.
"rwx S\0" uses 6, so we're still good to go.
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

  reply	other threads:[~2017-11-17 21:44 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-17 20:25 [xfsprogs PATCH 0/2] Add necessary items for MAP_SYNC testing Ross Zwisler
2017-11-17 20:25 ` Ross Zwisler
2017-11-17 20:25 ` [xfsprogs PATCH 1/2] xfs_io: add MAP_SYNC support to mmap() Ross Zwisler
2017-11-17 20:25   ` Ross Zwisler
2017-11-17 20:35   ` Dan Williams
2017-11-17 20:35     ` Dan Williams
2017-11-17 21:33     ` Ross Zwisler
2017-11-17 21:33       ` Ross Zwisler
2017-11-17 20:40   ` Darrick J. Wong
2017-11-17 20:40     ` Darrick J. Wong
2017-11-17 21:44     ` Ross Zwisler [this message]
2017-11-17 21:44       ` Ross Zwisler
2017-11-17 20:25 ` [xfsprogs PATCH 2/2] xfs_io: add a new 'log_writes' command Ross Zwisler
2017-11-17 20:25   ` Ross Zwisler
2017-11-17 20:39   ` Eric Sandeen
2017-11-17 20:39     ` Eric Sandeen
2017-11-17 20:48     ` Ross Zwisler
2017-11-17 20:48       ` Ross Zwisler
2017-11-17 21:03       ` Eric Sandeen
2017-11-17 21:03         ` Eric Sandeen
2017-11-17 21:14         ` Ross Zwisler
2017-11-17 21:14           ` Ross Zwisler
2017-11-18  4:44           ` Eric Sandeen
2017-11-18  4:44             ` Eric Sandeen
2017-11-17 20:44   ` Darrick J. Wong
2017-11-17 20:44     ` Darrick J. Wong

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=20171117214400.GB3910@linux.intel.com \
    --to=ross.zwisler@linux.intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=darrick.wong@oracle.com \
    --cc=david@fromorbit.com \
    --cc=fstests@vger.kernel.org \
    --cc=jack@suse.cz \
    --cc=linux-nvdimm@lists.01.org \
    --cc=linux-xfs@vger.kernel.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.