Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1200190
| From | Mike Snitzer <snitzer@redhat.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 4/6] dm: refactor ioctl handling |
| Date | 2015-08-04 20:00 +0200 |
| Message-ID | <pTOFk-SZ-11@gated-at.bofh.it> (permalink) |
| References | <pTEFX-3t9-1@gated-at.bofh.it> <pTEFX-3t9-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Tue, Aug 04 2015 at 3:11am -0400,
Christoph Hellwig <hch@lst.de> 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@lst.de>
...
> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Persistent Reservation API Christoph Hellwig <hch@lst.de> - 2015-08-04 09:20 +0200
[PATCH 1/6] block: cleanup blkdev_ioctl Christoph Hellwig <hch@lst.de> - 2015-08-04 09:20 +0200
Re: [PATCH 1/6] block: cleanup blkdev_ioctl "Martin K. Petersen" <martin.petersen@oracle.com> - 2015-08-12 02:40 +0200
[PATCH 6/6] dm: add support for passing through persistent reservations Christoph Hellwig <hch@lst.de> - 2015-08-04 09:20 +0200
[PATCH 3/6] sd: implement the persisten reservation API Christoph Hellwig <hch@lst.de> - 2015-08-04 09:20 +0200
Re: [PATCH 3/6] sd: implement the persisten reservation API "Martin K. Petersen" <martin.petersen@oracle.com> - 2015-08-12 03:00 +0200
[PATCH 2/6] block: add a API for persistent reservations Christoph Hellwig <hch@lst.de> - 2015-08-04 09:20 +0200
Re: [PATCH 2/6] block: add a API for persistent reservations "Martin K. Petersen" <martin.petersen@oracle.com> - 2015-08-12 02:50 +0200
[PATCH 5/6] dm: split out a helper to find the ioctl target Christoph Hellwig <hch@lst.de> - 2015-08-04 09:20 +0200
Re: [PATCH 5/6] dm: split out a helper to find the ioctl target Mike Snitzer <snitzer@redhat.com> - 2015-08-04 20:10 +0200
Re: [PATCH 5/6] dm: split out a helper to find the ioctl target Christoph Hellwig <hch@lst.de> - 2015-08-06 15:50 +0200
[PATCH 4/6] dm: refactor ioctl handling Christoph Hellwig <hch@lst.de> - 2015-08-04 09:20 +0200
Re: [PATCH 4/6] dm: refactor ioctl handling Mike Snitzer <snitzer@redhat.com> - 2015-08-04 20:00 +0200
Re: [PATCH 4/6] dm: refactor ioctl handling Christoph Hellwig <hch@lst.de> - 2015-08-06 15:50 +0200
Re: Persistent Reservation API Mike Snitzer <snitzer@redhat.com> - 2015-08-04 20:00 +0200
Re: Persistent Reservation API Christoph Hellwig <hch@lst.de> - 2015-08-06 15:50 +0200
Re: Persistent Reservation API Keith Busch <keith.busch@intel.com> - 2015-08-04 20:10 +0200
Re: Persistent Reservation API Christoph Hellwig <hch@lst.de> - 2015-08-06 15:50 +0200
csiph-web