From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755753AbbHDR4U (ORCPT ); Tue, 4 Aug 2015 13:56:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42305 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753915AbbHDR4S (ORCPT ); Tue, 4 Aug 2015 13:56:18 -0400 Date: Tue, 4 Aug 2015 13:56:16 -0400 From: Mike Snitzer To: Christoph Hellwig Cc: Jens Axboe , linux-api@vger.kernel.org, dm-devel@redhat.com, linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 4/6] dm: refactor ioctl handling Message-ID: <20150804175616.GA28971@redhat.com> References: <1438672271-11309-1-git-send-email-hch@lst.de> <1438672271-11309-5-git-send-email-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1438672271-11309-5-git-send-email-hch@lst.de> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 04 2015 at 3:11am -0400, Christoph Hellwig 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 ... > 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