diff options
author | Christoph Hellwig <hch@lst.de> | 2015-06-19 15:10:59 +0200 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2015-06-23 00:43:44 -0700 |
commit | 62e4694256dd3cbe301ebc0da799df8779b97014 (patch) | |
tree | 4d0900d5d8d2dcb5acd2f1e2d390c9d18e1e0629 /drivers/target/target_core_file.c | |
parent | 7a971b1b3055f0e76ff09b8fd0dd809ea3b48279 (diff) | |
download | linux-stable-62e4694256dd3cbe301ebc0da799df8779b97014.tar.gz linux-stable-62e4694256dd3cbe301ebc0da799df8779b97014.tar.bz2 linux-stable-62e4694256dd3cbe301ebc0da799df8779b97014.zip |
target: simplify UNMAP handling
Move a little more processing into the core code, and lift the previous
do_unmap callback into the sbc_ops structure.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Andy Grover <agrover@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target/target_core_file.c')
-rw-r--r-- | drivers/target/target_core_file.c | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c index 238e3a256d04..ced8c4fdc23d 100644 --- a/drivers/target/target_core_file.c +++ b/drivers/target/target_core_file.c @@ -475,9 +475,9 @@ fd_do_prot_unmap(struct se_cmd *cmd, sector_t lba, sector_t nolb) } static sense_reason_t -fd_do_unmap(struct se_cmd *cmd, void *priv, sector_t lba, sector_t nolb) +fd_execute_unmap(struct se_cmd *cmd, sector_t lba, sector_t nolb) { - struct file *file = priv; + struct file *file = FD_DEV(cmd->se_dev)->fd_file; struct inode *inode = file->f_mapping->host; int ret; @@ -521,9 +521,6 @@ fd_do_unmap(struct se_cmd *cmd, void *priv, sector_t lba, sector_t nolb) static sense_reason_t fd_execute_write_same_unmap(struct se_cmd *cmd) { - struct se_device *se_dev = cmd->se_dev; - struct fd_dev *fd_dev = FD_DEV(se_dev); - struct file *file = fd_dev->fd_file; sector_t lba = cmd->t_task_lba; sector_t nolb = sbc_get_write_same_sectors(cmd); sense_reason_t ret; @@ -533,7 +530,7 @@ fd_execute_write_same_unmap(struct se_cmd *cmd) return 0; } - ret = fd_do_unmap(cmd, file, lba, nolb); + ret = fd_execute_unmap(cmd, lba, nolb); if (ret) return ret; @@ -542,14 +539,6 @@ fd_execute_write_same_unmap(struct se_cmd *cmd) } static sense_reason_t -fd_execute_unmap(struct se_cmd *cmd) -{ - struct file *file = FD_DEV(cmd->se_dev)->fd_file; - - return sbc_execute_unmap(cmd, fd_do_unmap, file); -} - -static sense_reason_t fd_execute_rw(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents, enum dma_data_direction data_direction) { |