diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index 48b70d7c8..a801a8bb5 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -2859,9 +2859,6 @@ static void blockio_exec_rw(struct scst_cmd *cmd, struct scst_vdisk_thr *thr, struct scst_blockio_work *blockio_work; int bios = 0; gfp_t gfp_mask = (cmd->noio_mem_alloc ? GFP_NOIO : GFP_KERNEL); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39) - struct blk_plug plug; -#endif TRACE_ENTRY(); @@ -2967,9 +2964,6 @@ static void blockio_exec_rw(struct scst_cmd *cmd, struct scst_vdisk_thr *thr, /* +1 to prevent erroneous too early command completion */ atomic_set(&blockio_work->bios_inflight, bios+1); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39) - blk_start_plug(&plug); -#endif while (hbio) { bio = hbio; hbio = hbio->bi_next; @@ -2977,12 +2971,8 @@ static void blockio_exec_rw(struct scst_cmd *cmd, struct scst_vdisk_thr *thr, submit_bio((write != 0), bio); } -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39) if (q && q->unplug_fn) q->unplug_fn(q); -#else - blk_finish_plug(&plug); -#endif blockio_check_finish(blockio_work); diff --git a/scst/src/scst_pres.c b/scst/src/scst_pres.c index 8f1a5ff9f..f0b0f0495 100644 --- a/scst/src/scst_pres.c +++ b/scst/src/scst_pres.c @@ -568,33 +568,28 @@ out: #ifndef CONFIG_SCST_PROC /* Abstract vfs_unlink & path_put for different kernel versions */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) static inline void scst_pr_vfs_unlink_and_put(struct nameidata *nd) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) vfs_unlink(nd->dentry->d_parent->d_inode, nd->dentry); dput(nd->dentry); mntput(nd->mnt); -} #else -static inline void scst_pr_vfs_unlink_and_put(struct path *path) -{ - vfs_unlink(path->dentry->d_parent->d_inode, path->dentry); - path_put(path); -} + vfs_unlink(nd->path.dentry->d_parent->d_inode, + nd->path.dentry); + path_put(&nd->path); #endif +} -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) static inline void scst_pr_path_put(struct nameidata *nd) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) dput(nd->dentry); mntput(nd->mnt); -} #else -static inline void scst_pr_path_put(struct path *path) -{ - path_put(path); -} + path_put(&nd->path); #endif +} #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29) static int scst_pr_vfs_fsync(struct file *file, loff_t loff, loff_t len) @@ -907,59 +902,27 @@ out: return res; } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25) \ - && LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 27) -static int kern_path(const char *name, unsigned int flags, struct path *path) -{ - struct nameidata nd; - int res = path_lookup(name, flags, &nd); - if (!res) - *path = nd.path; - return res; -} -#endif - static void scst_pr_remove_device_files(struct scst_tgt_dev *tgt_dev) { int res = 0; struct scst_device *dev = tgt_dev->dev; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25) struct nameidata nd; -#else - struct path path; -#endif mm_segment_t old_fs = get_fs(); TRACE_ENTRY(); set_fs(KERNEL_DS); -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25) res = path_lookup(dev->pr_file_name, 0, &nd); -#else - res = kern_path(dev->pr_file_name, 0, &path); -#endif if (!res) -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25) scst_pr_vfs_unlink_and_put(&nd); -#else - scst_pr_vfs_unlink_and_put(&path); -#endif else TRACE_DBG("Unable to lookup file '%s' - error %d", dev->pr_file_name, res); -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25) res = path_lookup(dev->pr_file_name1, 0, &nd); -#else - res = kern_path(dev->pr_file_name1, 0, &path); -#endif if (!res) -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25) scst_pr_vfs_unlink_and_put(&nd); -#else - scst_pr_vfs_unlink_and_put(&path); -#endif else TRACE_DBG("Unable to lookup file '%s' - error %d", dev->pr_file_name1, res); @@ -1142,24 +1105,12 @@ write_error: write_error_close: filp_close(file, NULL); { -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25) struct nameidata nd; -#else - struct path path; -#endif int rc; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25) rc = path_lookup(dev->pr_file_name, 0, &nd); -#else - rc = kern_path(dev->pr_file_name, 0, &path); -#endif if (!rc) -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25) scst_pr_vfs_unlink_and_put(&nd); -#else - scst_pr_vfs_unlink_and_put(&path); -#endif else TRACE_PR("Unable to lookup '%s' - error %d", dev->pr_file_name, rc); @@ -1170,22 +1121,14 @@ write_error_close: static int scst_pr_check_pr_path(void) { int res; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25) struct nameidata nd; -#else - struct path path; -#endif mm_segment_t old_fs = get_fs(); TRACE_ENTRY(); set_fs(KERNEL_DS); -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25) res = path_lookup(SCST_PR_DIR, 0, &nd); -#else - res = kern_path(SCST_PR_DIR, 0, &path); -#endif if (res != 0) { PRINT_ERROR("Unable to find %s (err %d), you should create " "this directory manually or reinstall SCST", @@ -1193,11 +1136,7 @@ static int scst_pr_check_pr_path(void) goto out_setfs; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25) scst_pr_path_put(&nd); -#else - scst_pr_path_put(&path); -#endif out_setfs: set_fs(old_fs); diff --git a/scst/src/scst_targ.c b/scst/src/scst_targ.c index 3950b0709..bcbb7bea5 100644 --- a/scst/src/scst_targ.c +++ b/scst/src/scst_targ.c @@ -2629,11 +2629,9 @@ static inline int scst_real_exec(struct scst_cmd *cmd) res = scst_do_real_exec(cmd); if (likely(res == SCST_EXEC_COMPLETED)) { scst_post_exec_sn(cmd, true); -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39) if (cmd->dev->scsi_dev != NULL) generic_unplug_device( cmd->dev->scsi_dev->request_queue); -#endif } else sBUG(); @@ -2736,6 +2734,7 @@ static int scst_exec(struct scst_cmd **active_cmd) { struct scst_cmd *cmd = *active_cmd; struct scst_cmd *ref_cmd; + struct scst_device *dev = cmd->dev; int res = SCST_CMD_STATE_RES_CONT_NEXT, count; TRACE_ENTRY(); @@ -2796,10 +2795,8 @@ done: if (count == 0) goto out_put; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39) - if (cmd->dev->scsi_dev != NULL) - generic_unplug_device(cmd->dev->scsi_dev->request_queue); -#endif + if (dev->scsi_dev != NULL) + generic_unplug_device(dev->scsi_dev->request_queue); out_put: __scst_cmd_put(ref_cmd);