mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Randy Dunlap <rdunlap@xenotime.net>
To: Matthew Wilcox <willy@linux.intel.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [REVIEW] NVM Express driver
Date: Thu, 3 Mar 2011 13:33:43 -0800	[thread overview]
Message-ID: <20110303133343.afc01f8b.rdunlap@xenotime.net> (raw)
In-Reply-To: <20110303204749.GY3663@linux.intel.com>

On Thu, 3 Mar 2011 15:47:49 -0500 Matthew Wilcox wrote:


> diff --git a/drivers/block/nvme.c b/drivers/block/nvme.c
> new file mode 100644
> index 0000000..a8549df
> --- /dev/null
> +++ b/drivers/block/nvme.c
> @@ -0,0 +1,1622 @@
> +/*
> + * NVM Express device driver
> + * Copyright (c) 2011, Intel Corporation.
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms and conditions of the GNU General Public License,
> + * version 2, as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope it will be useful, but WITHOUT
> + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
> + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
> + * more details.
> + *
> + * You should have received a copy of the GNU General Public License along with
> + * this program; if not, write to the Free Software Foundation, Inc.,
> + * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
> + */


> +static int nvme_major;
> +module_param(nvme_major, int, 0);
> +
> +static int use_threaded_interrupts;
> +module_param(use_threaded_interrupts, int, 0);

Please add MODULE_PARM_DESC() for the parameters.


> +/**
> + * alloc_cmdid - Allocate a Command ID
> + * @param nvmeq The queue that will be used for this command
> + * @param ctx A pointer that will be passed to the handler
> + * @param handler The ID of the handler to call
> + *

That's not quite kernel-doc notation, but /** in kernel code signifies
beginning of kernel-doc notation, so please change it to kernel-doc
notation (or drop the /**). [in multiple places]

> + * Allocate a Command ID for a queue.  The data passed in will
> + * be passed to the completion handler.  This is implemented by using
> + * the bottom two bits of the ctx pointer to store the handler ID.
> + * Passing in a pointer that's not 4-byte aligned will cause a BUG.
> + * We can change this if it becomes a problem.
> + */
> +static int alloc_cmdid(struct nvme_queue *nvmeq, void *ctx, int handler,
> +							unsigned timeout)
> +{
> +	int depth = nvmeq->q_depth - 1;
> +	struct nvme_cmd_info *info = nvme_cmd_info(nvmeq);
> +	int cmdid;
> +
> +	BUG_ON((unsigned long)ctx & 3);
> +
> +	do {
> +		cmdid = find_first_zero_bit(nvmeq->cmdid_data, depth);
> +		if (cmdid >= depth)
> +			return -EBUSY;
> +	} while (test_and_set_bit(cmdid, nvmeq->cmdid_data));
> +
> +	info[cmdid].ctx = (unsigned long)ctx | handler;
> +	info[cmdid].timeout = jiffies + timeout;
> +	return cmdid;
> +}
> +
> +static int alloc_cmdid_killable(struct nvme_queue *nvmeq, void *ctx,
> +						int handler, unsigned timeout)
> +{
> +	int cmdid;
> +	wait_event_killable(nvmeq->sq_full,
> +		(cmdid = alloc_cmdid(nvmeq, ctx, handler, timeout)) >= 0);
> +	return (cmdid < 0) ? -EINTR : cmdid;
> +}
> +
> +/* If you need more than four handlers, you'll need to change how
> + * alloc_cmdid and nvme_process_cq work.  Consider using a special
> + * CMD_CTX value instead, if that works for your situation.
> + */

Please use the common multi-line comment format: [in multiple places]

/*
 * If you need more than four handlers, you'll need to change how
 * alloc_cmdid and nvme_process_cq work.  Consider using a special
 * CMD_CTX value instead, if that works for your situation.
 */



---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

  parent reply	other threads:[~2011-03-03 21:33 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-03 20:47 Matthew Wilcox
2011-03-03 21:13 ` Greg KH
2011-03-03 21:41   ` Matthew Wilcox
2011-03-03 21:51     ` Greg KH
2011-03-03 22:07       ` Matthew Wilcox
2011-03-03 22:22         ` Greg KH
2011-03-04  2:25           ` Andy Lutomirski
2011-03-04  9:02             ` el es
2011-03-04 21:29             ` Greg KH
2011-03-04 12:43           ` Alan Cox
2011-03-04 21:28             ` Greg KH
2011-03-04 21:59               ` Alan Cox
2011-03-04 22:10                 ` Greg KH
2011-03-04 22:33                   ` Alan Cox
2011-03-04 23:10                     ` Greg KH
2011-03-05 10:28                       ` Alan Cox
2011-03-04 12:52     ` Mark Brown
2011-03-03 21:33 ` Randy Dunlap [this message]
2011-03-04 13:06 ` Christoph Hellwig
2011-03-04 14:46   ` Matthew Wilcox
2011-03-11 22:29 ` Andi Kleen
2011-03-12  5:51   ` Matthew Wilcox
2011-03-13 17:14     ` Andi Kleen
2011-03-13 18:24 ` Arnd Bergmann

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=20110303133343.afc01f8b.rdunlap@xenotime.net \
    --to=rdunlap@xenotime.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=willy@linux.intel.com \
    /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

all inboxes | Powered by JetHome®