* [PATCH 0 of 4] Block Layer Data Integrity
@ 2008-06-17 16:47 Martin K. Petersen
2008-06-17 16:47 ` [PATCH 1 of 4] scsi: Rename scsi_bidi_sdb_cache Martin K. Petersen
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Martin K. Petersen @ 2008-06-17 16:47 UTC (permalink / raw)
To: James.Bottomley, linux-scsi
A couple of generic cleanup patches in preparation for the data
integrity code.
- Make scsi_data_buffer cache generic
- Move sd.h from include/scsi to drivers/scsi
- Make a few functions callable from outside of sd.c (i.e. sd-dif.c)
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1 of 4] scsi: Rename scsi_bidi_sdb_cache
2008-06-17 16:47 [PATCH 0 of 4] Block Layer Data Integrity Martin K. Petersen
@ 2008-06-17 16:47 ` Martin K. Petersen
2008-06-17 16:47 ` [PATCH 2 of 4] sd: Move sd.h header file Martin K. Petersen
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Martin K. Petersen @ 2008-06-17 16:47 UTC (permalink / raw)
To: James.Bottomley, linux-scsi
The data integrity changes need to dynamically allocate
scsi_data_buffers too. Rename scsi_bidi_sdb_cache for clarity.
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
---
1 file changed, 13 insertions(+), 13 deletions(-)
drivers/scsi/scsi_lib.c | 26 +++++++++++++-------------
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -65,7 +65,7 @@ static struct scsi_host_sg_pool scsi_sg_
};
#undef SP
-static struct kmem_cache *scsi_bidi_sdb_cache;
+static struct kmem_cache *scsi_sdb_cache;
static void scsi_run_queue(struct request_queue *q);
@@ -775,7 +775,7 @@ void scsi_release_buffers(struct scsi_cm
struct scsi_data_buffer *bidi_sdb =
cmd->request->next_rq->special;
scsi_free_sgtable(bidi_sdb);
- kmem_cache_free(scsi_bidi_sdb_cache, bidi_sdb);
+ kmem_cache_free(scsi_sdb_cache, bidi_sdb);
cmd->request->next_rq->special = NULL;
}
}
@@ -1050,7 +1050,7 @@ int scsi_init_io(struct scsi_cmnd *cmd,
if (blk_bidi_rq(cmd->request)) {
struct scsi_data_buffer *bidi_sdb = kmem_cache_zalloc(
- scsi_bidi_sdb_cache, GFP_ATOMIC);
+ scsi_sdb_cache, GFP_ATOMIC);
if (!bidi_sdb) {
error = BLKPREP_DEFER;
goto err_exit;
@@ -1684,11 +1684,11 @@ int __init scsi_init_queue(void)
return -ENOMEM;
}
- scsi_bidi_sdb_cache = kmem_cache_create("scsi_bidi_sdb",
- sizeof(struct scsi_data_buffer),
- 0, 0, NULL);
- if (!scsi_bidi_sdb_cache) {
- printk(KERN_ERR "SCSI: can't init scsi bidi sdb cache\n");
+ scsi_sdb_cache = kmem_cache_create("scsi_data_buffer",
+ sizeof(struct scsi_data_buffer),
+ 0, 0, NULL);
+ if (!scsi_sdb_cache) {
+ printk(KERN_ERR "SCSI: can't init scsi sdb cache\n");
goto cleanup_io_context;
}
@@ -1701,7 +1701,7 @@ int __init scsi_init_queue(void)
if (!sgp->slab) {
printk(KERN_ERR "SCSI: can't init sg slab %s\n",
sgp->name);
- goto cleanup_bidi_sdb;
+ goto cleanup_sdb;
}
sgp->pool = mempool_create_slab_pool(SG_MEMPOOL_SIZE,
@@ -1709,13 +1709,13 @@ int __init scsi_init_queue(void)
if (!sgp->pool) {
printk(KERN_ERR "SCSI: can't init sg mempool %s\n",
sgp->name);
- goto cleanup_bidi_sdb;
+ goto cleanup_sdb;
}
}
return 0;
-cleanup_bidi_sdb:
+cleanup_sdb:
for (i = 0; i < SG_MEMPOOL_NR; i++) {
struct scsi_host_sg_pool *sgp = scsi_sg_pools + i;
if (sgp->pool)
@@ -1723,7 +1723,7 @@ cleanup_bidi_sdb:
if (sgp->slab)
kmem_cache_destroy(sgp->slab);
}
- kmem_cache_destroy(scsi_bidi_sdb_cache);
+ kmem_cache_destroy(scsi_sdb_cache);
cleanup_io_context:
kmem_cache_destroy(scsi_io_context_cache);
@@ -1735,7 +1735,7 @@ void scsi_exit_queue(void)
int i;
kmem_cache_destroy(scsi_io_context_cache);
- kmem_cache_destroy(scsi_bidi_sdb_cache);
+ kmem_cache_destroy(scsi_sdb_cache);
for (i = 0; i < SG_MEMPOOL_NR; i++) {
struct scsi_host_sg_pool *sgp = scsi_sg_pools + i;
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2 of 4] sd: Move sd.h header file
2008-06-17 16:47 [PATCH 0 of 4] Block Layer Data Integrity Martin K. Petersen
2008-06-17 16:47 ` [PATCH 1 of 4] scsi: Rename scsi_bidi_sdb_cache Martin K. Petersen
@ 2008-06-17 16:47 ` Martin K. Petersen
2008-06-17 16:47 ` [PATCH 3 of 4] sd: Allow sd_print_sense_hdr to be called outside of sd.c Martin K. Petersen
2008-06-17 16:47 ` [PATCH 4 of 4] sd: Move scsi_disk() accessor function to sd.h Martin K. Petersen
3 siblings, 0 replies; 5+ messages in thread
From: Martin K. Petersen @ 2008-06-17 16:47 UTC (permalink / raw)
To: James.Bottomley, linux-scsi
Christoph objected to having sd.h in include/scsi since it is internal
to the sd driver. Move it to drivers/scsi/sd.h.
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
---
3 files changed, 58 insertions(+), 58 deletions(-)
drivers/scsi/sd.c | 2 -
drivers/scsi/sd.h | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++
include/scsi/sd.h | 57 -----------------------------------------------------
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -58,8 +58,8 @@
#include <scsi/scsi_host.h>
#include <scsi/scsi_ioctl.h>
#include <scsi/scsicam.h>
-#include <scsi/sd.h>
+#include "sd.h"
#include "scsi_logging.h"
MODULE_AUTHOR("Eric Youngdale");
diff --git a/drivers/scsi/sd.h b/drivers/scsi/sd.h
new file mode 100644
--- /dev/null
+++ b/drivers/scsi/sd.h
@@ -0,0 +1,57 @@
+#ifndef _SCSI_DISK_H
+#define _SCSI_DISK_H
+
+/*
+ * More than enough for everybody ;) The huge number of majors
+ * is a leftover from 16bit dev_t days, we don't really need that
+ * much numberspace.
+ */
+#define SD_MAJORS 16
+
+/*
+ * This is limited by the naming scheme enforced in sd_probe,
+ * add another character to it if you really need more disks.
+ */
+#define SD_MAX_DISKS (((26 * 26) + 26 + 1) * 26)
+
+/*
+ * Time out in seconds for disks and Magneto-opticals (which are slower).
+ */
+#define SD_TIMEOUT (30 * HZ)
+#define SD_MOD_TIMEOUT (75 * HZ)
+
+/*
+ * Number of allowed retries
+ */
+#define SD_MAX_RETRIES 5
+#define SD_PASSTHROUGH_RETRIES 1
+
+/*
+ * Size of the initial data buffer for mode and read capacity data
+ */
+#define SD_BUF_SIZE 512
+
+struct scsi_disk {
+ struct scsi_driver *driver; /* always &sd_template */
+ struct scsi_device *device;
+ struct device dev;
+ struct gendisk *disk;
+ unsigned int openers; /* protected by BKL for now, yuck */
+ sector_t capacity; /* size in 512-byte sectors */
+ u32 index;
+ u8 media_present;
+ u8 write_prot;
+ unsigned previous_state : 1;
+ unsigned WCE : 1; /* state of disk WCE bit */
+ unsigned RCD : 1; /* state of disk RCD bit, unused */
+ unsigned DPOFUA : 1; /* state of disk DPOFUA bit */
+};
+#define to_scsi_disk(obj) container_of(obj,struct scsi_disk,dev)
+
+#define sd_printk(prefix, sdsk, fmt, a...) \
+ (sdsk)->disk ? \
+ sdev_printk(prefix, (sdsk)->device, "[%s] " fmt, \
+ (sdsk)->disk->disk_name, ##a) : \
+ sdev_printk(prefix, (sdsk)->device, fmt, ##a)
+
+#endif /* _SCSI_DISK_H */
diff --git a/include/scsi/sd.h b/include/scsi/sd.h
deleted file mode 100644
--- a/include/scsi/sd.h
+++ /dev/null
@@ -1,57 +0,0 @@
-#ifndef _SCSI_DISK_H
-#define _SCSI_DISK_H
-
-/*
- * More than enough for everybody ;) The huge number of majors
- * is a leftover from 16bit dev_t days, we don't really need that
- * much numberspace.
- */
-#define SD_MAJORS 16
-
-/*
- * This is limited by the naming scheme enforced in sd_probe,
- * add another character to it if you really need more disks.
- */
-#define SD_MAX_DISKS (((26 * 26) + 26 + 1) * 26)
-
-/*
- * Time out in seconds for disks and Magneto-opticals (which are slower).
- */
-#define SD_TIMEOUT (30 * HZ)
-#define SD_MOD_TIMEOUT (75 * HZ)
-
-/*
- * Number of allowed retries
- */
-#define SD_MAX_RETRIES 5
-#define SD_PASSTHROUGH_RETRIES 1
-
-/*
- * Size of the initial data buffer for mode and read capacity data
- */
-#define SD_BUF_SIZE 512
-
-struct scsi_disk {
- struct scsi_driver *driver; /* always &sd_template */
- struct scsi_device *device;
- struct device dev;
- struct gendisk *disk;
- unsigned int openers; /* protected by BKL for now, yuck */
- sector_t capacity; /* size in 512-byte sectors */
- u32 index;
- u8 media_present;
- u8 write_prot;
- unsigned previous_state : 1;
- unsigned WCE : 1; /* state of disk WCE bit */
- unsigned RCD : 1; /* state of disk RCD bit, unused */
- unsigned DPOFUA : 1; /* state of disk DPOFUA bit */
-};
-#define to_scsi_disk(obj) container_of(obj,struct scsi_disk,dev)
-
-#define sd_printk(prefix, sdsk, fmt, a...) \
- (sdsk)->disk ? \
- sdev_printk(prefix, (sdsk)->device, "[%s] " fmt, \
- (sdsk)->disk->disk_name, ##a) : \
- sdev_printk(prefix, (sdsk)->device, fmt, ##a)
-
-#endif /* _SCSI_DISK_H */
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 3 of 4] sd: Allow sd_print_sense_hdr to be called outside of sd.c
2008-06-17 16:47 [PATCH 0 of 4] Block Layer Data Integrity Martin K. Petersen
2008-06-17 16:47 ` [PATCH 1 of 4] scsi: Rename scsi_bidi_sdb_cache Martin K. Petersen
2008-06-17 16:47 ` [PATCH 2 of 4] sd: Move sd.h header file Martin K. Petersen
@ 2008-06-17 16:47 ` Martin K. Petersen
2008-06-17 16:47 ` [PATCH 4 of 4] sd: Move scsi_disk() accessor function to sd.h Martin K. Petersen
3 siblings, 0 replies; 5+ messages in thread
From: Martin K. Petersen @ 2008-06-17 16:47 UTC (permalink / raw)
To: James.Bottomley, linux-scsi
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
---
2 files changed, 3 insertions(+), 3 deletions(-)
drivers/scsi/sd.c | 4 +---
drivers/scsi/sd.h | 2 ++
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -96,7 +96,6 @@ static int sd_done(struct scsi_cmnd *);
static int sd_done(struct scsi_cmnd *);
static void sd_read_capacity(struct scsi_disk *sdkp, unsigned char *buffer);
static void scsi_disk_release(struct device *cdev);
-static void sd_print_sense_hdr(struct scsi_disk *, struct scsi_sense_hdr *);
static void sd_print_result(struct scsi_disk *, int);
static DEFINE_IDR(sd_index_idr);
@@ -1929,8 +1928,7 @@ module_init(init_sd);
module_init(init_sd);
module_exit(exit_sd);
-static void sd_print_sense_hdr(struct scsi_disk *sdkp,
- struct scsi_sense_hdr *sshdr)
+void sd_print_sense_hdr(struct scsi_disk *sdkp, struct scsi_sense_hdr *sshdr)
{
sd_printk(KERN_INFO, sdkp, "");
scsi_show_sense_hdr(sshdr);
diff --git a/drivers/scsi/sd.h b/drivers/scsi/sd.h
--- a/drivers/scsi/sd.h
+++ b/drivers/scsi/sd.h
@@ -48,6 +48,8 @@ struct scsi_disk {
};
#define to_scsi_disk(obj) container_of(obj,struct scsi_disk,dev)
+extern void sd_print_sense_hdr(struct scsi_disk *, struct scsi_sense_hdr *);
+
#define sd_printk(prefix, sdsk, fmt, a...) \
(sdsk)->disk ? \
sdev_printk(prefix, (sdsk)->device, "[%s] " fmt, \
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 4 of 4] sd: Move scsi_disk() accessor function to sd.h
2008-06-17 16:47 [PATCH 0 of 4] Block Layer Data Integrity Martin K. Petersen
` (2 preceding siblings ...)
2008-06-17 16:47 ` [PATCH 3 of 4] sd: Allow sd_print_sense_hdr to be called outside of sd.c Martin K. Petersen
@ 2008-06-17 16:47 ` Martin K. Petersen
3 siblings, 0 replies; 5+ messages in thread
From: Martin K. Petersen @ 2008-06-17 16:47 UTC (permalink / raw)
To: James.Bottomley, linux-scsi
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
---
2 files changed, 5 insertions(+), 5 deletions(-)
drivers/scsi/sd.c | 5 -----
drivers/scsi/sd.h | 5 +++++
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -292,11 +292,6 @@ static int sd_major(int major_idx)
BUG();
return 0; /* shut up gcc */
}
-}
-
-static inline struct scsi_disk *scsi_disk(struct gendisk *disk)
-{
- return container_of(disk->private_data, struct scsi_disk, driver);
}
static struct scsi_disk *__scsi_disk_get(struct gendisk *disk)
diff --git a/drivers/scsi/sd.h b/drivers/scsi/sd.h
--- a/drivers/scsi/sd.h
+++ b/drivers/scsi/sd.h
@@ -50,6 +50,11 @@ struct scsi_disk {
extern void sd_print_sense_hdr(struct scsi_disk *, struct scsi_sense_hdr *);
+static inline struct scsi_disk *scsi_disk(struct gendisk *disk)
+{
+ return container_of(disk->private_data, struct scsi_disk, driver);
+}
+
#define sd_printk(prefix, sdsk, fmt, a...) \
(sdsk)->disk ? \
sdev_printk(prefix, (sdsk)->device, "[%s] " fmt, \
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-06-17 16:58 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-17 16:47 [PATCH 0 of 4] Block Layer Data Integrity Martin K. Petersen
2008-06-17 16:47 ` [PATCH 1 of 4] scsi: Rename scsi_bidi_sdb_cache Martin K. Petersen
2008-06-17 16:47 ` [PATCH 2 of 4] sd: Move sd.h header file Martin K. Petersen
2008-06-17 16:47 ` [PATCH 3 of 4] sd: Allow sd_print_sense_hdr to be called outside of sd.c Martin K. Petersen
2008-06-17 16:47 ` [PATCH 4 of 4] sd: Move scsi_disk() accessor function to sd.h Martin K. Petersen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox