"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "drivers/scsi/sd.c" between
linux-3.16.62.tar.xz and linux-3.16.63.tar.xz

About: The full source of the Linux kernel 3.16.x (longterm stable)

sd.c  (linux-3.16.62.tar.xz):sd.c  (linux-3.16.63.tar.xz)
skipping to change at line 132 skipping to change at line 132
static DEFINE_SPINLOCK(sd_index_lock); static DEFINE_SPINLOCK(sd_index_lock);
static DEFINE_IDA(sd_index_ida); static DEFINE_IDA(sd_index_ida);
/* This semaphore is used to mediate the 0->1 reference get in the /* This semaphore is used to mediate the 0->1 reference get in the
* face of object destruction (i.e. we can't allow a get on an * face of object destruction (i.e. we can't allow a get on an
* object after last put) */ * object after last put) */
static DEFINE_MUTEX(sd_ref_mutex); static DEFINE_MUTEX(sd_ref_mutex);
static struct kmem_cache *sd_cdb_cache; static struct kmem_cache *sd_cdb_cache;
static mempool_t *sd_cdb_pool; static mempool_t *sd_cdb_pool;
static mempool_t *sd_page_pool;
static const char *sd_cache_types[] = { static const char *sd_cache_types[] = {
"write through", "none", "write back", "write through", "none", "write back",
"write back, no read (daft)" "write back, no read (daft)"
}; };
static ssize_t static ssize_t
cache_type_store(struct device *dev, struct device_attribute *attr, cache_type_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count) const char *buf, size_t count)
{ {
skipping to change at line 707 skipping to change at line 708
int ret; int ret;
char *buf; char *buf;
struct page *page; struct page *page;
sector >>= ilog2(sdp->sector_size) - 9; sector >>= ilog2(sdp->sector_size) - 9;
nr_sectors >>= ilog2(sdp->sector_size) - 9; nr_sectors >>= ilog2(sdp->sector_size) - 9;
rq->timeout = SD_TIMEOUT; rq->timeout = SD_TIMEOUT;
memset(rq->cmd, 0, rq->cmd_len); memset(rq->cmd, 0, rq->cmd_len);
page = alloc_page(GFP_ATOMIC | __GFP_ZERO); page = mempool_alloc(sd_page_pool, GFP_ATOMIC);
if (!page) if (!page)
return BLKPREP_DEFER; return BLKPREP_DEFER;
clear_highpage(page);
switch (sdkp->provisioning_mode) { switch (sdkp->provisioning_mode) {
case SD_LBP_UNMAP: case SD_LBP_UNMAP:
buf = page_address(page); buf = page_address(page);
rq->cmd_len = 10; rq->cmd_len = 10;
rq->cmd[0] = UNMAP; rq->cmd[0] = UNMAP;
rq->cmd[8] = 24; rq->cmd[8] = 24;
put_unaligned_be16(6 + 16, &buf[0]); put_unaligned_be16(6 + 16, &buf[0]);
skipping to change at line 761 skipping to change at line 763
goto out; goto out;
} }
rq->completion_data = page; rq->completion_data = page;
blk_add_request_payload(rq, page, len); blk_add_request_payload(rq, page, len);
ret = scsi_setup_blk_pc_cmnd(sdp, rq); ret = scsi_setup_blk_pc_cmnd(sdp, rq);
rq->__data_len = nr_bytes; rq->__data_len = nr_bytes;
out: out:
if (ret != BLKPREP_OK) if (ret != BLKPREP_OK)
__free_page(page); mempool_free(page, sd_page_pool);
return ret; return ret;
} }
static void sd_config_write_same(struct scsi_disk *sdkp) static void sd_config_write_same(struct scsi_disk *sdkp)
{ {
struct request_queue *q = sdkp->disk->queue; struct request_queue *q = sdkp->disk->queue;
unsigned int logical_block_size = sdkp->device->sector_size; unsigned int logical_block_size = sdkp->device->sector_size;
if (sdkp->device->no_write_same) { if (sdkp->device->no_write_same) {
sdkp->max_ws_blocks = 0; sdkp->max_ws_blocks = 0;
skipping to change at line 3260 skipping to change at line 3262
printk(KERN_ERR "sd: can't init extended cdb cache\n"); printk(KERN_ERR "sd: can't init extended cdb cache\n");
goto err_out_class; goto err_out_class;
} }
sd_cdb_pool = mempool_create_slab_pool(SD_MEMPOOL_SIZE, sd_cdb_cache); sd_cdb_pool = mempool_create_slab_pool(SD_MEMPOOL_SIZE, sd_cdb_cache);
if (!sd_cdb_pool) { if (!sd_cdb_pool) {
printk(KERN_ERR "sd: can't init extended cdb pool\n"); printk(KERN_ERR "sd: can't init extended cdb pool\n");
goto err_out_cache; goto err_out_cache;
} }
sd_page_pool = mempool_create_page_pool(SD_MEMPOOL_SIZE, 0);
if (!sd_page_pool) {
printk(KERN_ERR "sd: can't init discard page pool\n");
err = -ENOMEM;
goto err_out_ppool;
}
err = scsi_register_driver(&sd_template.gendrv); err = scsi_register_driver(&sd_template.gendrv);
if (err) if (err)
goto err_out_driver; goto err_out_driver;
return 0; return 0;
err_out_driver: err_out_driver:
mempool_destroy(sd_page_pool);
err_out_ppool:
mempool_destroy(sd_cdb_pool); mempool_destroy(sd_cdb_pool);
err_out_cache: err_out_cache:
kmem_cache_destroy(sd_cdb_cache); kmem_cache_destroy(sd_cdb_cache);
err_out_class: err_out_class:
class_unregister(&sd_disk_class); class_unregister(&sd_disk_class);
err_out: err_out:
for (i = 0; i < SD_MAJORS; i++) for (i = 0; i < SD_MAJORS; i++)
unregister_blkdev(sd_major(i), "sd"); unregister_blkdev(sd_major(i), "sd");
skipping to change at line 3293 skipping to change at line 3305
* Note: this function unregisters this driver from the scsi mid-level. * Note: this function unregisters this driver from the scsi mid-level.
**/ **/
static void __exit exit_sd(void) static void __exit exit_sd(void)
{ {
int i; int i;
SCSI_LOG_HLQUEUE(3, printk("exit_sd: exiting sd driver\n")); SCSI_LOG_HLQUEUE(3, printk("exit_sd: exiting sd driver\n"));
scsi_unregister_driver(&sd_template.gendrv); scsi_unregister_driver(&sd_template.gendrv);
mempool_destroy(sd_cdb_pool); mempool_destroy(sd_cdb_pool);
mempool_destroy(sd_page_pool);
kmem_cache_destroy(sd_cdb_cache); kmem_cache_destroy(sd_cdb_cache);
class_unregister(&sd_disk_class); class_unregister(&sd_disk_class);
for (i = 0; i < SD_MAJORS; i++) { for (i = 0; i < SD_MAJORS; i++) {
blk_unregister_region(sd_major(i), SD_MINORS); blk_unregister_region(sd_major(i), SD_MINORS);
unregister_blkdev(sd_major(i), "sd"); unregister_blkdev(sd_major(i), "sd");
} }
} }
 End of changes. 7 change blocks. 
2 lines changed or deleted 15 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)