Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

target/rd: always chain S/G list

The rd sg lists are never passed to hardware, so use S/G chaining
unonditionally.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@fb.com>

authored by

Christoph Hellwig and committed by
Jens Axboe
02c4de53 10c95ed9

-44
-44
drivers/target/target_core_rd.c
··· 138 138 sg_per_table = (total_sg_needed > max_sg_per_table) ? 139 139 max_sg_per_table : total_sg_needed; 140 140 141 - #ifdef CONFIG_ARCH_HAS_SG_CHAIN 142 - 143 141 /* 144 142 * Reserve extra element for chain entry 145 143 */ 146 144 if (sg_per_table < total_sg_needed) 147 145 chain_entry = 1; 148 - 149 - #endif /* CONFIG_ARCH_HAS_SG_CHAIN */ 150 146 151 147 sg = kcalloc(sg_per_table + chain_entry, sizeof(*sg), 152 148 GFP_KERNEL); ··· 154 158 155 159 sg_init_table(sg, sg_per_table + chain_entry); 156 160 157 - #ifdef CONFIG_ARCH_HAS_SG_CHAIN 158 - 159 161 if (i > 0) { 160 162 sg_chain(sg_table[i - 1].sg_table, 161 163 max_sg_per_table + 1, sg); 162 164 } 163 - 164 - #endif /* CONFIG_ARCH_HAS_SG_CHAIN */ 165 165 166 166 sg_table[i].sg_table = sg; 167 167 sg_table[i].rd_sg_count = sg_per_table; ··· 420 428 421 429 prot_sg = &prot_table->sg_table[prot_page - 422 430 prot_table->page_start_offset]; 423 - 424 - #ifndef CONFIG_ARCH_HAS_SG_CHAIN 425 - 426 - prot_npages = DIV_ROUND_UP(prot_offset + sectors * se_dev->prot_length, 427 - PAGE_SIZE); 428 - 429 - /* 430 - * Allocate temporaly contiguous scatterlist entries if prot pages 431 - * straddles multiple scatterlist tables. 432 - */ 433 - if (prot_table->page_end_offset < prot_page + prot_npages - 1) { 434 - int i; 435 - 436 - prot_sg = kcalloc(prot_npages, sizeof(*prot_sg), GFP_KERNEL); 437 - if (!prot_sg) 438 - return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; 439 - 440 - need_to_release = true; 441 - sg_init_table(prot_sg, prot_npages); 442 - 443 - for (i = 0; i < prot_npages; i++) { 444 - if (prot_page + i > prot_table->page_end_offset) { 445 - prot_table = rd_get_prot_table(dev, 446 - prot_page + i); 447 - if (!prot_table) { 448 - kfree(prot_sg); 449 - return rc; 450 - } 451 - sg_unmark_end(&prot_sg[i - 1]); 452 - } 453 - prot_sg[i] = prot_table->sg_table[prot_page + i - 454 - prot_table->page_start_offset]; 455 - } 456 - } 457 - 458 - #endif /* !CONFIG_ARCH_HAS_SG_CHAIN */ 459 431 460 432 if (is_read) 461 433 rc = sbc_dif_verify(cmd, cmd->t_task_lba, sectors, 0,