Flexible I/O Tester development
 help / color / mirror / Atom feed
From: Ross Zwisler <ross.zwisler@linux.intel.com>
To: Dave Jiang <dave.jiang@intel.com>
Cc: fio@vger.kernel.org, ross.zwisler@linux.intel.com,
	dan.j.williams@intel.com
Subject: Re: [PATCH] fio: add device dax engine
Date: Wed, 7 Dec 2016 15:47:49 -0700	[thread overview]
Message-ID: <20161207224749.GA23559@linux.intel.com> (raw)
In-Reply-To: <148106914371.151212.12117076560989404157.stgit@djiang5-desk3.ch.intel.com>

On Tue, Dec 06, 2016 at 05:05:43PM -0700, Dave Jiang wrote:
> Adding an ioengine that access DAX device directly. Very similar to the
> mmap engine. Uses the libpmem's pmem_memcpy_persist() call for writes.
> 
> Signed-off-by: Dave Jiang <dave.jiang@intel.com>

With just 2 tiny nits:

Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com>

> +static int fio_devdax_file(struct thread_data *td, struct fio_file *f,
> +			   size_t length, off_t off)
> +{
> +	struct fio_devdax_data *fdd = FILE_ENG_DATA(f);
> +	int flags = 0;
> +
> +	if (td_rw(td))
> +		flags = PROT_READ | PROT_WRITE;
> +	else if (td_write(td)) {
> +		flags = PROT_WRITE;
> +
> +		if (td->o.verify != VERIFY_NONE)
> +			flags |= PROT_READ;
> +	} else
> +		flags = PROT_READ;
> +
> +	fdd->devdax_ptr = mmap(NULL, length, flags, MAP_SHARED, f->fd, off);
> +	if (fdd->devdax_ptr == MAP_FAILED) {
> +		fdd->devdax_ptr = NULL;
> +		td_verror(td, errno, "mmap");
> +		goto err;
> +	}
> +
> +err:

We don't need the 'err' label or the associated goto.  These are needed in the
mmap.c engine, but we can just fall through since we don't have the
posix_madvise() work.

> +	if (td->error && fdd->devdax_ptr)
> +		munmap(fdd->devdax_ptr, length);
> +
> +	return td->error;
> +}
> +
> +/*
> + * Just mmap an appropriate portion, we cannot mmap the full extent
> + */
> +static int fio_devdax_prep_limited(struct thread_data *td, struct io_u *io_u)
> +{
> +	struct fio_file *f = io_u->file;
> +	struct fio_devdax_data *fdd = FILE_ENG_DATA(f);
> +
> +	if (io_u->buflen > f->real_file_size) {
> +		log_err("fio: bs too big for mmap engine\n");
					     dev-dax
> +		return EIO;
> +	}

      reply	other threads:[~2016-12-07 22:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-07  0:05 [PATCH] fio: add device dax engine Dave Jiang
2016-12-07 22:47 ` Ross Zwisler [this message]

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=20161207224749.GA23559@linux.intel.com \
    --to=ross.zwisler@linux.intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=fio@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox