From e913b69ef904aef82d7c4c6ac3dec9b7b55a6d3c Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Tue, 10 Sep 2013 03:01:41 +0000 Subject: [PATCH] Cleanups git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4993 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/dev_handlers/scst_vdisk.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index f4d28ea29..f398164a6 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -1914,7 +1914,6 @@ static int vdisk_unmap_range(struct scst_cmd *cmd, { int res, err; struct file *fd = virt_dev->fd; - struct inode *inode = fd->f_dentry->d_inode; TRACE_ENTRY(); @@ -1935,6 +1934,7 @@ static int vdisk_unmap_range(struct scst_cmd *cmd, (unsigned long long)start_lba, (unsigned long long)blocks); if (virt_dev->blockio) { + struct inode *inode = fd->f_dentry->d_inode; #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 27) gfp_t gfp = scst_cmd_get_gfp_flags(cmd); #if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 31) @@ -3278,7 +3278,7 @@ static int vdisk_fsync_blockio(struct vdisk_cmd_params *p, loff_t loff, loff_t len, struct scst_device *dev, gfp_t gfp_flags, struct scst_cmd *cmd, bool async) { - int res = 0; + int res; struct scst_vdisk_dev *virt_dev = dev->dh_priv; TRACE_ENTRY(); @@ -3298,10 +3298,9 @@ static int vdisk_fsync_blockio(struct vdisk_cmd_params *p, loff_t loff, } static int vdisk_fsync_fileio(struct vdisk_cmd_params *p, loff_t loff, - loff_t len, struct scst_device *dev, gfp_t gfp_flags, - struct scst_cmd *cmd, bool async) + loff_t len, struct scst_device *dev, struct scst_cmd *cmd, bool async) { - int res = 0; + int res; struct scst_vdisk_dev *virt_dev = dev->dh_priv; struct file *file; @@ -3326,7 +3325,6 @@ static int vdisk_fsync_fileio(struct vdisk_cmd_params *p, loff_t loff, res = filemap_write_and_wait_range(file->f_mapping, loff, len); #endif #endif - if (unlikely(res != 0)) { PRINT_ERROR("sync range failed (%d)", res); if (cmd != NULL) { @@ -3378,7 +3376,7 @@ static int vdisk_fsync(struct vdisk_cmd_params *p, loff_t loff, if (virt_dev->blockio) res = vdisk_fsync_blockio(p, loff, len, dev, gfp_flags, cmd, async); else - res = vdisk_fsync_fileio(p, loff, len, dev, gfp_flags, cmd, async); + res = vdisk_fsync_fileio(p, loff, len, dev, cmd, async); out: TRACE_EXIT_RES(res);