From 57b16a2fd8ec426fa34c16047099f5e2b1156ff0 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Tue, 2 May 2017 14:13:15 +0000 Subject: [PATCH] scst_lib: Fix kernel 2.6.30 build git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7162 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/scst_lib.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index 3da17c97f..3bf505191 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -8277,15 +8277,18 @@ static void scsi_end_async(struct request *req, int error) #endif #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) resid_len = scsi_req(req)->resid_len; -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30) +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31) resid_len = req->resid_len; +#else + /* + * A quote from commit c3a4d78c580d: "rq->data_len served two + * purposes - the length of data buffer on issue and the + * residual count on completion." + */ + resid_len = req->data_len; #endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30) sioc->done(sioc->data, sioc->sense, result, resid_len); -#else - sioc->done(sioc->data, sioc->sense, result, req->data_len); -#endif } kmem_cache_free(scsi_io_context_cache, sioc);