diff options
author | Sergey Senozhatsky <sergey.senozhatsky@gmail.com> | 2015-02-12 18:00:48 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-12 21:54:12 -0500 |
commit | ee98016010ae036a5b27300d83bd99ef3fd5776e (patch) | |
tree | baddea4a5c526ff632ebdf7eaed106cb25d5596b /drivers/block/zram | |
parent | 08eee69fcf6baea543a2b4d2a2fcba0e61aa3160 (diff) |
zram: remove request_queue from struct zram
`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.
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>
Diffstat (limited to 'drivers/block/zram')
-rw-r--r-- | drivers/block/zram/zram_drv.c | 16 | ||||
-rw-r--r-- | drivers/block/zram/zram_drv.h | 1 |
2 files changed, 8 insertions, 9 deletions
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index db94572b35c4..eca4b67274c1 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c | |||
@@ -1061,19 +1061,19 @@ static struct attribute_group zram_disk_attr_group = { | |||
1061 | 1061 | ||
1062 | static int create_device(struct zram *zram, int device_id) | 1062 | static int create_device(struct zram *zram, int device_id) |
1063 | { | 1063 | { |
1064 | struct request_queue *queue; | ||
1064 | int ret = -ENOMEM; | 1065 | int ret = -ENOMEM; |
1065 | 1066 | ||
1066 | init_rwsem(&zram->init_lock); | 1067 | init_rwsem(&zram->init_lock); |
1067 | 1068 | ||
1068 | zram->queue = blk_alloc_queue(GFP_KERNEL); | 1069 | queue = blk_alloc_queue(GFP_KERNEL); |
1069 | if (!zram->queue) { | 1070 | if (!queue) { |
1070 | pr_err("Error allocating disk queue for device %d\n", | 1071 | pr_err("Error allocating disk queue for device %d\n", |
1071 | device_id); | 1072 | device_id); |
1072 | goto out; | 1073 | goto out; |
1073 | } | 1074 | } |
1074 | 1075 | ||
1075 | blk_queue_make_request(zram->queue, zram_make_request); | 1076 | blk_queue_make_request(queue, zram_make_request); |
1076 | zram->queue->queuedata = zram; | ||
1077 | 1077 | ||
1078 | /* gendisk structure */ | 1078 | /* gendisk structure */ |
1079 | zram->disk = alloc_disk(1); | 1079 | zram->disk = alloc_disk(1); |
@@ -1086,7 +1086,8 @@ static int create_device(struct zram *zram, int device_id) | |||
1086 | zram->disk->major = zram_major; | 1086 | zram->disk->major = zram_major; |
1087 | zram->disk->first_minor = device_id; | 1087 | zram->disk->first_minor = device_id; |
1088 | zram->disk->fops = &zram_devops; | 1088 | zram->disk->fops = &zram_devops; |
1089 | zram->disk->queue = zram->queue; | 1089 | zram->disk->queue = queue; |
1090 | zram->disk->queue->queuedata = zram; | ||
1090 | zram->disk->private_data = zram; | 1091 | zram->disk->private_data = zram; |
1091 | snprintf(zram->disk->disk_name, 16, "zram%d", device_id); | 1092 | snprintf(zram->disk->disk_name, 16, "zram%d", device_id); |
1092 | 1093 | ||
@@ -1137,7 +1138,7 @@ out_free_disk: | |||
1137 | del_gendisk(zram->disk); | 1138 | del_gendisk(zram->disk); |
1138 | put_disk(zram->disk); | 1139 | put_disk(zram->disk); |
1139 | out_free_queue: | 1140 | out_free_queue: |
1140 | blk_cleanup_queue(zram->queue); | 1141 | blk_cleanup_queue(queue); |
1141 | out: | 1142 | out: |
1142 | return ret; | 1143 | return ret; |
1143 | } | 1144 | } |
@@ -1158,10 +1159,9 @@ static void destroy_devices(unsigned int nr) | |||
1158 | 1159 | ||
1159 | zram_reset_device(zram); | 1160 | zram_reset_device(zram); |
1160 | 1161 | ||
1162 | blk_cleanup_queue(zram->disk->queue); | ||
1161 | del_gendisk(zram->disk); | 1163 | del_gendisk(zram->disk); |
1162 | put_disk(zram->disk); | 1164 | put_disk(zram->disk); |
1163 | |||
1164 | blk_cleanup_queue(zram->queue); | ||
1165 | } | 1165 | } |
1166 | 1166 | ||
1167 | kfree(zram_devices); | 1167 | kfree(zram_devices); |
diff --git a/drivers/block/zram/zram_drv.h b/drivers/block/zram/zram_drv.h index 5249f51ccdb3..17056e589146 100644 --- a/drivers/block/zram/zram_drv.h +++ b/drivers/block/zram/zram_drv.h | |||
@@ -101,7 +101,6 @@ struct zram_meta { | |||
101 | struct zram { | 101 | struct zram { |
102 | struct zram_meta *meta; | 102 | struct zram_meta *meta; |
103 | struct zcomp *comp; | 103 | struct zcomp *comp; |
104 | struct request_queue *queue; | ||
105 | struct gendisk *disk; | 104 | struct gendisk *disk; |
106 | /* Prevent concurrent execution of device init */ | 105 | /* Prevent concurrent execution of device init */ |
107 | struct rw_semaphore init_lock; | 106 | struct rw_semaphore init_lock; |