Lines Matching refs:cmd
261 static int fd_do_prot_rw(struct se_cmd *cmd, struct fd_prot *fd_prot, in fd_do_prot_rw() argument
264 struct se_device *se_dev = cmd->se_dev; in fd_do_prot_rw()
267 loff_t pos = (cmd->t_task_lba * se_dev->prot_length); in fd_do_prot_rw()
272 prot_size = (cmd->data_length / se_dev->dev_attrib.block_size) * in fd_do_prot_rw()
319 static int fd_do_rw(struct se_cmd *cmd, struct scatterlist *sgl, in fd_do_rw() argument
322 struct se_device *se_dev = cmd->se_dev; in fd_do_rw()
329 loff_t pos = (cmd->t_task_lba * se_dev->dev_attrib.block_size); in fd_do_rw()
355 if (ret < 0 || ret != cmd->data_length) { in fd_do_rw()
366 if (ret < 0 || ret != cmd->data_length) { in fd_do_rw()
369 cmd->data_length); in fd_do_rw()
384 fd_execute_sync_cache(struct se_cmd *cmd) in fd_execute_sync_cache() argument
386 struct se_device *dev = cmd->se_dev; in fd_execute_sync_cache()
388 int immed = (cmd->t_task_cdb[1] & 0x2); in fd_execute_sync_cache()
397 target_complete_cmd(cmd, SAM_STAT_GOOD); in fd_execute_sync_cache()
402 if (cmd->t_task_lba == 0 && cmd->data_length == 0) { in fd_execute_sync_cache()
406 start = cmd->t_task_lba * dev->dev_attrib.block_size; in fd_execute_sync_cache()
407 if (cmd->data_length) in fd_execute_sync_cache()
408 end = start + cmd->data_length - 1; in fd_execute_sync_cache()
421 target_complete_cmd(cmd, SAM_STAT_CHECK_CONDITION); in fd_execute_sync_cache()
423 target_complete_cmd(cmd, SAM_STAT_GOOD); in fd_execute_sync_cache()
429 fd_execute_write_same(struct se_cmd *cmd) in fd_execute_write_same() argument
431 struct se_device *se_dev = cmd->se_dev; in fd_execute_write_same()
433 loff_t pos = cmd->t_task_lba * se_dev->dev_attrib.block_size; in fd_execute_write_same()
434 sector_t nolb = sbc_get_write_same_sectors(cmd); in fd_execute_write_same()
441 target_complete_cmd(cmd, SAM_STAT_GOOD); in fd_execute_write_same()
444 if (cmd->prot_op) { in fd_execute_write_same()
450 if (cmd->t_data_nents > 1 || in fd_execute_write_same()
451 cmd->t_data_sg[0].length != cmd->se_dev->dev_attrib.block_size) { in fd_execute_write_same()
454 cmd->t_data_nents, in fd_execute_write_same()
455 cmd->t_data_sg[0].length, in fd_execute_write_same()
456 cmd->se_dev->dev_attrib.block_size); in fd_execute_write_same()
465 bvec[i].bv_page = sg_page(&cmd->t_data_sg[0]); in fd_execute_write_same()
466 bvec[i].bv_len = cmd->t_data_sg[0].length; in fd_execute_write_same()
467 bvec[i].bv_offset = cmd->t_data_sg[0].offset; in fd_execute_write_same()
481 target_complete_cmd(cmd, SAM_STAT_GOOD); in fd_execute_write_same()
516 fd_do_prot_unmap(struct se_cmd *cmd, sector_t lba, sector_t nolb) in fd_do_prot_unmap() argument
528 rc = fd_do_prot_fill(cmd->se_dev, lba, nolb, buf, PAGE_SIZE); in fd_do_prot_unmap()
536 fd_do_unmap(struct se_cmd *cmd, void *priv, sector_t lba, sector_t nolb) in fd_do_unmap() argument
542 if (cmd->se_dev->dev_attrib.pi_prot_type) { in fd_do_unmap()
543 ret = fd_do_prot_unmap(cmd, lba, nolb); in fd_do_unmap()
561 struct se_device *se_dev = cmd->se_dev; in fd_do_unmap()
580 fd_execute_write_same_unmap(struct se_cmd *cmd) in fd_execute_write_same_unmap() argument
582 struct se_device *se_dev = cmd->se_dev; in fd_execute_write_same_unmap()
585 sector_t lba = cmd->t_task_lba; in fd_execute_write_same_unmap()
586 sector_t nolb = sbc_get_write_same_sectors(cmd); in fd_execute_write_same_unmap()
590 target_complete_cmd(cmd, SAM_STAT_GOOD); in fd_execute_write_same_unmap()
594 ret = fd_do_unmap(cmd, file, lba, nolb); in fd_execute_write_same_unmap()
598 target_complete_cmd(cmd, GOOD); in fd_execute_write_same_unmap()
603 fd_execute_unmap(struct se_cmd *cmd) in fd_execute_unmap() argument
605 struct file *file = FD_DEV(cmd->se_dev)->fd_file; in fd_execute_unmap()
607 return sbc_execute_unmap(cmd, fd_do_unmap, file); in fd_execute_unmap()
611 fd_execute_rw(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents, in fd_execute_rw() argument
614 struct se_device *dev = cmd->se_dev; in fd_execute_rw()
622 if (cmd->data_length > FD_MAX_BYTES) { in fd_execute_rw()
625 cmd->data_length, FD_MAX_BYTES); in fd_execute_rw()
635 if (cmd->prot_type && dev->dev_attrib.pi_prot_type) { in fd_execute_rw()
636 ret = fd_do_prot_rw(cmd, &fd_prot, false); in fd_execute_rw()
641 ret = fd_do_rw(cmd, sgl, sgl_nents, 0); in fd_execute_rw()
643 if (ret > 0 && cmd->prot_type && dev->dev_attrib.pi_prot_type) { in fd_execute_rw()
644 u32 sectors = cmd->data_length / dev->dev_attrib.block_size; in fd_execute_rw()
646 rc = sbc_dif_verify_read(cmd, cmd->t_task_lba, sectors, in fd_execute_rw()
659 if (cmd->prot_type && dev->dev_attrib.pi_prot_type) { in fd_execute_rw()
660 u32 sectors = cmd->data_length / dev->dev_attrib.block_size; in fd_execute_rw()
662 ret = fd_do_prot_rw(cmd, &fd_prot, false); in fd_execute_rw()
666 rc = sbc_dif_verify_write(cmd, cmd->t_task_lba, sectors, in fd_execute_rw()
675 ret = fd_do_rw(cmd, sgl, sgl_nents, 1); in fd_execute_rw()
683 (cmd->se_cmd_flags & SCF_FUA)) { in fd_execute_rw()
685 loff_t start = cmd->t_task_lba * in fd_execute_rw()
689 if (cmd->data_length) in fd_execute_rw()
690 end = start + cmd->data_length - 1; in fd_execute_rw()
697 if (ret > 0 && cmd->prot_type && dev->dev_attrib.pi_prot_type) { in fd_execute_rw()
698 ret = fd_do_prot_rw(cmd, &fd_prot, true); in fd_execute_rw()
711 target_complete_cmd(cmd, SAM_STAT_GOOD); in fd_execute_rw()
916 fd_parse_cdb(struct se_cmd *cmd) in fd_parse_cdb() argument
918 return sbc_parse_cdb(cmd, &fd_sbc_ops); in fd_parse_cdb()