Commit ee98016010ae036a5b27300d83bd99ef3fd5776e
Committed by
Linus Torvalds
1 parent
08eee69fcf
Exists in
ti-lsk-linux-4.1.y
and in
10 other branches
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>
Showing 2 changed files with 8 additions and 9 deletions Side-by-side Diff
drivers/block/zram/zram_drv.c
... | ... | @@ -1061,19 +1061,19 @@ |
1061 | 1061 | |
1062 | 1062 | static int create_device(struct zram *zram, int device_id) |
1063 | 1063 | { |
1064 | + struct request_queue *queue; | |
1064 | 1065 | int ret = -ENOMEM; |
1065 | 1066 | |
1066 | 1067 | init_rwsem(&zram->init_lock); |
1067 | 1068 | |
1068 | - zram->queue = blk_alloc_queue(GFP_KERNEL); | |
1069 | - if (!zram->queue) { | |
1069 | + queue = blk_alloc_queue(GFP_KERNEL); | |
1070 | + if (!queue) { | |
1070 | 1071 | pr_err("Error allocating disk queue for device %d\n", |
1071 | 1072 | device_id); |
1072 | 1073 | goto out; |
1073 | 1074 | } |
1074 | 1075 | |
1075 | - blk_queue_make_request(zram->queue, zram_make_request); | |
1076 | - zram->queue->queuedata = zram; | |
1076 | + blk_queue_make_request(queue, zram_make_request); | |
1077 | 1077 | |
1078 | 1078 | /* gendisk structure */ |
1079 | 1079 | zram->disk = alloc_disk(1); |
... | ... | @@ -1086,7 +1086,8 @@ |
1086 | 1086 | zram->disk->major = zram_major; |
1087 | 1087 | zram->disk->first_minor = device_id; |
1088 | 1088 | zram->disk->fops = &zram_devops; |
1089 | - zram->disk->queue = zram->queue; | |
1089 | + zram->disk->queue = queue; | |
1090 | + zram->disk->queue->queuedata = zram; | |
1090 | 1091 | zram->disk->private_data = zram; |
1091 | 1092 | snprintf(zram->disk->disk_name, 16, "zram%d", device_id); |
1092 | 1093 | |
... | ... | @@ -1137,7 +1138,7 @@ |
1137 | 1138 | del_gendisk(zram->disk); |
1138 | 1139 | put_disk(zram->disk); |
1139 | 1140 | out_free_queue: |
1140 | - blk_cleanup_queue(zram->queue); | |
1141 | + blk_cleanup_queue(queue); | |
1141 | 1142 | out: |
1142 | 1143 | return ret; |
1143 | 1144 | } |
1144 | 1145 | |
... | ... | @@ -1158,10 +1159,9 @@ |
1158 | 1159 | |
1159 | 1160 | zram_reset_device(zram); |
1160 | 1161 | |
1162 | + blk_cleanup_queue(zram->disk->queue); | |
1161 | 1163 | del_gendisk(zram->disk); |
1162 | 1164 | put_disk(zram->disk); |
1163 | - | |
1164 | - blk_cleanup_queue(zram->queue); | |
1165 | 1165 | } |
1166 | 1166 | |
1167 | 1167 | kfree(zram_devices); |
drivers/block/zram/zram_drv.h