public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <jens.axboe@oracle.com>
To: FUJITA Tomonori <tomof@acm.org>
Cc: linux-scsi@vger.kernel.org, dougg@torque.net
Subject: Re: [PATCH 6/6] bsg: add SG_IO to SG v4
Date: Wed, 20 Dec 2006 11:16:14 +0100	[thread overview]
Message-ID: <20061220101614.GN5010@kernel.dk> (raw)
In-Reply-To: <20061220144313T.fujita.tomonori@lab.ntt.co.jp>

On Wed, Dec 20 2006, FUJITA Tomonori wrote:
> This adds SG_IO support to SG v4.
> 
> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
> ---
>  block/bsg.c |   23 +++++++++++++++++++++--
>  1 files changed, 21 insertions(+), 2 deletions(-)
> 
> diff --git a/block/bsg.c b/block/bsg.c
> index 6d139d2..9dc5d36 100644
> --- a/block/bsg.c
> +++ b/block/bsg.c
> @@ -945,8 +945,27 @@ bsg_ioctl(struct inode *inode, struct fi
>  		void __user *uarg = (void __user *) arg;
>  		return scsi_cmd_ioctl(file, bd->disk, cmd, uarg);
>  	}
> -	case SG_IO:
> -		return -EINVAL;
> +	case SG_IO: {
> +		struct request *rq;
> +		struct bio *bio;
> +		struct sg_io_v4 hdr;
> +
> +		if (copy_from_user(&hdr, uarg, sizeof(hdr)))
> +			return -EFAULT;
> +
> +		rq = bsg_map_hdr(bd, &hdr);
> +		if (IS_ERR(rq))
> +			return PTR_ERR(rq);
> +
> +		bio = rq->bio;

Pointless assignment. In fact the bio can be completely removed.

> +		blk_execute_rq(bd->queue, bd->disk, rq, 0);
> +		blk_complete_sgv4_hdr_rq(rq, &hdr, bio);
> +
> +		if (copy_to_user(uarg, &hdr, sizeof(hdr)))
> +			return -EFAULT;
> +		else
> +			return 0;

Kill the else.

I'll make both changes. Applying your series as-is, and making the
changes I noted in the previous mails.

-- 
Jens Axboe


  reply	other threads:[~2006-12-20 10:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-20  5:43 [PATCH 6/6] bsg: add SG_IO to SG v4 FUJITA Tomonori
2006-12-20 10:16 ` Jens Axboe [this message]
2006-12-20 10:24   ` Jens Axboe

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=20061220101614.GN5010@kernel.dk \
    --to=jens.axboe@oracle.com \
    --cc=dougg@torque.net \
    --cc=linux-scsi@vger.kernel.org \
    --cc=tomof@acm.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