From: Christoph Hellwig <hch@infradead.org>
To: nab@linux-iscsi.org
Cc: linux-scsi@vger.kernel.org
Subject: [PATCH 6/9] target: remove dead blockdevice claim/release code
Date: Mon, 08 Nov 2010 10:56:07 -0500 [thread overview]
Message-ID: <20101108155648.286575749@canuck.infradead.org> (raw)
In-Reply-To: 20101108155601.872926000@canuck.infradead.org
[-- Attachment #1: lio-cleanup-claim --]
[-- Type: text/plain, Size: 8692 bytes --]
This code is entirely unused - even the last reference to
linux_blockdevice_release was unreachable at this point.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Index: lio-core-2.6/drivers/target/target_core_device.c
===================================================================
--- lio-core-2.6.orig/drivers/target/target_core_device.c 2010-11-08 15:52:26.154863014 +0100
+++ lio-core-2.6/drivers/target/target_core_device.c 2010-11-08 15:57:14.058196347 +0100
@@ -50,111 +50,6 @@
#include "target_core_pr.h"
#include "target_core_ua.h"
-struct block_device *__linux_blockdevice_claim(
- int major,
- int minor,
- void *claim_ptr,
- int *ret)
-{
- dev_t dev;
- struct block_device *bd;
-
- dev = MKDEV(major, minor);
-
- bd = bdget(dev);
- if (!(bd)) {
- *ret = -1;
- return NULL;
- }
-
- if (blkdev_get(bd, FMODE_WRITE|FMODE_READ) < 0) {
- *ret = -1;
- return NULL;
- }
- /*
- * If no claim pointer was passed from claimee, use struct block_device.
- */
- if (!claim_ptr)
- claim_ptr = (void *)bd;
-
- if (bd_claim(bd, claim_ptr) < 0) {
- blkdev_put(bd, FMODE_WRITE|FMODE_READ);
- *ret = 0;
- return bd;
- }
-
- *ret = 1;
- return bd;
-}
-
-struct block_device *linux_blockdevice_claim(
- int major,
- int minor,
- void *claim_ptr)
-{
- dev_t dev;
- struct block_device *bd;
-
- dev = MKDEV(major, minor);
-
- bd = bdget(dev);
- if (!(bd))
- return NULL;
-
- if (blkdev_get(bd, FMODE_WRITE|FMODE_READ) < 0)
- return NULL;
- /*
- * If no claim pointer was passed from claimee, use struct block_device.
- */
- if (!claim_ptr)
- claim_ptr = (void *)bd;
-
- if (bd_claim(bd, claim_ptr) < 0) {
- blkdev_put(bd, FMODE_WRITE|FMODE_READ);
- return NULL;
- }
-
- return bd;
-}
-EXPORT_SYMBOL(linux_blockdevice_claim);
-
-int linux_blockdevice_release(int major, int minor, struct block_device *bd_p)
-{
- dev_t dev;
- struct block_device *bd;
-
- if (!bd_p) {
- dev = MKDEV(major, minor);
-
- bd = bdget(dev);
- if (!(bd))
- return -1;
- } else
- bd = bd_p;
-
- bd_release(bd);
- blkdev_put(bd, FMODE_WRITE|FMODE_READ);
-
- return 0;
-}
-EXPORT_SYMBOL(linux_blockdevice_release);
-
-int linux_blockdevice_check(int major, int minor)
-{
- struct block_device *bd;
-
- bd = linux_blockdevice_claim(major, minor, NULL);
- if (!(bd))
- return -1;
- /*
- * Blockdevice was able to be claimed, now unclaim it and return success
- */
- linux_blockdevice_release(major, minor, NULL);
-
- return 0;
-}
-EXPORT_SYMBOL(linux_blockdevice_check);
-
extern int __transport_get_lun_for_cmd(
struct se_cmd *se_cmd,
u32 unpacked_lun)
Index: lio-core-2.6/drivers/target/target_core_file.c
===================================================================
--- lio-core-2.6.orig/drivers/target/target_core_file.c 2010-11-08 15:54:21.721529679 +0100
+++ lio-core-2.6/drivers/target/target_core_file.c 2010-11-08 15:55:27.531529681 +0100
@@ -234,14 +234,7 @@ static struct se_device *fd_create_virtd
dev_limits.max_cdb_len = TCM_MAX_COMMAND_SIZE;
dev_limits.hw_queue_depth = FD_MAX_DEVICE_QUEUE_DEPTH;
dev_limits.queue_depth = FD_DEVICE_QUEUE_DEPTH;
- /*
- * Pass dev_flags for linux_blockdevice_claim_bd or
- * linux_blockdevice_claim() from the usage above.
- *
- * Note that transport_add_device_to_core_hba() will call
- * linux_blockdevice_release() internally on failure to
- * call bd_release() on the referenced struct block_device.
- */
+
dev = transport_add_device_to_core_hba(hba, &fileio_template,
se_dev, dev_flags, (void *)fd_dev,
&dev_limits, "FILEIO", FD_VERSION);
Index: lio-core-2.6/drivers/target/target_core_file.h
===================================================================
--- lio-core-2.6.orig/drivers/target/target_core_file.h 2010-11-08 15:52:03.078196347 +0100
+++ lio-core-2.6/drivers/target/target_core_file.h 2010-11-08 15:56:30.278196346 +0100
@@ -16,10 +16,6 @@
#define FD_DATA_NONE 3
extern struct se_global *se_global;
-extern struct block_device *__linux_blockdevice_claim(int, int, void *, int *);
-extern struct block_device *linux_blockdevice_claim(int, int, void *);
-extern int linux_blockdevice_release(int, int, struct block_device *);
-extern int linux_blockdevice_check(int, int);
#define RRF_EMULATE_CDB 0x01
#define RRF_GOT_LBA 0x02
Index: lio-core-2.6/drivers/target/target_core_iblock.c
===================================================================
--- lio-core-2.6.orig/drivers/target/target_core_iblock.c 2010-11-08 15:54:21.734863014 +0100
+++ lio-core-2.6/drivers/target/target_core_iblock.c 2010-11-08 16:03:22.868196349 +0100
@@ -187,15 +187,7 @@ static struct se_device *iblock_create_v
ib_dev->ibd_major = MAJOR(bd->bd_dev);
ib_dev->ibd_minor = MINOR(bd->bd_dev);
ib_dev->ibd_bd = bd;
- ib_dev->ibd_flags |= IBDF_BDEV_EXCLUSIVE;
- /*
- * Pass dev_flags for linux_blockdevice_claim() or
- * linux_blockdevice_claim() from the usage above.
- *
- * Note that transport_add_device_to_core_hba() will call
- * linux_blockdevice_release() internally on failure to
- * call bd_release() on the referenced struct block_device.
- */
+
dev = transport_add_device_to_core_hba(hba,
&iblock_template, se_dev, dev_flags, (void *)ib_dev,
&dev_limits, "IBLOCK", IBLOCK_VERSION);
@@ -251,25 +243,8 @@ static void iblock_free_device(void *p)
{
struct iblock_dev *ib_dev = p;
- if (ib_dev->ibd_bd) {
- printk(KERN_INFO "IBLOCK: Releasing Major:Minor - %d:%d\n",
- ib_dev->ibd_major, ib_dev->ibd_minor);
-
- if (ib_dev->ibd_flags & IBDF_BDEV_EXCLUSIVE)
- close_bdev_exclusive(ib_dev->ibd_bd,
- FMODE_WRITE|FMODE_READ);
- else
- linux_blockdevice_release(ib_dev->ibd_major,
- ib_dev->ibd_minor, ib_dev->ibd_bd);
- ib_dev->ibd_bd = NULL;
- }
-
- if (ib_dev->ibd_bio_set) {
- DEBUG_IBLOCK("Calling bioset_free ib_dev->ibd_bio_set: %p\n",
- ib_dev->ibd_bio_set);
- bioset_free(ib_dev->ibd_bio_set);
- }
-
+ close_bdev_exclusive(ib_dev->ibd_bd, FMODE_WRITE|FMODE_READ);
+ bioset_free(ib_dev->ibd_bio_set);
kfree(ib_dev);
}
Index: lio-core-2.6/drivers/target/target_core_iblock.h
===================================================================
--- lio-core-2.6.orig/drivers/target/target_core_iblock.h 2010-11-08 15:59:59.918196346 +0100
+++ lio-core-2.6/drivers/target/target_core_iblock.h 2010-11-08 16:00:08.661529684 +0100
@@ -23,8 +23,7 @@ struct iblock_req {
#define IBDF_HAS_UDEV_PATH 0x01
#define IBDF_HAS_FORCE 0x02
-#define IBDF_BDEV_EXCLUSIVE 0x04
-#define IBDF_BDEV_ISSUE_FLUSH 0x08
+#define IBDF_BDEV_ISSUE_FLUSH 0x04
struct iblock_dev {
unsigned char ibd_udev_path[SE_UDEV_PATH_LEN];
Index: lio-core-2.6/drivers/target/target_core_pscsi.h
===================================================================
--- lio-core-2.6.orig/drivers/target/target_core_pscsi.h 2010-11-08 15:53:09.088196347 +0100
+++ lio-core-2.6/drivers/target/target_core_pscsi.h 2010-11-08 15:56:11.404863014 +0100
@@ -20,9 +20,6 @@
#define PS_TIMEOUT_OTHER (500*HZ)
extern struct se_global *se_global;
-extern struct block_device *linux_blockdevice_claim(int, int, void *);
-extern int linux_blockdevice_release(int, int, struct block_device *);
-extern int linux_blockdevice_check(int, int);
#include <linux/device.h>
#include <scsi/scsi_driver.h>
Index: lio-core-2.6/drivers/target/target_core_stgt.h
===================================================================
--- lio-core-2.6.orig/drivers/target/target_core_stgt.h 2010-11-08 15:53:17.704863012 +0100
+++ lio-core-2.6/drivers/target/target_core_stgt.h 2010-11-08 15:56:13.564863014 +0100
@@ -12,9 +12,6 @@
#define PS_TIMEOUT_OTHER (500*HZ)
extern struct se_global *se_global;
-extern struct block_device *linux_blockdevice_claim(int, int, void *);
-extern int linux_blockdevice_release(int, int, struct block_device *);
-extern int linux_blockdevice_check(int, int);
#include <linux/device.h>
#include <scsi/scsi_driver.h>
Index: lio-core-2.6/include/target/target_core_device.h
===================================================================
--- lio-core-2.6.orig/include/target/target_core_device.h 2010-11-08 15:52:18.101529681 +0100
+++ lio-core-2.6/include/target/target_core_device.h 2010-11-08 15:56:17.911529680 +0100
@@ -3,10 +3,6 @@
extern struct se_global *se_global;
-extern struct block_device *__linux_blockdevice_claim(int, int, void *, int *);
-extern struct block_device *linux_blockdevice_claim(int, int, void *);
-extern int linux_blockdevice_release(int, int, struct block_device *);
-extern int linux_blockdevice_check(int, int);
extern int transport_get_lun_for_cmd(struct se_cmd *, unsigned char *, u32);
extern int transport_get_lun_for_tmr(struct se_cmd *, u32);
extern struct se_dev_entry *core_get_se_deve_from_rtpi(
next prev parent reply other threads:[~2010-11-08 15:56 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-08 15:56 [PATCH 0/9] target core review feedback Christoph Hellwig
2010-11-08 15:56 ` [PATCH 1/9] target: remove never changing indirections in se_cmd Christoph Hellwig
2010-11-08 21:57 ` Nicholas A. Bellinger
2010-11-08 15:56 ` [PATCH 2/9] target: remove activate_device/deactivate_device methods Christoph Hellwig
2010-11-08 22:00 ` Nicholas A. Bellinger
2010-11-08 15:56 ` [PATCH 3/9] From: Christoph Hellwig <hch@lst.de> Sujbect: target: remove SHUTDOWN_SIGS Christoph Hellwig
2010-11-08 22:21 ` [PATCH 3/9] " Nicholas A. Bellinger
2010-11-08 22:31 ` Christoph Hellwig
2010-11-08 15:56 ` [PATCH 4/9] target: remove transport_generic_map_buffers_to_tasks Christoph Hellwig
2010-11-08 22:29 ` Nicholas A. Bellinger
2010-11-08 15:56 ` [PATCH 5/9] target: clean up transport_subsystem_register Christoph Hellwig
2010-11-08 22:32 ` Nicholas A. Bellinger
2010-11-08 15:56 ` Christoph Hellwig [this message]
2010-11-08 22:35 ` [PATCH 6/9] target: remove dead blockdevice claim/release code Nicholas A. Bellinger
2010-11-08 15:56 ` [PATCH 7/9] target: remove transport_generic_free_device Christoph Hellwig
2010-11-08 22:40 ` Nicholas A. Bellinger
2010-11-08 15:56 ` [PATCH 8/9] target: remove unused split_cdb_RW_* handlers Christoph Hellwig
2010-11-08 22:41 ` Nicholas A. Bellinger
2010-11-08 15:56 ` [PATCH 9/9] target: remove dead call to transport_emulate_control_cdb in rd driver Christoph Hellwig
2010-11-08 22:44 ` Nicholas A. Bellinger
2010-11-08 17:19 ` [PATCH 10/9] target: split CDB emulation out of target_core_transport.c Christoph Hellwig
2010-11-08 22:48 ` Nicholas A. Bellinger
2010-11-08 22:57 ` 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=20101108155648.286575749@canuck.infradead.org \
--to=hch@infradead.org \
--cc=linux-scsi@vger.kernel.org \
--cc=nab@linux-iscsi.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