linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Snitzer <snitzer-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
Cc: Jens Axboe <axboe-b10kYP2dOMg@public.gmane.org>,
	linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	dm-devel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	linux-nvme-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-scsi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 4/6] dm: refactor ioctl handling
Date: Tue, 4 Aug 2015 13:56:16 -0400	[thread overview]
Message-ID: <20150804175616.GA28971@redhat.com> (raw)
In-Reply-To: <1438672271-11309-5-git-send-email-hch-jcswGhMUV9g@public.gmane.org>

On Tue, Aug 04 2015 at  3:11am -0400,
Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org> wrote:

> This moves the call to blkdev_ioctl and the argument checking to core code,
> and only leaves a callout to find the block device to operate on it the
> targets.  This will simplifies the code and will allow us to pass through
> ioctl-like command using other methods in the next patch.
> 
> Signed-off-by: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
...
> diff --git a/drivers/md/dm.c b/drivers/md/dm.c
> index f331d88..c68eb91 100644
> --- a/drivers/md/dm.c
> +++ b/drivers/md/dm.c
> @@ -584,7 +584,17 @@ retry:
>  		goto out;
>  	}
>  
> -	r = tgt->type->ioctl(tgt, cmd, arg);
> +	r = tgt->type->ioctl(tgt, &bdev, &mode);
> +	if (r < 0)
> +		goto out;
> +
> +	if (r > 0) {
> +		r = scsi_verify_blk_ioctl(NULL, cmd);
> +		if (r)
> +			goto out;
> +	}
> +
> +	r =  __blkdev_driver_ioctl(bdev, mode, cmd, arg);
>  
>  out:
>  	dm_put_live_table(md, srcu_idx);
> diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
> index 51cc1de..9b73138 100644
> --- a/include/linux/device-mapper.h
> +++ b/include/linux/device-mapper.h
> @@ -79,8 +79,8 @@ typedef void (*dm_status_fn) (struct dm_target *ti, status_type_t status_type,
>  
>  typedef int (*dm_message_fn) (struct dm_target *ti, unsigned argc, char **argv);
>  
> -typedef int (*dm_ioctl_fn) (struct dm_target *ti, unsigned int cmd,
> -			    unsigned long arg);
> +typedef int (*dm_ioctl_fn) (struct dm_target *ti,
> +			    struct block_device **bdev, fmode_t *mode);
>  
>  typedef int (*dm_merge_fn) (struct dm_target *ti, struct bvec_merge_data *bvm,
>  			    struct bio_vec *biovec, int max_size);

This should be renamed to dm_prepare_ioctl_fn and the targets' hook
would be .prepare_ioctl

Open to other names but if the targets no longer issue the ioctl there
is little point to call it .ioctl

  parent reply	other threads:[~2015-08-04 17:56 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-04  7:11 Persistent Reservation API Christoph Hellwig
2015-08-04  7:11 ` [PATCH 1/6] block: cleanup blkdev_ioctl Christoph Hellwig
     [not found]   ` <1438672271-11309-2-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2015-08-12  0:29     ` Martin K. Petersen
2015-08-04  7:11 ` [PATCH 2/6] block: add a API for persistent reservations Christoph Hellwig
     [not found]   ` <1438672271-11309-3-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2015-08-12  0:45     ` Martin K. Petersen
2015-08-04  7:11 ` [PATCH 3/6] sd: implement the persisten reservation API Christoph Hellwig
     [not found]   ` <1438672271-11309-4-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2015-08-12  0:57     ` Martin K. Petersen
2015-08-04  7:11 ` [PATCH 4/6] dm: refactor ioctl handling Christoph Hellwig
     [not found]   ` <1438672271-11309-5-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2015-08-04 17:56     ` Mike Snitzer [this message]
2015-08-06 13:45       ` Christoph Hellwig
2015-08-04  7:11 ` [PATCH 5/6] dm: split out a helper to find the ioctl target Christoph Hellwig
     [not found]   ` <1438672271-11309-6-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2015-08-04 18:05     ` Mike Snitzer
     [not found]       ` <20150804180558.GB28971-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-08-06 13:45         ` Christoph Hellwig
2015-08-04  7:11 ` [PATCH 6/6] dm: add support for passing through persistent reservations Christoph Hellwig
2015-08-04 17:53 ` Persistent Reservation API Mike Snitzer
2015-08-06 13:44   ` Christoph Hellwig
2015-08-04 18:04 ` Keith Busch
2015-08-06 13:45   ` Christoph Hellwig
  -- strict thread matches above, loose matches on Subject: below --
2015-10-15 12:10 Persistent Reservation API V4 Christoph Hellwig
2015-10-15 12:10 ` [PATCH 4/6] dm: refactor ioctl handling Christoph Hellwig

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=20150804175616.GA28971@redhat.com \
    --to=snitzer-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=axboe-b10kYP2dOMg@public.gmane.org \
    --cc=dm-devel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=hch-jcswGhMUV9g@public.gmane.org \
    --cc=linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-nvme-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-scsi-u79uwXL29TY76Z2rM5mHXA@public.gmane.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).