Commit d7e3c3249ef23b4617393c69fe464765b4ff1645

Authored by FUJITA Tomonori
Committed by Jens Axboe
1 parent d34c87e4ba

block: add large command support

This patch changes rq->cmd from the static array to a pointer to
support large commands.

We rarely handle large commands. So for optimization, a struct request
still has a static array for a command. rq_init sets rq->cmd pointer
to the static array.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>

Showing 2 changed files with 4 additions and 2 deletions Side-by-side Diff

... ... @@ -117,6 +117,7 @@
117 117 rq->sector = rq->hard_sector = (sector_t) -1;
118 118 INIT_HLIST_NODE(&rq->hash);
119 119 RB_CLEAR_NODE(&rq->rb_node);
  120 + rq->cmd = rq->__cmd;
120 121 rq->tag = -1;
121 122 rq->ref_count = 1;
122 123 }
include/linux/blkdev.h
... ... @@ -215,8 +215,9 @@
215 215 /*
216 216 * when request is used as a packet command carrier
217 217 */
218   - unsigned int cmd_len;
219   - unsigned char cmd[BLK_MAX_CDB];
  218 + unsigned short cmd_len;
  219 + unsigned char __cmd[BLK_MAX_CDB];
  220 + unsigned char *cmd;
220 221  
221 222 unsigned int data_len;
222 223 unsigned int extra_len; /* length of alignment and padding */