linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: Johannes Thumshirn <jthumshirn@suse.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	Ross Zwisler <ross.zwisler@linux.intel.com>,
	Vishal Verma <vishal.l.verma@intel.com>,
	Dave Jiang <dave.jiang@intel.com>, Jeff Moyer <jmoyer@redhat.com>,
	Christoph Hellwig <hch@lst.de>,
	linux-nvdimm <linux-nvdimm@lists.01.org>,
	Linux MM <linux-mm@kvack.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 13/13] libnvdimm, namespace: Publish page structure init state / control
Date: Thu, 5 Jul 2018 12:52:07 -0700	[thread overview]
Message-ID: <CAPcyv4jHG9jCWz_hVc8DPxxALQ2JyD=AJKuYn6-ZMhB_fot1-Q@mail.gmail.com> (raw)
In-Reply-To: <20180705194936.GA28447@bombadil.infradead.org>

On Thu, Jul 5, 2018 at 12:49 PM, Matthew Wilcox <willy@infradead.org> wrote:
> On Thu, Jul 05, 2018 at 07:46:05AM -0700, Dan Williams wrote:
>> On Thu, Jul 5, 2018 at 1:29 AM, Johannes Thumshirn <jthumshirn@suse.de> wrote:
>> > On Wed, Jul 04, 2018 at 11:50:13PM -0700, Dan Williams wrote:
>> >> +static ssize_t memmap_state_store(struct device *dev,
>> >> +             struct device_attribute *attr, const char *buf, size_t len)
>> >> +{
>> >> +     int i;
>> >> +     struct nd_pfn *nd_pfn = to_nd_pfn_safe(dev);
>> >> +     struct memmap_async_state *async = &nd_pfn->async;
>> >> +
>> >> +     if (strcmp(buf, "sync") == 0)
>> >> +             /* pass */;
>> >> +     else if (strcmp(buf, "sync\n") == 0)
>> >> +             /* pass */;
>> >> +     else
>> >> +             return -EINVAL;
>> >
>> > Hmm what about:
>> >
>> >         if (strncmp(buf, "sync", 4))
>> >            return -EINVAL;
>> >
>> > This collapses 6 lines into 4.
>>
>> ...but that also allows 'echo "syncAndThenSomeGarbage" >
>> /sys/.../memmap_state' to succeed.
>
>         if (strncmp(buf, "sync", 4))
>                 return -EINVAL;
>         if (buf[4] != '\0' && buf[4] != '\n')
>                 return -EINVAL;
>

Not sure that's a win either, I'd rather just:

+       if (strcmp(buf, "sync") == 0 || strcmp(buf, "sync\n") == 0)
+               /* pass */;
+       else
+               return -EINVAL;

If we're trying to save those 2 lines.

  reply	other threads:[~2018-07-05 19:52 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-05  6:49 [PATCH 00/13] mm: Asynchronous + multithreaded memmap init for ZONE_DEVICE Dan Williams
2018-07-05  6:49 ` [PATCH 01/13] mm: Plumb dev_pagemap instead of vmem_altmap to memmap_init_zone() Dan Williams
2018-07-05  6:49 ` [PATCH 02/13] mm: Enable asynchronous __add_pages() and vmemmap_populate_hugepages() Dan Williams
2018-07-05  6:49 ` [PATCH 03/13] mm: Teach memmap_init_zone() to initialize ZONE_DEVICE pages Dan Williams
2018-07-05  6:49 ` [PATCH 04/13] mm: Multithread ZONE_DEVICE initialization Dan Williams
2018-07-05  6:49 ` [PATCH 05/13] mm: Allow an external agent to wait for memmap initialization Dan Williams
2018-07-05  6:49 ` [PATCH 06/13] nvdimm/pmem: check the validity of the pointer pfn Dan Williams
2018-07-05  6:49 ` [PATCH 07/13] nvdimm/pmem-dax: " Dan Williams
2018-07-05  6:49 ` [PATCH 08/13] s390/block/dcssblk: " Dan Williams
2018-07-05  6:49 ` [PATCH 09/13] fs/dax: Assign NULL to pfn of dax_direct_access if useless Dan Williams
2018-07-05  6:49 ` [PATCH 10/13] filesystem-dax: Make mount time pfn validation a debug check Dan Williams
2018-07-05  6:50 ` [PATCH 11/13] libnvdimm, pmem: Initialize the memmap in the background Dan Williams
2018-07-05  6:50 ` [PATCH 12/13] device-dax: " Dan Williams
2018-07-05  6:50 ` [PATCH 13/13] libnvdimm, namespace: Publish page structure init state / control Dan Williams
2018-07-05  8:29   ` Johannes Thumshirn
2018-07-05 14:46     ` Dan Williams
2018-07-05 14:49       ` Johannes Thumshirn
2018-07-05 20:24         ` Andrew Morton
2018-07-05 20:34           ` Dan Williams
2018-07-06  8:18             ` Johannes Thumshirn
2018-07-05 21:00           ` Matthew Wilcox
2018-07-05 19:49       ` Matthew Wilcox
2018-07-05 19:52         ` Dan Williams [this message]
2018-07-05 20:00           ` Jeff Moyer
2018-07-09 12:56 ` [PATCH 00/13] mm: Asynchronous + multithreaded memmap init for ZONE_DEVICE Jan Kara
2018-07-09 16:53   ` Dan Williams

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='CAPcyv4jHG9jCWz_hVc8DPxxALQ2JyD=AJKuYn6-ZMhB_fot1-Q@mail.gmail.com' \
    --to=dan.j.williams@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=dave.jiang@intel.com \
    --cc=hch@lst.de \
    --cc=jmoyer@redhat.com \
    --cc=jthumshirn@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-nvdimm@lists.01.org \
    --cc=ross.zwisler@linux.intel.com \
    --cc=vishal.l.verma@intel.com \
    --cc=willy@infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).