null-blk: save memory footprint for struct nullb_cmd

Total 16 bytes can be saved in two ways:

1) The field 'bio' will only be used in bio based mode, and the field
   'rq' will only be used in mq mode. Since they won't be used in the
   same time, declare a union for them.
2) The field 'bool fake_timeout' can be placed in the hole after the
   field 'error'.

Signed-off-by: Yu Kuai <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
This commit is contained in:
Yu Kuai authored and Jens Axboe committed 2022-04-25 20:31:20 -06:00
1 parent 5ea7c1339e
commit 8ba816b23a
1 file changed
+5 -3
+5 -3
View File
@@ -16,13 +16,15 @@
#include <linux/mutex.h>
struct nullb_cmd {
struct request *rq;
struct bio *bio;
union {
struct request *rq;
struct bio *bio;
};
unsigned int tag;
blk_status_t error;
bool fake_timeout;
struct nullb_queue *nq;
struct hrtimer timer;
bool fake_timeout;
};
struct nullb_queue {