UPSTREAM: zram: remove request_queue from struct zram
(cherry-pick from commit ee98016010ae036a5b27300d83bd99ef3fd5776e) `struct zram' contains both `struct gendisk' and `struct request_queue'. the latter can be deleted, because zram->disk carries ->queue pointer, and ->queue carries zram pointer: create_device() zram->queue->queuedata = zram zram->disk->queue = zram->queue zram->disk->private_data = zram so zram->queue is not needed, we can access all necessary data anyway. Bug: 25951511 Change-Id: If5bcc26c6b1ec69843afdadf745acaa506efc5e6 Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com> Cc: Minchan Kim <minchan@kernel.org> Cc: Jerome Marchand <jmarchan@redhat.com> Cc: Nitin Gupta <ngupta@vflare.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Conflicts: drivers/block/zram/zram_drv.c
This commit is contained in:
parent
6ad88f32b1
commit
a43c5c80c2
|
@ -1125,6 +1125,7 @@ static struct attribute_group zram_disk_attr_group = {
|
|||
|
||||
static int create_device(struct zram *zram, int device_id)
|
||||
{
|
||||
struct request_queue *queue;
|
||||
int ret = -ENOMEM;
|
||||
|
||||
init_rwsem(&zram->init_lock);
|
||||
|
@ -1133,15 +1134,14 @@ static int create_device(struct zram *zram, int device_id)
|
|||
spin_lock_init(&zram->slot_free_lock);
|
||||
zram->slot_free_rq = NULL;
|
||||
|
||||
zram->queue = blk_alloc_queue(GFP_KERNEL);
|
||||
if (!zram->queue) {
|
||||
queue = blk_alloc_queue(GFP_KERNEL);
|
||||
if (!queue) {
|
||||
pr_err("Error allocating disk queue for device %d\n",
|
||||
device_id);
|
||||
goto out;
|
||||
}
|
||||
|
||||
blk_queue_make_request(zram->queue, zram_make_request);
|
||||
zram->queue->queuedata = zram;
|
||||
blk_queue_make_request(queue, zram_make_request);
|
||||
|
||||
/* gendisk structure */
|
||||
zram->disk = alloc_disk(1);
|
||||
|
@ -1154,11 +1154,12 @@ static int create_device(struct zram *zram, int device_id)
|
|||
zram->disk->major = zram_major;
|
||||
zram->disk->first_minor = device_id;
|
||||
zram->disk->fops = &zram_devops;
|
||||
zram->disk->queue = zram->queue;
|
||||
zram->disk->queue = queue;
|
||||
zram->disk->queue->queuedata = zram;
|
||||
zram->disk->private_data = zram;
|
||||
snprintf(zram->disk->disk_name, 16, "zram%d", device_id);
|
||||
|
||||
__set_bit(QUEUE_FLAG_FAST, &zram->queue->queue_flags);
|
||||
__set_bit(QUEUE_FLAG_FAST, &zram->disk->queue->queue_flags);
|
||||
/* Actual capacity set using syfs (/sys/block/zram<id>/disksize */
|
||||
set_capacity(zram->disk, 0);
|
||||
/* zram devices sort of resembles non-rotational disks */
|
||||
|
@ -1205,7 +1206,7 @@ out_free_disk:
|
|||
del_gendisk(zram->disk);
|
||||
put_disk(zram->disk);
|
||||
out_free_queue:
|
||||
blk_cleanup_queue(zram->queue);
|
||||
blk_cleanup_queue(queue);
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
|
@ -1226,10 +1227,9 @@ static void destroy_devices(unsigned int nr)
|
|||
|
||||
zram_reset_device(zram);
|
||||
|
||||
blk_cleanup_queue(zram->disk->queue);
|
||||
del_gendisk(zram->disk);
|
||||
put_disk(zram->disk);
|
||||
|
||||
blk_cleanup_queue(zram->queue);
|
||||
}
|
||||
|
||||
kfree(zram_devices);
|
||||
|
|
|
@ -112,7 +112,6 @@ struct zram {
|
|||
struct work_struct free_work; /* handle pending free request */
|
||||
struct zram_slot_free *slot_free_rq; /* list head of free request */
|
||||
struct zcomp *comp;
|
||||
struct request_queue *queue;
|
||||
struct gendisk *disk;
|
||||
/* Prevent concurrent execution of device init */
|
||||
struct rw_semaphore init_lock;
|
||||
|
|
Loading…
Reference in New Issue