From 25fd164303cd69eb5adfe7668d2c146dcd866163 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 17 Jul 2007 08:52:29 +0200 Subject: bsg: address various review comments This address most of the comments made by Andrew. The two remaining are conversion to idr, and dynamic major. Signed-off-by: Jens Axboe --- block/bsg.c | 102 ++++++++++++++++++++++++++---------------------------------- 1 file changed, 44 insertions(+), 58 deletions(-) diff --git a/block/bsg.c b/block/bsg.c index 576933fe186..26a9372962c 100644 --- a/block/bsg.c +++ b/block/bsg.c @@ -33,7 +33,7 @@ #include #include -static char bsg_version[] = "block layer sg (bsg) 0.4"; +const static char bsg_version[] = "block layer sg (bsg) 0.4"; struct bsg_device { request_queue_t *queue; @@ -68,8 +68,6 @@ enum { #define dprintk(fmt, args...) #endif -#define list_entry_bc(entry) list_entry((entry), struct bsg_command, list) - /* * just for testing */ @@ -78,9 +76,9 @@ enum { static DEFINE_MUTEX(bsg_mutex); static int bsg_device_nr, bsg_minor_idx; -#define BSG_LIST_SIZE (8) -#define bsg_list_idx(minor) ((minor) & (BSG_LIST_SIZE - 1)) -static struct hlist_head bsg_device_list[BSG_LIST_SIZE]; +#define BSG_LIST_ARRAY_SIZE 8 +#define bsg_list_idx(minor) ((minor) & (BSG_LIST_ARRAY_SIZE - 1)) +static struct hlist_head bsg_device_list[BSG_LIST_ARRAY_SIZE]; static struct class *bsg_class; static LIST_HEAD(bsg_class_list); @@ -128,7 +126,7 @@ static struct bsg_command *bsg_alloc_command(struct bsg_device *bd) bd->queued_cmds++; spin_unlock_irq(&bd->lock); - bc = kmem_cache_alloc(bsg_cmd_cachep, GFP_USER); + bc = kmem_cache_zalloc(bsg_cmd_cachep, GFP_KERNEL); if (unlikely(!bc)) { spin_lock_irq(&bd->lock); bd->queued_cmds--; @@ -136,7 +134,6 @@ static struct bsg_command *bsg_alloc_command(struct bsg_device *bd) goto out; } - memset(bc, 0, sizeof(*bc)); bc->bd = bd; INIT_LIST_HEAD(&bc->list); dprintk("%s: returning free cmd %p\n", bd->name, bc); @@ -146,22 +143,12 @@ out: return bc; } -static inline void -bsg_del_done_cmd(struct bsg_device *bd, struct bsg_command *bc) -{ - bd->done_cmds--; - list_del(&bc->list); -} - static inline void bsg_add_done_cmd(struct bsg_device *bd, struct bsg_command *bc) { - bd->done_cmds++; - list_add_tail(&bc->list, &bd->done_list); - wake_up(&bd->wq_done); } -static inline int bsg_io_schedule(struct bsg_device *bd, int state) +static int bsg_io_schedule(struct bsg_device *bd) { DEFINE_WAIT(wait); int ret = 0; @@ -186,14 +173,11 @@ static inline int bsg_io_schedule(struct bsg_device *bd, int state) goto unlock; } - prepare_to_wait(&bd->wq_done, &wait, state); + prepare_to_wait(&bd->wq_done, &wait, TASK_UNINTERRUPTIBLE); spin_unlock_irq(&bd->lock); io_schedule(); finish_wait(&bd->wq_done, &wait); - if ((state == TASK_INTERRUPTIBLE) && signal_pending(current)) - ret = -ERESTARTSYS; - return ret; unlock: spin_unlock_irq(&bd->lock); @@ -272,7 +256,7 @@ bsg_map_hdr(struct bsg_device *bd, struct sg_io_v4 *hdr) { request_queue_t *q = bd->queue; struct request *rq, *next_rq = NULL; - int ret, rw = 0; /* shut up gcc */ + int ret, rw; unsigned int dxfer_len; void *dxferp = NULL; @@ -354,9 +338,11 @@ static void bsg_rq_end_io(struct request *rq, int uptodate) bc->hdr.duration = jiffies_to_msecs(jiffies - bc->hdr.duration); spin_lock_irqsave(&bd->lock, flags); - list_del(&bc->list); - bsg_add_done_cmd(bd, bc); + list_move_tail(&bc->list, &bd->done_list); + bd->done_cmds++; spin_unlock_irqrestore(&bd->lock, flags); + + wake_up(&bd->wq_done); } /* @@ -387,14 +373,15 @@ static void bsg_add_command(struct bsg_device *bd, request_queue_t *q, blk_execute_rq_nowait(q, NULL, rq, 1, bsg_rq_end_io); } -static inline struct bsg_command *bsg_next_done_cmd(struct bsg_device *bd) +static struct bsg_command *bsg_next_done_cmd(struct bsg_device *bd) { struct bsg_command *bc = NULL; spin_lock_irq(&bd->lock); if (bd->done_cmds) { - bc = list_entry_bc(bd->done_list.next); - bsg_del_done_cmd(bd, bc); + bc = list_entry(bd->done_list.next, struct bsg_command, list); + list_del(&bc->list); + bd->done_cmds--; } spin_unlock_irq(&bd->lock); @@ -450,8 +437,8 @@ static int blk_complete_sgv4_hdr_rq(struct request *rq, struct sg_io_v4 *hdr, hdr->response_len = 0; if (rq->sense_len && hdr->response) { - int len = min((unsigned int) hdr->max_response_len, - rq->sense_len); + int len = min_t(unsigned int, hdr->max_response_len, + rq->sense_len); ret = copy_to_user((void*)(unsigned long)hdr->response, rq->sense, len); @@ -486,7 +473,7 @@ static int bsg_complete_all_commands(struct bsg_device *bd) */ ret = 0; do { - ret = bsg_io_schedule(bd, TASK_UNINTERRUPTIBLE); + ret = bsg_io_schedule(bd); /* * look for -ENODATA specifically -- we'll sometimes get * -ERESTARTSYS when we've taken a signal, but we can't @@ -523,7 +510,7 @@ static int bsg_complete_all_commands(struct bsg_device *bd) return ret; } -static ssize_t +static int __bsg_read(char __user *buf, size_t count, struct bsg_device *bd, const struct iovec *iov, ssize_t *bytes_read) { @@ -550,7 +537,7 @@ __bsg_read(char __user *buf, size_t count, struct bsg_device *bd, ret = blk_complete_sgv4_hdr_rq(bc->rq, &bc->hdr, bc->bio, bc->bidi_bio); - if (copy_to_user(buf, (char *) &bc->hdr, sizeof(bc->hdr))) + if (copy_to_user(buf, &bc->hdr, sizeof(bc->hdr))) ret = -EFAULT; bsg_free_command(bc); @@ -582,6 +569,9 @@ static inline void bsg_set_write_perm(struct bsg_device *bd, struct file *file) clear_bit(BSG_F_WRITE_PERM, &bd->flags); } +/* + * Check if the error is a "real" error that we should return. + */ static inline int err_block_err(int ret) { if (ret && ret != -ENOSPC && ret != -ENODATA && ret != -EAGAIN) @@ -610,8 +600,8 @@ bsg_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) return bytes_read; } -static ssize_t __bsg_write(struct bsg_device *bd, const char __user *buf, - size_t count, ssize_t *bytes_read) +static int __bsg_write(struct bsg_device *bd, const char __user *buf, + size_t count, ssize_t *bytes_written) { struct bsg_command *bc; struct request *rq; @@ -655,7 +645,7 @@ static ssize_t __bsg_write(struct bsg_device *bd, const char __user *buf, rq = NULL; nr_commands--; buf += sizeof(struct sg_io_v4); - *bytes_read += sizeof(struct sg_io_v4); + *bytes_written += sizeof(struct sg_io_v4); } if (bc) @@ -668,7 +658,7 @@ static ssize_t bsg_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { struct bsg_device *bd = file->private_data; - ssize_t bytes_read; + ssize_t bytes_written; int ret; dprintk("%s: write %Zd bytes\n", bd->name, count); @@ -676,18 +666,18 @@ bsg_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) bsg_set_block(bd, file); bsg_set_write_perm(bd, file); - bytes_read = 0; - ret = __bsg_write(bd, buf, count, &bytes_read); - *ppos = bytes_read; + bytes_written = 0; + ret = __bsg_write(bd, buf, count, &bytes_written); + *ppos = bytes_written; /* * return bytes written on non-fatal errors */ - if (!bytes_read || (bytes_read && err_block_err(ret))) - bytes_read = ret; + if (!bytes_written || (bytes_written && err_block_err(ret))) + bytes_written = ret; - dprintk("%s: returning %Zd\n", bd->name, bytes_read); - return bytes_read; + dprintk("%s: returning %Zd\n", bd->name, bytes_written); + return bytes_written; } static struct bsg_device *bsg_alloc_device(void) @@ -746,7 +736,7 @@ static struct bsg_device *bsg_add_device(struct inode *inode, struct request_queue *rq, struct file *file) { - struct bsg_device *bd = NULL; + struct bsg_device *bd; #ifdef BSG_DEBUG unsigned char buf[32]; #endif @@ -762,7 +752,8 @@ static struct bsg_device *bsg_add_device(struct inode *inode, atomic_set(&bd->ref_count, 1); bd->minor = iminor(inode); mutex_lock(&bsg_mutex); - hlist_add_head(&bd->dev_list, &bsg_device_list[bsg_list_idx(bd->minor)]); + hlist_add_head(&bd->dev_list, + &bsg_device_list[bd->minor & (BSG_LIST_ARRAY_SIZE - 1)]); strncpy(bd->name, rq->bsg_dev.class_dev->class_id, sizeof(bd->name) - 1); dprintk("bound to <%s>, max queue %d\n", @@ -774,12 +765,13 @@ static struct bsg_device *bsg_add_device(struct inode *inode, static struct bsg_device *__bsg_get_device(int minor) { - struct hlist_head *list = &bsg_device_list[bsg_list_idx(minor)]; + struct hlist_head *list; struct bsg_device *bd = NULL; struct hlist_node *entry; mutex_lock(&bsg_mutex); + list = &bsg_device_list[minor & (BSG_LIST_ARRAY_SIZE - 1)]; hlist_for_each(entry, list) { bd = hlist_entry(entry, struct bsg_device, dev_list); if (bd->minor == minor) { @@ -858,16 +850,11 @@ static unsigned int bsg_poll(struct file *file, poll_table *wait) return mask; } -static int -bsg_ioctl(struct inode *inode, struct file *file, unsigned int cmd, - unsigned long arg) +static long bsg_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { struct bsg_device *bd = file->private_data; int __user *uarg = (int __user *) arg; - if (!bd) - return -ENXIO; - switch (cmd) { /* * our own ioctls @@ -944,7 +931,7 @@ static struct file_operations bsg_fops = { .poll = bsg_poll, .open = bsg_open, .release = bsg_release, - .ioctl = bsg_ioctl, + .unlocked_ioctl = bsg_ioctl, .owner = THIS_MODULE, }; @@ -952,8 +939,7 @@ void bsg_unregister_queue(struct request_queue *q) { struct bsg_class_device *bcd = &q->bsg_dev; - if (!bcd->class_dev) - return; + WARN_ON(!bcd->class_dev); mutex_lock(&bsg_mutex); sysfs_remove_link(&q->kobj, "bsg"); @@ -1069,7 +1055,7 @@ static int __init bsg_init(void) return -ENOMEM; } - for (i = 0; i < BSG_LIST_SIZE; i++) + for (i = 0; i < BSG_LIST_ARRAY_SIZE; i++) INIT_HLIST_HEAD(&bsg_device_list[i]); bsg_class = class_create(THIS_MODULE, "bsg"); -- cgit From 46f6ef4afc14ae1426883a973c18735cfcd70d8f Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 17 Jul 2007 08:56:10 +0200 Subject: bsg: convert to dynamic major 240 was hardcoded, that was clearly a dumb mistake. Convert bsg to use alloc_chrdev_region() to retrieve a dynamic major. Signed-off-by: Jens Axboe --- block/bsg.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/block/bsg.c b/block/bsg.c index 26a9372962c..cdb00e5544b 100644 --- a/block/bsg.c +++ b/block/bsg.c @@ -68,11 +68,6 @@ enum { #define dprintk(fmt, args...) #endif -/* - * just for testing - */ -#define BSG_MAJOR (240) - static DEFINE_MUTEX(bsg_mutex); static int bsg_device_nr, bsg_minor_idx; @@ -82,6 +77,7 @@ static struct hlist_head bsg_device_list[BSG_LIST_ARRAY_SIZE]; static struct class *bsg_class; static LIST_HEAD(bsg_class_list); +static int bsg_major; static struct kmem_cache *bsg_cmd_cachep; @@ -943,7 +939,7 @@ void bsg_unregister_queue(struct request_queue *q) mutex_lock(&bsg_mutex); sysfs_remove_link(&q->kobj, "bsg"); - class_device_destroy(bsg_class, MKDEV(BSG_MAJOR, bcd->minor)); + class_device_destroy(bsg_class, MKDEV(bsg_major, bcd->minor)); bcd->class_dev = NULL; list_del_init(&bcd->list); bsg_device_nr--; @@ -989,7 +985,7 @@ retry: bsg_minor_idx = 0; bcd->queue = q; - dev = MKDEV(BSG_MAJOR, bcd->minor); + dev = MKDEV(bsg_major, bcd->minor); class_dev = class_device_create(bsg_class, NULL, dev, bcd->dev, "%s", name); if (IS_ERR(class_dev)) { ret = PTR_ERR(class_dev); @@ -1010,7 +1006,7 @@ retry: return 0; err: if (class_dev) - class_device_destroy(bsg_class, MKDEV(BSG_MAJOR, bcd->minor)); + class_device_destroy(bsg_class, MKDEV(bsg_major, bcd->minor)); mutex_unlock(&bsg_mutex); return ret; } @@ -1047,6 +1043,7 @@ static struct cdev bsg_cdev = { static int __init bsg_init(void) { int ret, i; + dev_t devid; bsg_cmd_cachep = kmem_cache_create("bsg_cmd", sizeof(struct bsg_command), 0, 0, NULL, NULL); @@ -1064,19 +1061,21 @@ static int __init bsg_init(void) return PTR_ERR(bsg_class); } - ret = register_chrdev_region(MKDEV(BSG_MAJOR, 0), BSG_MAX_DEVS, "bsg"); + ret = alloc_chrdev_region(&devid, 0, BSG_MAX_DEVS, "bsg"); if (ret) { kmem_cache_destroy(bsg_cmd_cachep); class_destroy(bsg_class); return ret; } + bsg_major = MAJOR(devid); + cdev_init(&bsg_cdev, &bsg_fops); - ret = cdev_add(&bsg_cdev, MKDEV(BSG_MAJOR, 0), BSG_MAX_DEVS); + ret = cdev_add(&bsg_cdev, MKDEV(bsg_major, 0), BSG_MAX_DEVS); if (ret) { kmem_cache_destroy(bsg_cmd_cachep); class_destroy(bsg_class); - unregister_chrdev_region(MKDEV(BSG_MAJOR, 0), BSG_MAX_DEVS); + unregister_chrdev_region(MKDEV(bsg_major, 0), BSG_MAX_DEVS); return ret; } @@ -1085,11 +1084,11 @@ static int __init bsg_init(void) printk(KERN_ERR "bsg: failed register scsi interface %d\n", ret); kmem_cache_destroy(bsg_cmd_cachep); class_destroy(bsg_class); - unregister_chrdev(BSG_MAJOR, "bsg"); + unregister_chrdev(bsg_major, "bsg"); return ret; } - printk(KERN_INFO "%s loaded\n", bsg_version); + printk(KERN_INFO "%s loaded (major %d)\n", bsg_version, bsg_major); return 0; } -- cgit From 5cdf7f7678493996a835ef2e627976de8f9d1f40 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 17 Jul 2007 08:58:06 +0200 Subject: bsg: mark FUJITA Tomonori as bsg maintainer Signed-off-by: Jens Axboe --- MAINTAINERS | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 5abec1435ad..368a7181fa1 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -913,6 +913,12 @@ M: mchan@broadcom.com L: netdev@vger.kernel.org S: Supported +BSG (block layer generic sg v4 driver) +P: FUJITA Tomonori +M: fujita.tomonori@lab.ntt.co.jp +L: linux-scsi@vger.kernel.org +S: Supported + BTTV VIDEO4LINUX DRIVER P: Mauro Carvalho Chehab M: mchehab@infradead.org -- cgit From 9b9f770cef0037fd0e4d623f31ddfa8acda38205 Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Tue, 17 Jul 2007 12:20:46 +0200 Subject: bsg: fix initialization error handling bugs This fixes the following bugs and cleans up the initialization code: - cdev_del is missing. - unregister_chrdev_region should be used instead of unregister_chrdev. Signed-off-by: FUJITA Tomonori Signed-off-by: Jens Axboe --- block/bsg.c | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/block/bsg.c b/block/bsg.c index cdb00e5544b..b25378459ff 100644 --- a/block/bsg.c +++ b/block/bsg.c @@ -1057,39 +1057,37 @@ static int __init bsg_init(void) bsg_class = class_create(THIS_MODULE, "bsg"); if (IS_ERR(bsg_class)) { - kmem_cache_destroy(bsg_cmd_cachep); - return PTR_ERR(bsg_class); + ret = PTR_ERR(bsg_class); + goto destroy_kmemcache; } ret = alloc_chrdev_region(&devid, 0, BSG_MAX_DEVS, "bsg"); - if (ret) { - kmem_cache_destroy(bsg_cmd_cachep); - class_destroy(bsg_class); - return ret; - } + if (ret) + goto destroy_bsg_class; bsg_major = MAJOR(devid); cdev_init(&bsg_cdev, &bsg_fops); ret = cdev_add(&bsg_cdev, MKDEV(bsg_major, 0), BSG_MAX_DEVS); - if (ret) { - kmem_cache_destroy(bsg_cmd_cachep); - class_destroy(bsg_class); - unregister_chrdev_region(MKDEV(bsg_major, 0), BSG_MAX_DEVS); - return ret; - } + if (ret) + goto unregister_chrdev; ret = scsi_register_interface(&bsg_intf); - if (ret) { - printk(KERN_ERR "bsg: failed register scsi interface %d\n", ret); - kmem_cache_destroy(bsg_cmd_cachep); - class_destroy(bsg_class); - unregister_chrdev(bsg_major, "bsg"); - return ret; - } + if (ret) + goto remove_cdev; printk(KERN_INFO "%s loaded (major %d)\n", bsg_version, bsg_major); return 0; +remove_cdev: + printk(KERN_ERR "bsg: failed register scsi interface %d\n", ret); + cdev_del(&bsg_cdev); +unregister_chrdev: + unregister_chrdev_region(MKDEV(bsg_major, 0), BSG_MAX_DEVS); +destroy_bsg_class: + class_destroy(bsg_class); +destroy_kmemcache: + kmem_cache_destroy(bsg_cmd_cachep); + return ret; } MODULE_AUTHOR("Jens Axboe"); -- cgit From 1c1133e1ff850279d604581af31a400c830b0393 Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Tue, 17 Jul 2007 12:21:15 +0200 Subject: bsg: device hash table cleanup - kill unused bsg_list_idx macro. - add bsg_dev_idx_hash() that returns an appropriate hlist_head. Signed-off-by: FUJITA Tomonori Signed-off-by: Jens Axboe --- block/bsg.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/block/bsg.c b/block/bsg.c index b25378459ff..55a4303ed21 100644 --- a/block/bsg.c +++ b/block/bsg.c @@ -72,7 +72,6 @@ static DEFINE_MUTEX(bsg_mutex); static int bsg_device_nr, bsg_minor_idx; #define BSG_LIST_ARRAY_SIZE 8 -#define bsg_list_idx(minor) ((minor) & (BSG_LIST_ARRAY_SIZE - 1)) static struct hlist_head bsg_device_list[BSG_LIST_ARRAY_SIZE]; static struct class *bsg_class; @@ -139,9 +138,9 @@ out: return bc; } -static inline void -bsg_add_done_cmd(struct bsg_device *bd, struct bsg_command *bc) +static inline struct hlist_head *bsg_dev_idx_hash(int index) { + return &bsg_device_list[index & (BSG_LIST_ARRAY_SIZE - 1)]; } static int bsg_io_schedule(struct bsg_device *bd) @@ -748,8 +747,7 @@ static struct bsg_device *bsg_add_device(struct inode *inode, atomic_set(&bd->ref_count, 1); bd->minor = iminor(inode); mutex_lock(&bsg_mutex); - hlist_add_head(&bd->dev_list, - &bsg_device_list[bd->minor & (BSG_LIST_ARRAY_SIZE - 1)]); + hlist_add_head(&bd->dev_list, bsg_dev_idx_hash(bd->minor)); strncpy(bd->name, rq->bsg_dev.class_dev->class_id, sizeof(bd->name) - 1); dprintk("bound to <%s>, max queue %d\n", @@ -761,14 +759,12 @@ static struct bsg_device *bsg_add_device(struct inode *inode, static struct bsg_device *__bsg_get_device(int minor) { - struct hlist_head *list; struct bsg_device *bd = NULL; struct hlist_node *entry; mutex_lock(&bsg_mutex); - list = &bsg_device_list[minor & (BSG_LIST_ARRAY_SIZE - 1)]; - hlist_for_each(entry, list) { + hlist_for_each(entry, bsg_dev_idx_hash(minor)) { bd = hlist_entry(entry, struct bsg_device, dev_list); if (bd->minor == minor) { atomic_inc(&bd->ref_count); -- cgit From 0ed081ce203b0fd9a44763b70f41e36596f9b431 Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Tue, 17 Jul 2007 12:21:35 +0200 Subject: bsg: minor cleanup - fix MODULE_DESCRIPTION typo. - unify MODULE_DESCRIPTION and bsg_version. Signed-off-by: FUJITA Tomonori Signed-off-by: Jens Axboe --- block/bsg.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/block/bsg.c b/block/bsg.c index 55a4303ed21..8e5fcf2d70e 100644 --- a/block/bsg.c +++ b/block/bsg.c @@ -33,7 +33,8 @@ #include #include -const static char bsg_version[] = "block layer sg (bsg) 0.4"; +#define BSG_DESCRIPTION "Block layer SCSI generic (bsg) driver" +#define BSG_VERSION "0.4" struct bsg_device { request_queue_t *queue; @@ -1072,7 +1073,8 @@ static int __init bsg_init(void) if (ret) goto remove_cdev; - printk(KERN_INFO "%s loaded (major %d)\n", bsg_version, bsg_major); + printk(KERN_INFO BSG_DESCRIPTION "version " BSG_VERSION + " loaded (major %d)\n", bsg_major); return 0; remove_cdev: printk(KERN_ERR "bsg: failed register scsi interface %d\n", ret); @@ -1087,7 +1089,7 @@ destroy_kmemcache: } MODULE_AUTHOR("Jens Axboe"); -MODULE_DESCRIPTION("Block layer SGSI generic (sg) driver"); +MODULE_DESCRIPTION(BSG_DESCRIPTION); MODULE_LICENSE("GPL"); device_initcall(bsg_init); -- cgit From 319a7b7fb98f6927d6eedeb627f72f54c377f9ce Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Tue, 17 Jul 2007 12:22:09 +0200 Subject: bsg: Kconfig updates - add the detailed explanation. - remove 'default y'. - make 'EXPERIMENTAL' keyword visible to the user in menu. Signed-off-by: FUJITA Tomonori Signed-off-by: Jens Axboe --- block/Kconfig | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/block/Kconfig b/block/Kconfig index 6597b60e8e6..0768741d681 100644 --- a/block/Kconfig +++ b/block/Kconfig @@ -52,11 +52,16 @@ config LSF endif # BLOCK config BLK_DEV_BSG - bool "Block layer SG support" + bool "Block layer SG support v4 (EXPERIMENTAL)" depends on (SCSI=y) && EXPERIMENTAL - default y ---help--- - Saying Y here will enable generic SG (SCSI generic) v4 - support for any block device. + Saying Y here will enable generic SG (SCSI generic) v4 support + for any block device. + + Unlike SG v3 (aka block/scsi_ioctl.c drivers/scsi/sg.c), SG v4 + can handle complicated SCSI commands: tagged variable length cdbs + with bidirectional data transfers and generic request/response + protocols (e.g. Task Management Functions and SMP in Serial + Attached SCSI). source block/Kconfig.iosched -- cgit From 13bd59a111760bb7cba8dcf17b6b55a0d99d3592 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Tue, 17 Jul 2007 14:18:47 +0200 Subject: Don't define empty struct bsg_class_device if !CONFIG_BLK_DEV_BSG Don't define an empty struct bsg_class_device if !CONFIG_BLK_DEV_BSG. It's embedded in struct request_queue, but there we have #if defined(CONFIG_BLK_DEV_BSG) struct bsg_class_device bsg_dev; #endif anyway. Signed-off-by: Geert Uytterhoeven Signed-off-by: Jens Axboe --- include/linux/bsg.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/linux/bsg.h b/include/linux/bsg.h index bd998ca6cb2..8547b10c388 100644 --- a/include/linux/bsg.h +++ b/include/linux/bsg.h @@ -60,7 +60,6 @@ struct bsg_class_device { extern int bsg_register_queue(struct request_queue *, const char *); extern void bsg_unregister_queue(struct request_queue *); #else -struct bsg_class_device { }; #define bsg_register_queue(disk, name) (0) #define bsg_unregister_queue(disk) do { } while (0) #endif -- cgit From 5d3a8cd34beb1521a2697c6ed7b647ef9bafdbf1 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 17 Jul 2007 15:10:09 +0200 Subject: bsg: fix missing space in version print Tomo introduced a bug in his commit, removing the space between "driver" and "version" in the init printk. Signed-off-by: Jens Axboe --- block/bsg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/bsg.c b/block/bsg.c index 8e5fcf2d70e..baa04e7adf1 100644 --- a/block/bsg.c +++ b/block/bsg.c @@ -1073,7 +1073,7 @@ static int __init bsg_init(void) if (ret) goto remove_cdev; - printk(KERN_INFO BSG_DESCRIPTION "version " BSG_VERSION + printk(KERN_INFO BSG_DESCRIPTION " version " BSG_VERSION " loaded (major %d)\n", bsg_major); return 0; remove_cdev: -- cgit