[PATCH] scsi_dh: remove unused declaration dm_pg_init_complete()

2013-04-16 Thread Ren Mingxin
This patch removes dm_pg_init_complete()'s declaration as it is
not needed anymore since 2651f5d7d3bc5120a439e498f131e4d731f99b3e.

Signed-off-by: Ren Mingxin 
---
 drivers/md/dm-mpath.h |3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/drivers/md/dm-mpath.h b/drivers/md/dm-mpath.h
index e230f71..9c36d0f 100644
--- a/drivers/md/dm-mpath.h
+++ b/drivers/md/dm-mpath.h
@@ -16,7 +16,4 @@ struct dm_path {
void *pscontext;/* For path-selector use */
 };
 
-/* Callback for hwh_pg_init_fn to use when complete */
-void dm_pg_init_complete(struct dm_path *path, unsigned err_flags);
-
 #endif
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 14/28] proc: Supply an accessor for getting the data from a PDE's parent [RFC]

2013-04-16 Thread Greg KH
On Tue, Apr 16, 2013 at 07:26:46PM +0100, David Howells wrote:
> Supply an accessor function for getting the private data from the parent
> proc_dir_entry struct of the proc_dir_entry struct associated with an inode.
> 
> ReiserFS, for instance, stores the super_block pointer in the proc directory
> it makes for that super_block, and a pointer to the respective seq_file show
> function in each of the proc files in that directory.
> 
> This allows a reduction in the number of file_operations structs, open
> functions and seq_operations structs required.  The problem otherwise is that
> each show function requires two pieces of data but only has storage for one
> per PDE (and this has no release function).
> 
> Signed-off-by: David Howells 
> cc: Jerry Chuang 
> cc: Mauro Carvalho Chehab 
> cc: Maxim Mikityanskiy 
> cc: YAMANE Toshiaki 
> cc: linux-wirel...@vger.kernel.org
> cc: linux-scsi@vger.kernel.org
> cc: de...@driverdev.osuosl.org

Acked-by: Greg Kroah-Hartman 
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 10/28] proc: Add proc_mkdir_data() [RFC]

2013-04-16 Thread Greg KH
On Tue, Apr 16, 2013 at 07:26:30PM +0100, David Howells wrote:
> Add proc_mkdir_data() to allow procfs directories to be created that are
> annotated at the time of creation with private data rather than doing this
> post-creation.  This means no access is then required to the proc_dir_entry
> struct to set this.
> 
> Signed-off-by: David Howells 
> cc: Neela Syam Kolli 
> cc: Jerry Chuang 
> cc: Mauro Carvalho Chehab 
> cc: linux-scsi@vger.kernel.org
> cc: de...@driverdev.osuosl.org
> cc: linux-wirel...@vger.kernel.org
> ---

Acked-by: Greg Kroah-Hartman 
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/4] Accelerated CRC T10 DIF computation with PCLMULQDQ instruction

2013-04-16 Thread Tim Chen
This is the x86_64 CRC T10 DIF transform accelerated with the PCLMULQDQ
instructions.  Details discussing the implementation can be found in the
paper:

"Fast CRC Computation for Generic Polynomials Using PCLMULQDQ Instruction"
URL: http://download.intel.com/design/intarch/papers/323102.pdf

Signed-off-by: Tim Chen 
Tested-by: Keith Busch 
---
 arch/x86/crypto/crct10dif-pcl-asm_64.S | 659 +
 1 file changed, 659 insertions(+)
 create mode 100644 arch/x86/crypto/crct10dif-pcl-asm_64.S

diff --git a/arch/x86/crypto/crct10dif-pcl-asm_64.S 
b/arch/x86/crypto/crct10dif-pcl-asm_64.S
new file mode 100644
index 000..c497d0e
--- /dev/null
+++ b/arch/x86/crypto/crct10dif-pcl-asm_64.S
@@ -0,0 +1,659 @@
+
+# Implement fast CRC-T10DIF computation with SSE and PCLMULQDQ instructions
+#
+# Copyright (c) 2013, Intel Corporation
+#
+# Authors:
+# Erdinc Ozturk 
+# Vinodh Gopal 
+# James Guilford 
+# Tim Chen 
+#
+# This software is available to you under a choice of one of two
+# licenses.  You may choose to be licensed under the terms of the GNU
+# General Public License (GPL) Version 2, available from the file
+# COPYING in the main directory of this source tree, or the
+# OpenIB.org BSD license below:
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in the
+#   documentation and/or other materials provided with the
+#   distribution.
+#
+# * Neither the name of the Intel Corporation nor the names of its
+#   contributors may be used to endorse or promote products derived from
+#   this software without specific prior written permission.
+#
+#
+# THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION ""AS IS"" AND ANY
+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES# LOSS OF USE, DATA, OR
+# PROFITS# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#   Function API:
+#   UINT16 crc_t10dif_pcl(
+#   UINT16 init_crc, //initial CRC value, 16 bits
+#   const unsigned char *buf, //buffer pointer to calculate CRC on
+#   UINT64 len //buffer length in bytes (64-bit data)
+#   )#
+#
+#   Reference paper titled "Fast CRC Computation for Generic
+#  Polynomials Using PCLMULQDQ Instruction"
+#   URL: http://download.intel.com/design/intarch/papers/323102.pdf
+#
+#
+
+#include 
+
+.text
+
+#definearg1 %rdi
+#definearg2 %rsi
+#definearg3 %rdx
+
+#definearg1_low32 %edi
+
+ENTRY(crc_t10dif_pcl)
+.align 16
+
+   # adjust the 16-bit initial_crc value, scale it to 32 bits
+   shl $16, arg1_low32
+
+   # Allocate Stack Space
+   mov %rsp, %rcx
+   sub $16*10, %rsp
+   and $~(0x20 - 1), %rsp
+
+   # push the xmm registers into the stack to maintain
+   movdqa %xmm10, 16*2(%rsp)
+   movdqa %xmm11, 16*3(%rsp)
+   movdqa %xmm8 , 16*4(%rsp)
+   movdqa %xmm12, 16*5(%rsp)
+   movdqa %xmm13, 16*6(%rsp)
+   movdqa %xmm6,  16*7(%rsp)
+   movdqa %xmm7,  16*8(%rsp)
+   movdqa %xmm9,  16*9(%rsp)
+
+
+   # check if smaller than 256
+   cmp $256, arg3
+
+   # for sizes less than 128, we can't fold 64B at a time...
+   jl  _less_than_128
+
+
+   # load the initial crc value
+   movdarg1_low32, %xmm10  # initial crc
+
+   # crc value does not need to be byte-reflected, but it needs
+   # to be moved to the high part of the register.
+   # because data will be byte-reflected and will align with
+   # initial crc at correct place.
+   pslldq  $12, %xmm10
+
+   movdqa  SHUF_MASK(%rip), %xmm11
+   # receive the initial 64B data, xor the initial crc value
+   movdqu  16*0(arg2), %xmm0
+   movdqu  16*1(arg2), %xmm1
+   movdqu  16*2(arg2), %xmm2
+   movdqu  16*3(arg2), %xmm3
+   movdqu  16*4(arg2), %xmm4
+   movdqu  16*5(arg2), %xmm5
+   movdqu  16*6(arg2), %xmm6
+   movdqu  16*7(ar

[PATCH 0/4] Patchset to use PCLMULQDQ to accelerate CRC-T10DIF checksum computation

2013-04-16 Thread Tim Chen
Herbert,

Currently the CRC-T10DIF checksum is computed using a generic table lookup
algorithm.  By switching the checksum to PCLMULQDQ based computation,
we can speedup the computation by 8x for checksumming 512 bytes and
even more for larger buffer size.  This will improve performance of SCSI
drivers turning on the CRC-T10IDF checksum.  In our SSD based experiments,
we have seen in disk throughput by 3.5x with T10DIF.

This patchset provide the x86_64 routine using PCLMULQDQ instruction
and switch the crc_t10dif library function to use the faster PCLMULQDQ
based routine when available.

Will appreciate if you can consider merging this for the 3.10 kernel.

Tim

Tim Chen (4):
  Wrap crc_t10dif function all to use crypto transform framework
  Accelerated CRC T10 DIF computation with PCLMULQDQ instruction
  Glue code to cast accelerated CRCT10DIF assembly as a crypto
transform
  Simple correctness and speed test for CRCT10DIF hash

 arch/x86/crypto/Makefile|   2 +
 arch/x86/crypto/crct10dif-pcl-asm_64.S  | 659 
 arch/x86/crypto/crct10dif-pclmul_glue.c | 153 
 crypto/Kconfig  |  21 +
 crypto/tcrypt.c |   8 +
 crypto/testmgr.c|  10 +
 crypto/testmgr.h|  24 ++
 include/linux/crc-t10dif.h  |  10 +
 lib/crc-t10dif.c|  96 +
 9 files changed, 983 insertions(+)
 create mode 100644 arch/x86/crypto/crct10dif-pcl-asm_64.S
 create mode 100644 arch/x86/crypto/crct10dif-pclmul_glue.c

-- 
1.7.11.7

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/4] Glue code to cast accelerated CRCT10DIF assembly as a crypto transform

2013-04-16 Thread Tim Chen
Glue code that plugs the PCLMULQDQ accelerated CRC T10 DIF hash into the
crypto framework.  The config CRYPTO_CRCT10DIF_PCLMUL should be turned
on to enable the feature.  The crc_t10dif crypto library function will
use this faster algorithm when crct10dif_pclmul module is loaded.

Signed-off-by: Tim Chen 
Tested-by: Keith Busch 
---
 arch/x86/crypto/Makefile|   2 +
 arch/x86/crypto/crct10dif-pclmul_glue.c | 153 
 crypto/Kconfig  |  21 +
 3 files changed, 176 insertions(+)
 create mode 100644 arch/x86/crypto/crct10dif-pclmul_glue.c

diff --git a/arch/x86/crypto/Makefile b/arch/x86/crypto/Makefile
index 03cd731..d544a66 100644
--- a/arch/x86/crypto/Makefile
+++ b/arch/x86/crypto/Makefile
@@ -27,6 +27,7 @@ obj-$(CONFIG_CRYPTO_SHA1_SSSE3) += sha1-ssse3.o
 obj-$(CONFIG_CRYPTO_CRC32_PCLMUL) += crc32-pclmul.o
 obj-$(CONFIG_CRYPTO_SHA256_SSSE3) += sha256-ssse3.o
 obj-$(CONFIG_CRYPTO_SHA512_SSSE3) += sha512-ssse3.o
+obj-$(CONFIG_CRYPTO_CRCT10DIF_PCLMUL) += crct10dif-pclmul.o
 
 # These modules require assembler to support AVX.
 ifeq ($(avx_supported),yes)
@@ -70,3 +71,4 @@ crc32c-intel-$(CONFIG_64BIT) += crc32c-pcl-intel-asm_64.o
 crc32-pclmul-y := crc32-pclmul_asm.o crc32-pclmul_glue.o
 sha256-ssse3-y := sha256-ssse3-asm.o sha256-avx-asm.o sha256-avx2-asm.o 
sha256_ssse3_glue.o
 sha512-ssse3-y := sha512-ssse3-asm.o sha512-avx-asm.o sha512-avx2-asm.o 
sha512_ssse3_glue.o
+crct10dif-pclmul-y := crct10dif-pcl-asm_64.o crct10dif-pclmul_glue.o
diff --git a/arch/x86/crypto/crct10dif-pclmul_glue.c 
b/arch/x86/crypto/crct10dif-pclmul_glue.c
new file mode 100644
index 000..e87f8d8
--- /dev/null
+++ b/arch/x86/crypto/crct10dif-pclmul_glue.c
@@ -0,0 +1,153 @@
+/*
+ * Cryptographic API.
+ *
+ * T10 Data Integrity Field CRC16 Crypto Xform using PCLMULQDQ Instructions
+ *
+ * Copyright (C) 2013 Intel Corporation
+ * Author: Tim Chen 
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+asmlinkage __u16 crc_t10dif_pcl(__u16 crc, const unsigned char *buf,
+   size_t len);
+
+struct chksum_desc_ctx {
+   __u16 crc;
+};
+
+/*
+ * Steps through buffer one byte at at time, calculates reflected
+ * crc using table.
+ */
+
+static int chksum_init(struct shash_desc *desc)
+{
+   struct chksum_desc_ctx *ctx = shash_desc_ctx(desc);
+
+   ctx->crc = 0;
+
+   return 0;
+}
+
+static int chksum_update(struct shash_desc *desc, const u8 *data,
+unsigned int length)
+{
+   struct chksum_desc_ctx *ctx = shash_desc_ctx(desc);
+
+   if (irq_fpu_usable()) {
+   kernel_fpu_begin();
+   ctx->crc = crc_t10dif_pcl(ctx->crc, data, length);
+   kernel_fpu_end();
+   } else
+   ctx->crc = crc_t10dif_generic(ctx->crc, data, length);
+   return 0;
+}
+
+static int chksum_final(struct shash_desc *desc, u8 *out)
+{
+   struct chksum_desc_ctx *ctx = shash_desc_ctx(desc);
+
+   *(__u16 *)out = ctx->crc;
+   return 0;
+}
+
+static int __chksum_finup(__u16 *crcp, const u8 *data, unsigned int len,
+   u8 *out)
+{
+   if (irq_fpu_usable()) {
+   kernel_fpu_begin();
+   *(__u16 *)out = crc_t10dif_pcl(*crcp, data, len);
+   kernel_fpu_end();
+   } else
+   *(__u16 *)out = crc_t10dif_generic(*crcp, data, len);
+   return 0;
+}
+
+static int chksum_finup(struct shash_desc *desc, const u8 *data,
+   unsigned int len, u8 *out)
+{
+   struct chksum_desc_ctx *ctx = shash_desc_ctx(desc);
+
+   return __chksum_finup(&ctx->crc, data, len, out);
+}
+
+static int chksum_digest(struct shash_desc *desc, const u8 *data,
+unsigned int length, u8 *out)
+{
+   struct chksum_desc_ctx *ctx = shash_desc_ctx(desc);
+
+   return __chksum_finup(&ctx->crc, data, length, out);
+}
+
+static struct shash_alg alg = {
+   .digestsize =   CRC_T10DIF_DIGEST_SIZE,
+   .init   =   chksum_init,
+   .update =   chksum_update,
+   .final  =   chksum_final,
+   .finup

[PATCH 1/4] Wrap crc_t10dif function all to use crypto transform framework

2013-04-16 Thread Tim Chen
When CRC T10 DIF is calculated using the crypto transform framework, we
wrap the crc_t10dif function call to utilize it.  This allows us to
take advantage of any accelerated CRC T10 DIF transform that is
plugged into the crypto framework.

Signed-off-by: Tim Chen 
Tested-by: Keith Busch 
---
 include/linux/crc-t10dif.h | 10 +
 lib/crc-t10dif.c   | 96 ++
 2 files changed, 106 insertions(+)

diff --git a/include/linux/crc-t10dif.h b/include/linux/crc-t10dif.h
index a9c96d8..f0eb4d5 100644
--- a/include/linux/crc-t10dif.h
+++ b/include/linux/crc-t10dif.h
@@ -3,6 +3,16 @@
 
 #include 
 
+#ifdef CONFIG_CRYPTO_CRCT10DIF
+
+#define CRC_T10DIF_DIGEST_SIZE 2
+#define CRC_T10DIF_BLOCK_SIZE 1
+
+__u16 crc_t10dif_generic(__u16 crc, const unsigned char *buffer, size_t len);
+void crc_t10dif_update_lib(void);
+
+#endif /* CONFIG_CRYPTO_CRCT10DIF */
+
 __u16 crc_t10dif(unsigned char const *, size_t);
 
 #endif
diff --git a/lib/crc-t10dif.c b/lib/crc-t10dif.c
index fbbd66e..41f469a 100644
--- a/lib/crc-t10dif.c
+++ b/lib/crc-t10dif.c
@@ -11,6 +11,9 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 
 /* Table generated using the following polynomium:
  * x^16 + x^15 + x^11 + x^9 + x^8 + x^7 + x^5 + x^4 + x^2 + x + 1
@@ -51,6 +54,98 @@ static const __u16 t10_dif_crc_table[256] = {
0xF0D8, 0x7B6F, 0x6C01, 0xE7B6, 0x42DD, 0xC96A, 0xDE04, 0x55B3
 };
 
+#ifdef CONFIG_CRYPTO_CRCT10DIF
+
+static struct crypto_shash *crct10dif_tfm;
+
+/* flag to indicate update to new algorithm in progress*/
+static bool crc_t10dif_newalg;
+
+__u16 crc_t10dif_generic(__u16 crc, const unsigned char *buffer, size_t len)
+{
+   unsigned int i;
+
+   for (i = 0 ; i < len ; i++)
+   crc = (crc << 8) ^ t10_dif_crc_table[((crc >> 8) ^ buffer[i]) & 
0xff];
+
+   return crc;
+}
+EXPORT_SYMBOL(crc_t10dif_generic);
+
+/*
+ * If we have defined crypto transform for CRC-T10DIF, use that instead.
+ * This allows us to plug in fast version of CRC-T10DIF when available.
+ */
+
+void crc_t10dif_update_lib()
+{
+   struct crypto_shash *old_tfm, *new_tfm;
+
+   old_tfm = crct10dif_tfm;
+   crc_t10dif_newalg = true;
+   /* make sure new alg flag is turned on before starting to switch tfm */
+   mb();
+
+   new_tfm = crypto_alloc_shash("crct10dif", 0, 0);
+   if (IS_ERR(new_tfm))
+   goto done;
+
+   if (old_tfm)
+   if (crypto_tfm_alg_priority(&old_tfm->base) >=
+   crypto_tfm_alg_priority(&new_tfm->base)) {
+   crypto_free_shash(new_tfm);
+   goto done;
+   }
+   crct10dif_tfm = new_tfm;
+   /* make sure update to tfm pointer is completed */
+   mb();
+   crypto_free_shash(old_tfm);
+
+done:
+   crc_t10dif_newalg = false;
+}
+EXPORT_SYMBOL(crc_t10dif_update_lib);
+
+__u16 crc_t10dif(const unsigned char *buffer, size_t len)
+{
+   struct {
+   struct shash_desc shash;
+   char ctx[2];
+   } desc;
+   int err;
+
+   /* plugging in new alg or not using a tfm? */
+   if (unlikely(crc_t10dif_newalg) || (!crct10dif_tfm))
+   return crc_t10dif_generic(0, buffer, len);
+
+   desc.shash.tfm = crct10dif_tfm;
+   desc.shash.flags = 0;
+   *(__u16 *)desc.ctx = 0;
+
+   err = crypto_shash_update(&desc.shash, buffer, len);
+   BUG_ON(err);
+
+   return *(__u16 *)desc.ctx;
+}
+EXPORT_SYMBOL(crc_t10dif);
+
+static int __init crc_t10dif_mod_init(void)
+{
+   crct10dif_tfm = NULL;
+   crc_t10dif_newalg = false;
+   return 0;
+}
+
+static void __exit crc_t10dif_mod_fini(void)
+{
+   if (crct10dif_tfm)
+   crypto_free_shash(crct10dif_tfm);
+}
+
+module_init(crc_t10dif_mod_init);
+module_exit(crc_t10dif_mod_fini);
+
+#else
 __u16 crc_t10dif(const unsigned char *buffer, size_t len)
 {
__u16 crc = 0;
@@ -62,6 +157,7 @@ __u16 crc_t10dif(const unsigned char *buffer, size_t len)
return crc;
 }
 EXPORT_SYMBOL(crc_t10dif);
+#endif
 
 MODULE_DESCRIPTION("T10 DIF CRC calculation");
 MODULE_LICENSE("GPL");
-- 
1.7.11.7

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/4] Simple correctness and speed test for CRCT10DIF hash

2013-04-16 Thread Tim Chen
These are simple tests to do sanity check of CRC T10 DIF hash.  The
correctness of the transform can be checked with the command
modprobe tcrypt mode=47
The speed of the transform can be evaluated with the command
modprobe tcrypt mode=320

Set the cpu frequency to constant and turn turbo off when running the
speed test so the frequency governor will not tweak the frequency and
affects the measurements.

Signed-off-by: Tim Chen 
Tested-by: Keith Busch 
---
 crypto/tcrypt.c  |  8 
 crypto/testmgr.c | 10 ++
 crypto/testmgr.h | 24 
 3 files changed, 42 insertions(+)

diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c
index 24ea7df..5e95722 100644
--- a/crypto/tcrypt.c
+++ b/crypto/tcrypt.c
@@ -1174,6 +1174,10 @@ static int do_test(int m)
ret += tcrypt_test("ghash");
break;
 
+   case 47:
+   ret += tcrypt_test("crct10dif");
+   break;
+
case 100:
ret += tcrypt_test("hmac(md5)");
break;
@@ -1498,6 +1502,10 @@ static int do_test(int m)
test_hash_speed("crc32c", sec, generic_hash_speed_template);
if (mode > 300 && mode < 400) break;
 
+   case 320:
+   test_hash_speed("crct10dif", sec, generic_hash_speed_template);
+   if (mode > 300 && mode < 400) break;
+
case 399:
break;
 
diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index 3807084..b165316 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -1944,6 +1944,16 @@ static const struct alg_test_desc alg_test_descs[] = {
}
}
}, {
+   .alg = "crct10dif",
+   .test = alg_test_hash,
+   .fips_allowed = 1,
+   .suite = {
+   .hash = {
+   .vecs = crct10dif_tv_template,
+   .count = CRCT10DIF_TEST_VECTORS
+   }
+   }
+   }, {
.alg = "cryptd(__driver-cbc-aes-aesni)",
.test = alg_test_null,
.fips_allowed = 1,
diff --git a/crypto/testmgr.h b/crypto/testmgr.h
index d503660..6262b74 100644
--- a/crypto/testmgr.h
+++ b/crypto/testmgr.h
@@ -450,6 +450,30 @@ static struct hash_testvec rmd320_tv_template[] = {
}
 };
 
+#define CRCT10DIF_TEST_VECTORS 2
+static struct hash_testvec crct10dif_tv_template[] = {
+   {
+   .plaintext = "abc",
+   .psize  = 3,
+#ifdef __LITTLE_ENDIAN
+   .digest = "\x3b\x44",
+#else
+   .digest = "\x44\x3b",
+#endif
+   }, {
+   .plaintext =
+   "abcd",
+   .psize  = 56,
+#ifdef __LITTLE_ENDIAN
+   .digest = "\xe3\x9c",
+#else
+   .digest = "\x9c\xe3",
+#endif
+   .np = 2,
+   .tap= { 28, 28 }
+   }
+};
+
 /*
  * SHA1 test vectors  from from FIPS PUB 180-1
  * Long vector from CAVS 5.0
-- 
1.7.11.7

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Patch 1/1] cciss: bug fix, prevent cciss from loading in kdump kernel

2013-04-16 Thread Andrew Morton
On Mon, 15 Apr 2013 12:59:06 -0500 Mike Miller  wrote:

> Patch 1/1
> 
> If hpsa is selected as the Smart Array driver cciss may try to load in the
> kdump kernel. When this happens kdump fails and a core file cannot be created.
> This patch prevents cciss from trying to load in this scenario. This effects
> primarily older Smart Array controllers.
> 

OK, this is weird.  kdump and scsi drivers are pretty darn remote things
and I've never heard of such an interaction.  Can you tell us a bit more
about how and why this happened?  Is there something special about
cciss, or can we expect similar kdump interactions with other device drivers?


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 10/28] proc: Add proc_mkdir_data() [RFC]

2013-04-16 Thread Mauro Carvalho Chehab

Em 16-04-2013 15:26, David Howells escreveu:

Add proc_mkdir_data() to allow procfs directories to be created that are
annotated at the time of creation with private data rather than doing this
post-creation.  This means no access is then required to the proc_dir_entry
struct to set this.

Signed-off-by: David Howells 
cc: Neela Syam Kolli 
cc: Jerry Chuang 
cc: Mauro Carvalho Chehab 
cc: linux-scsi@vger.kernel.org
cc: de...@driverdev.osuosl.org
cc: linux-wirel...@vger.kernel.org
---

  drivers/message/i2o/i2o_proc.c |8 ++--
  drivers/scsi/megaraid.c|4 ++--
  drivers/staging/rtl8192u/r8192U_core.c |3 +--


For the three patches that touch rtl8192u (patches 10, 12 and 14):

Acked-by: Mauro Carvalho Chehab 


  fs/proc/generic.c  |   30 --
  include/linux/proc_fs.h|   11 ---
  5 files changed, 25 insertions(+), 31 deletions(-)

diff --git a/drivers/message/i2o/i2o_proc.c b/drivers/message/i2o/i2o_proc.c
index 70a840f..b7d87cd 100644
--- a/drivers/message/i2o/i2o_proc.c
+++ b/drivers/message/i2o/i2o_proc.c
@@ -1913,14 +1913,12 @@ static void i2o_proc_device_add(struct proc_dir_entry 
*dir,

osm_debug("adding device /proc/i2o/%s/%s\n", dev->iop->name, buff);

-   devdir = proc_mkdir(buff, dir);
+   devdir = proc_mkdir_data(buff, 0, dir, dev);
if (!devdir) {
osm_warn("Could not allocate procdir!\n");
return;
}

-   devdir->data = dev;
-
i2o_proc_create_entries(devdir, generic_dev_entries, dev);

/* Inform core that we want updates about this device's status */
@@ -1954,12 +1952,10 @@ static int i2o_proc_iop_add(struct proc_dir_entry *dir,

osm_debug("adding IOP /proc/i2o/%s\n", c->name);

-   iopdir = proc_mkdir(c->name, dir);
+   iopdir = proc_mkdir_data(c->name, 0, dir, c);
if (!iopdir)
return -1;

-   iopdir->data = c;
-
i2o_proc_create_entries(iopdir, i2o_proc_generic_iop_entries, c);

list_for_each_entry(dev, &c->devices, list)
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index a1c90bd..ef3384d 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -2818,12 +2818,12 @@ mega_create_proc_entry(int index, struct proc_dir_entry 
*parent)

sprintf(string, "hba%d", adapter->host->host_no);

-   dir = adapter->controller_proc_dir_entry = proc_mkdir(string, parent);
+   dir = adapter->controller_proc_dir_entry =
+   proc_mkdir_data(string, 0, parent, adapter);
if(!dir) {
printk(KERN_WARNING "\nmegaraid: proc_mkdir failed\n");
return;
}
-   dir->data = adapter;

for (f = mega_proc_files; f->name; f++) {
de = proc_create_data(f->name, S_IRUSR, dir, &mega_proc_fops,
diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
b/drivers/staging/rtl8192u/r8192U_core.c
index 433c3df..d81d7d5 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -672,13 +672,12 @@ void rtl8192_proc_init_one(struct net_device *dev)
struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);

if (rtl8192_proc) {
-   priv->dir_dev = proc_mkdir(dev->name, rtl8192_proc);
+   priv->dir_dev = proc_mkdir_data(dev->name, 0, rtl8192_proc, 
dev);
if (!priv->dir_dev) {
RT_TRACE(COMP_ERR, "Unable to initialize 
/proc/net/rtl8192/%s\n",
 dev->name);
return;
}
-   priv->dir_dev->data = dev;

for (f = rtl8192_proc_files; f->name[0]; f++) {
if (!proc_create_data(f->name, S_IFREG | S_IRUGO,
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index 5f6f6c3..4074da5 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -428,13 +428,17 @@ struct proc_dir_entry *proc_symlink(const char *name,
  }
  EXPORT_SYMBOL(proc_symlink);

-struct proc_dir_entry *proc_mkdir_mode(const char *name, umode_t mode,
-   struct proc_dir_entry *parent)
+struct proc_dir_entry *proc_mkdir_data(const char *name, umode_t mode,
+   struct proc_dir_entry *parent, void *data)
  {
struct proc_dir_entry *ent;

+   if (mode == 0)
+   mode = S_IRUGO | S_IXUGO;
+
ent = __proc_create(&parent, name, S_IFDIR | mode, 2);
if (ent) {
+   ent->data = data;
if (proc_register(parent, ent) < 0) {
kfree(ent);
ent = NULL;
@@ -442,29 +446,19 @@ struct proc_dir_entry *proc_mkdir_mode(const char *name, 
umode_t mode,
}
return ent;
  }
-EXPORT_SYMBOL(proc_mkdir_mode);
+EXPORT_SYMBOL_GPL(proc_mkdir_data);

-struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name,
-   struct proc_dir_entry *pa

Re: [patch] [SCSI] megaraid_sas: release lock on error path

2013-04-16 Thread adam radford
On Tue, Apr 16, 2013 at 12:44 AM, Dan Carpenter
 wrote:
> We should unlock here before returning.
>
> Signed-off-by: Dan Carpenter 
>
> diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c 
> b/drivers/scsi/megaraid/megaraid_sas_base.c
> index 9d53540..eb2385f 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_base.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_base.c
> @@ -4931,11 +4931,12 @@ static int megasas_mgmt_ioctl_fw(struct file *file, 
> unsigned long arg)
> printk(KERN_ERR "megaraid_sas: timed out while"
> "waiting for HBA to recover\n");
> error = -ENODEV;
> -   goto out_kfree_ioc;
> +   goto out_up;
> }
> spin_unlock_irqrestore(&instance->hba_lock, flags);
>
> error = megasas_mgmt_fw_ioctl(instance, user_ioc, ioc);
> +  out_up:
> up(&instance->ioctl_sem);
>
>out_kfree_ioc:
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Thanks Dan, this looks good.

Acked-by: Adam Radford 

-Adam
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH V2 1/1] scsi: Handle MLQUEUE busy response in scsi_send_eh_cmnd

2013-04-16 Thread wenxiong
We discussed James's concern. We intergated James's patch and generated
this updated patch.

Fix scsi_send_eh_cmnd to check the return code of queuecommand when
sending commands and retry for a bit if the LLDD returns a busy response.
This fixes an issue seen with the ipr driver where an ipr initiated reset
immediately following an eh_host_reset caused EH initiated commands to fail,
resulting in devices being taken offline. This patch resolves the issue.


Signed-off-by: Wen Xiong 
Signed-off-by: Brian King 
---
 drivers/scsi/scsi_error.c |   34 +-
 1 file changed, 25 insertions(+), 9 deletions(-)

Index: b/drivers/scsi/scsi_error.c
===
--- a/drivers/scsi/scsi_error.c 2013-04-16 12:56:16.617857960 -0500
+++ b/drivers/scsi/scsi_error.c 2013-04-16 12:57:00.279108838 -0500
@@ -791,18 +791,21 @@ static int scsi_send_eh_cmnd(struct scsi
struct scsi_device *sdev = scmd->device;
struct Scsi_Host *shost = sdev->host;
DECLARE_COMPLETION_ONSTACK(done);
-   unsigned long timeleft;
+   unsigned long timeleft = timeout;
struct scsi_eh_save ses;
+   const int stall_for = min(HZ/10, 1);
int rtn;
 
scsi_eh_prep_cmnd(scmd, &ses, cmnd, cmnd_size, sense_bytes);
+retry:
shost->eh_action = &done;
 
scsi_log_send(scmd);
scmd->scsi_done = scsi_eh_done;
-   shost->hostt->queuecommand(shost, scmd);
+   rtn = shost->hostt->queuecommand(shost, scmd);
 
-   timeleft = wait_for_completion_timeout(&done, timeout);
+   if (!rtn)
+   timeleft = wait_for_completion_timeout(&done, timeout);
 
shost->eh_action = NULL;
 
@@ -819,10 +822,19 @@ static int scsi_send_eh_cmnd(struct scsi
 * about this command.
 */
if (timeleft) {
-   rtn = scsi_eh_completed_normally(scmd);
-   SCSI_LOG_ERROR_RECOVERY(3,
-   printk("%s: scsi_eh_completed_normally %x\n",
-  __func__, rtn));
+   switch (rtn) {
+   case 0:
+   rtn = scsi_eh_completed_normally(scmd);
+   SCSI_LOG_ERROR_RECOVERY(3,
+   printk("%s: scsi_eh_completed_normally %x\n",
+  __func__, rtn));
+   break;
+   case FAILED:
+   break;
+   default:
+   rtn = ADD_TO_MLQUEUE;
+   break;
+   }
 
switch (rtn) {
case SUCCESS:
@@ -831,8 +843,12 @@ static int scsi_send_eh_cmnd(struct scsi
case TARGET_ERROR:
break;
case ADD_TO_MLQUEUE:
-   rtn = NEEDS_RETRY;
-   break;
+   if (timeleft > stall_for) {
+   timeout = timeleft - stall_for;
+   msleep(stall_for);
+   goto retry;
+   }
+   /* fall through */
default:
rtn = FAILED;
break;

-- 
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH V2 0/1] scsi: Handle MLQUEUE busy response in scsi_send_eh_cmnd

2013-04-16 Thread wenxiong
After we discussed your comments, We intergated your patch and
generated this updated patch.

Please help us review the new patch. If it is ok, you are free
to add your name in sign-off list.

Thanks for your help!
Wendy
-- 
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 5/5] ibmvfc: Driver version 1.0.11

2013-04-16 Thread Robert Jennings
* Brian King (brk...@linux.vnet.ibm.com) wrote:
> 
> Bump driver version to 1.0.11.
> 
> 
> Signed-off-by: Brian King 
Acked-by: Robert Jennings 
> ---
> 
>  drivers/scsi/ibmvscsi/ibmvfc.h |4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff -puN drivers/scsi/ibmvscsi/ibmvfc.h~ibmvfc_version_1_0_11 
> drivers/scsi/ibmvscsi/ibmvfc.h
> --- linux/drivers/scsi/ibmvscsi/ibmvfc.h~ibmvfc_version_1_0_11
> 2013-04-10 15:51:55.0 -0500
> +++ linux-bjking1/drivers/scsi/ibmvscsi/ibmvfc.h  2013-04-12 
> 08:22:33.0 -0500
> @@ -29,8 +29,8 @@
>  #include "viosrp.h"
> 
>  #define IBMVFC_NAME  "ibmvfc"
> -#define IBMVFC_DRIVER_VERSION"1.0.10"
> -#define IBMVFC_DRIVER_DATE   "(August 24, 2012)"
> +#define IBMVFC_DRIVER_VERSION"1.0.11"
> +#define IBMVFC_DRIVER_DATE   "(April 12, 2013)"
> 
>  #define IBMVFC_DEFAULT_TIMEOUT   60
>  #define IBMVFC_ADISC_CANCEL_TIMEOUT  45
> _

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 4/5] ibmvfc: Suppress ABTS if target gone

2013-04-16 Thread Robert Jennings
* Brian King (brk...@linux.vnet.ibm.com) wrote:
> 
> Adds support for a new VIOS feature that allows ibmvfc to
> optimize terminate_rport_io by telling the VIOS the target
> is no longer accessible on the fabric and that it should
> not send an ABTS out on the fabric to the device.
> 
> Signed-off-by: Brian King 
Acked-by: Robert Jennings 
> ---
> 
>  drivers/scsi/ibmvscsi/ibmvfc.c |   13 +++--
>  drivers/scsi/ibmvscsi/ibmvfc.h |3 ++-
>  2 files changed, 9 insertions(+), 7 deletions(-)
> 
> diff -puN drivers/scsi/ibmvscsi/ibmvfc.c~ibmvfc_supress_abts 
> drivers/scsi/ibmvscsi/ibmvfc.c
> --- linux-2.6/drivers/scsi/ibmvscsi/ibmvfc.c~ibmvfc_supress_abts  
> 2013-01-25 14:29:11.0 -0600
> +++ linux-2.6-bjking1/drivers/scsi/ibmvscsi/ibmvfc.c  2013-01-25 
> 14:29:24.0 -0600
> @@ -2190,10 +2190,12 @@ static int ibmvfc_cancel_all(struct scsi
>   tmf->common.length = sizeof(*tmf);
>   tmf->scsi_id = rport->port_id;
>   int_to_scsilun(sdev->lun, &tmf->lun);
> + if (!(vhost->login_buf->resp.capabilities & 
> IBMVFC_CAN_SUPPRESS_ABTS))
> + type &= ~IBMVFC_TMF_SUPPRESS_ABTS;
>   if (vhost->state == IBMVFC_ACTIVE)
>   tmf->flags = (type | IBMVFC_TMF_LUA_VALID);
>   else
> - tmf->flags = IBMVFC_TMF_LUA_VALID;
> + tmf->flags = ((type & IBMVFC_TMF_SUPPRESS_ABTS) | 
> IBMVFC_TMF_LUA_VALID);
>   tmf->cancel_key = (unsigned long)sdev->hostdata;
>   tmf->my_cancel_key = (unsigned long)starget->hostdata;
> 
> @@ -2402,7 +2404,7 @@ static int ibmvfc_eh_abort_handler(struc
>   cancel_rc = ibmvfc_cancel_all(sdev, IBMVFC_TMF_ABORT_TASK_SET);
>   ibmvfc_abort_task_set(sdev);
>   } else
> - cancel_rc = ibmvfc_cancel_all(sdev, 0);
> + cancel_rc = ibmvfc_cancel_all(sdev, IBMVFC_TMF_SUPPRESS_ABTS);
> 
>   if (!cancel_rc)
>   rc = ibmvfc_wait_for_ops(vhost, sdev, ibmvfc_match_lun);
> @@ -2435,7 +2437,7 @@ static int ibmvfc_eh_device_reset_handle
>   cancel_rc = ibmvfc_cancel_all(sdev, IBMVFC_TMF_LUN_RESET);
>   reset_rc = ibmvfc_reset_device(sdev, IBMVFC_LUN_RESET, "LUN");
>   } else
> - cancel_rc = ibmvfc_cancel_all(sdev, 0);
> + cancel_rc = ibmvfc_cancel_all(sdev, IBMVFC_TMF_SUPPRESS_ABTS);
> 
>   if (!cancel_rc && !reset_rc)
>   rc = ibmvfc_wait_for_ops(vhost, sdev, ibmvfc_match_lun);
> @@ -2456,7 +2458,7 @@ static int ibmvfc_eh_device_reset_handle
>  static void ibmvfc_dev_cancel_all_noreset(struct scsi_device *sdev, void 
> *data)
>  {
>   unsigned long *rc = data;
> - *rc |= ibmvfc_cancel_all(sdev, 0);
> + *rc |= ibmvfc_cancel_all(sdev, IBMVFC_TMF_SUPPRESS_ABTS);
>  }
> 
>  /**
> @@ -2547,8 +2549,7 @@ static void ibmvfc_terminate_rport_io(st
>   dev_rport = starget_to_rport(scsi_target(sdev));
>   if (dev_rport != rport)
>   continue;
> - ibmvfc_cancel_all(sdev, IBMVFC_TMF_ABORT_TASK_SET);
> - ibmvfc_abort_task_set(sdev);
> + ibmvfc_cancel_all(sdev, IBMVFC_TMF_SUPPRESS_ABTS);
>   }
> 
>   rc = ibmvfc_wait_for_ops(vhost, rport, ibmvfc_match_rport);
> diff -puN drivers/scsi/ibmvscsi/ibmvfc.h~ibmvfc_supress_abts 
> drivers/scsi/ibmvscsi/ibmvfc.h
> --- linux-2.6/drivers/scsi/ibmvscsi/ibmvfc.h~ibmvfc_supress_abts  
> 2013-01-25 14:29:11.0 -0600
> +++ linux-2.6-bjking1/drivers/scsi/ibmvscsi/ibmvfc.h  2013-01-25 
> 14:29:11.0 -0600
> @@ -208,10 +208,10 @@ struct ibmvfc_npiv_login_resp {
>   u16 error;
>   u32 flags;
>  #define IBMVFC_NATIVE_FC 0x01
> -#define IBMVFC_CAN_FLUSH_ON_HALT 0x08
>   u32 reserved;
>   u64 capabilities;
>  #define IBMVFC_CAN_FLUSH_ON_HALT 0x08
> +#define IBMVFC_CAN_SUPPRESS_ABTS 0x10
>   u32 max_cmds;
>   u32 scsi_id_sz;
>   u64 max_dma_len;
> @@ -351,6 +351,7 @@ struct ibmvfc_tmf {
>  #define IBMVFC_TMF_LUN_RESET 0x10
>  #define IBMVFC_TMF_TGT_RESET 0x20
>  #define IBMVFC_TMF_LUA_VALID 0x40
> +#define IBMVFC_TMF_SUPPRESS_ABTS 0x80
>   u32 cancel_key;
>   u32 my_cancel_key;
>   u32 pad;
> _

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/5] ibmvfc: Send cancel when link is down

2013-04-16 Thread Robert Jennings
* Brian King (brk...@linux.vnet.ibm.com) wrote:
> 
> If attempting to abort requests due to a fail fail timeout
> or error handling while the link is down, we cannot send
> an abort out on the fabric. We can, however, send a cancel
> to the VIOS. This fixes ibmvfc to send a cancel in this
> case to prevent error handling from failing and/or
> escalating.
> 
> Signed-off-by: Brian King 
Acked-by: Robert Jennings 
> ---
> 
>  drivers/scsi/ibmvscsi/ibmvfc.c |   13 -
>  1 file changed, 8 insertions(+), 5 deletions(-)
> 
> diff -puN drivers/scsi/ibmvscsi/ibmvfc.c~ibmvfc_cancel_when_link_down 
> drivers/scsi/ibmvscsi/ibmvfc.c
> --- linux-2.6/drivers/scsi/ibmvscsi/ibmvfc.c~ibmvfc_cancel_when_link_down 
> 2013-01-23 08:12:09.0 -0600
> +++ linux-2.6-bjking1/drivers/scsi/ibmvscsi/ibmvfc.c  2013-01-23 
> 09:18:46.0 -0600
> @@ -2179,7 +2179,7 @@ static int ibmvfc_cancel_all(struct scsi
>   return 0;
>   }
> 
> - if (vhost->state == IBMVFC_ACTIVE) {
> + if (vhost->logged_in) {
>   evt = ibmvfc_get_event(vhost);
>   ibmvfc_init_event(evt, ibmvfc_sync_completion, 
> IBMVFC_MAD_FORMAT);
> 
> @@ -2190,7 +2190,10 @@ static int ibmvfc_cancel_all(struct scsi
>   tmf->common.length = sizeof(*tmf);
>   tmf->scsi_id = rport->port_id;
>   int_to_scsilun(sdev->lun, &tmf->lun);
> - tmf->flags = (type | IBMVFC_TMF_LUA_VALID);
> + if (vhost->state == IBMVFC_ACTIVE)
> + tmf->flags = (type | IBMVFC_TMF_LUA_VALID);
> + else
> + tmf->flags = IBMVFC_TMF_LUA_VALID;
>   tmf->cancel_key = (unsigned long)sdev->hostdata;
>   tmf->my_cancel_key = (unsigned long)starget->hostdata;
> 
> @@ -2389,7 +2392,7 @@ static int ibmvfc_eh_abort_handler(struc
>  {
>   struct scsi_device *sdev = cmd->device;
>   struct ibmvfc_host *vhost = shost_priv(sdev->host);
> - int cancel_rc, block_rc, abort_rc = 0;
> + int cancel_rc, block_rc;
>   int rc = FAILED;
> 
>   ENTER;
> @@ -2397,11 +2400,11 @@ static int ibmvfc_eh_abort_handler(struc
>   ibmvfc_wait_while_resetting(vhost);
>   if (block_rc != FAST_IO_FAIL) {
>   cancel_rc = ibmvfc_cancel_all(sdev, IBMVFC_TMF_ABORT_TASK_SET);
> - abort_rc = ibmvfc_abort_task_set(sdev);
> + ibmvfc_abort_task_set(sdev);
>   } else
>   cancel_rc = ibmvfc_cancel_all(sdev, 0);
> 
> - if (!cancel_rc && !abort_rc)
> + if (!cancel_rc)
>   rc = ibmvfc_wait_for_ops(vhost, sdev, ibmvfc_match_lun);
> 
>   if (block_rc == FAST_IO_FAIL && rc != FAILED)
> _

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/5] ibmvfc: Support FAST_IO_FAIL in EH handlers

2013-04-16 Thread Robert Jennings
* Brian King (brk...@linux.vnet.ibm.com) wrote:
> 
> Adds support for receiving FAST_IO_FAIL from fc_block_scsi_eh
> when in error recovery. This fixes cases of devices being
> taken offline when they are no longer accessible on the fabric,
> preventing them from coming back online when the fabric recovers.
> 
> Signed-off-by: Brian King 
Acked-by: Robert Jennings 
> ---
> 
>  drivers/scsi/ibmvscsi/ibmvfc.c |   69 
> ++---
>  1 file changed, 52 insertions(+), 17 deletions(-)
> 
> diff -puN drivers/scsi/ibmvscsi/ibmvfc.c~ibmvfc_block_scsi_eh_fast_fail 
> drivers/scsi/ibmvscsi/ibmvfc.c
> --- linux-2.6/drivers/scsi/ibmvscsi/ibmvfc.c~ibmvfc_block_scsi_eh_fast_fail   
> 2013-01-22 07:51:01.0 -0600
> +++ linux-2.6-bjking1/drivers/scsi/ibmvscsi/ibmvfc.c  2013-02-06 
> 14:56:06.0 -0600
> @@ -2383,24 +2383,30 @@ out:
>   * @cmd: scsi command to abort
>   *
>   * Returns:
> - *   SUCCESS / FAILED
> + *   SUCCESS / FAST_IO_FAIL / FAILED
>   **/
>  static int ibmvfc_eh_abort_handler(struct scsi_cmnd *cmd)
>  {
>   struct scsi_device *sdev = cmd->device;
>   struct ibmvfc_host *vhost = shost_priv(sdev->host);
> - int cancel_rc, abort_rc;
> + int cancel_rc, block_rc, abort_rc = 0;
>   int rc = FAILED;
> 
>   ENTER;
> - fc_block_scsi_eh(cmd);
> + block_rc = fc_block_scsi_eh(cmd);
>   ibmvfc_wait_while_resetting(vhost);
> - cancel_rc = ibmvfc_cancel_all(sdev, IBMVFC_TMF_ABORT_TASK_SET);
> - abort_rc = ibmvfc_abort_task_set(sdev);
> + if (block_rc != FAST_IO_FAIL) {
> + cancel_rc = ibmvfc_cancel_all(sdev, IBMVFC_TMF_ABORT_TASK_SET);
> + abort_rc = ibmvfc_abort_task_set(sdev);
> + } else
> + cancel_rc = ibmvfc_cancel_all(sdev, 0);
> 
>   if (!cancel_rc && !abort_rc)
>   rc = ibmvfc_wait_for_ops(vhost, sdev, ibmvfc_match_lun);
> 
> + if (block_rc == FAST_IO_FAIL && rc != FAILED)
> + rc = FAST_IO_FAIL;
> +
>   LEAVE;
>   return rc;
>  }
> @@ -2410,29 +2416,47 @@ static int ibmvfc_eh_abort_handler(struc
>   * @cmd: scsi command struct
>   *
>   * Returns:
> - *   SUCCESS / FAILED
> + *   SUCCESS / FAST_IO_FAIL / FAILED
>   **/
>  static int ibmvfc_eh_device_reset_handler(struct scsi_cmnd *cmd)
>  {
>   struct scsi_device *sdev = cmd->device;
>   struct ibmvfc_host *vhost = shost_priv(sdev->host);
> - int cancel_rc, reset_rc;
> + int cancel_rc, block_rc, reset_rc = 0;
>   int rc = FAILED;
> 
>   ENTER;
> - fc_block_scsi_eh(cmd);
> + block_rc = fc_block_scsi_eh(cmd);
>   ibmvfc_wait_while_resetting(vhost);
> - cancel_rc = ibmvfc_cancel_all(sdev, IBMVFC_TMF_LUN_RESET);
> - reset_rc = ibmvfc_reset_device(sdev, IBMVFC_LUN_RESET, "LUN");
> + if (block_rc != FAST_IO_FAIL) {
> + cancel_rc = ibmvfc_cancel_all(sdev, IBMVFC_TMF_LUN_RESET);
> + reset_rc = ibmvfc_reset_device(sdev, IBMVFC_LUN_RESET, "LUN");
> + } else
> + cancel_rc = ibmvfc_cancel_all(sdev, 0);
> 
>   if (!cancel_rc && !reset_rc)
>   rc = ibmvfc_wait_for_ops(vhost, sdev, ibmvfc_match_lun);
> 
> + if (block_rc == FAST_IO_FAIL && rc != FAILED)
> + rc = FAST_IO_FAIL;
> +
>   LEAVE;
>   return rc;
>  }
> 
>  /**
> + * ibmvfc_dev_cancel_all_noreset - Device iterated cancel all function
> + * @sdev:scsi device struct
> + * @data:return code
> + *
> + **/
> +static void ibmvfc_dev_cancel_all_noreset(struct scsi_device *sdev, void 
> *data)
> +{
> + unsigned long *rc = data;
> + *rc |= ibmvfc_cancel_all(sdev, 0);
> +}
> +
> +/**
>   * ibmvfc_dev_cancel_all_reset - Device iterated cancel all function
>   * @sdev:scsi device struct
>   * @data:return code
> @@ -2449,26 +2473,33 @@ static void ibmvfc_dev_cancel_all_reset(
>   * @cmd: scsi command struct
>   *
>   * Returns:
> - *   SUCCESS / FAILED
> + *   SUCCESS / FAST_IO_FAIL / FAILED
>   **/
>  static int ibmvfc_eh_target_reset_handler(struct scsi_cmnd *cmd)
>  {
>   struct scsi_device *sdev = cmd->device;
>   struct ibmvfc_host *vhost = shost_priv(sdev->host);
>   struct scsi_target *starget = scsi_target(sdev);
> - int reset_rc;
> + int block_rc;
> + int reset_rc = 0;
>   int rc = FAILED;
>   unsigned long cancel_rc = 0;
> 
>   ENTER;
> - fc_block_scsi_eh(cmd);
> + block_rc = fc_block_scsi_eh(cmd);
>   ibmvfc_wait_while_resetting(vhost);
> - starget_for_each_device(starget, &cancel_rc, 
> ibmvfc_dev_cancel_all_reset);
> - reset_rc = ibmvfc_reset_device(sdev, IBMVFC_TARGET_RESET, "target");
> + if (block_rc != FAST_IO_FAIL) {
> + starget_for_each_device(starget, &cancel_rc, 
> ibmvfc_dev_cancel_all_reset);
> + reset_rc = ibmvfc_reset_device(sdev, IBMVFC_TARGET_RESET, 
> "target");
> + } else
> + starget_for_each_device(starget, &cancel_rc, 
> ibmvfc_dev_cancel_all_noreset);
> 
>   if (!can

Re: [PATCH 1/5] ibmvfc: Properly set cancel flags when cancelling abort

2013-04-16 Thread Robert Jennings
* Brian King (brk...@linux.vnet.ibm.com) wrote:
> 
> The flags on a cancel operation are intended to indicate what,
> if any, TMF will follow the cancel request. This fixes a case
> where we were incorrectly setting the abort task set flag on
> the cancel flag when we were cancelling an abort task set.
> 
> Signed-off-by: Brian King 
Acked-by: Robert Jennings 
> ---
> 
>  drivers/scsi/ibmvscsi/ibmvfc.c |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff -puN drivers/scsi/ibmvscsi/ibmvfc.c~ibmvfc_abort_cancel_flags 
> drivers/scsi/ibmvscsi/ibmvfc.c
> --- linux-2.6/drivers/scsi/ibmvscsi/ibmvfc.c~ibmvfc_abort_cancel_flags
> 2013-01-22 07:44:23.0 -0600
> +++ linux-2.6-bjking1/drivers/scsi/ibmvscsi/ibmvfc.c  2013-01-22 
> 07:44:56.0 -0600
> @@ -2327,7 +2327,7 @@ static int ibmvfc_abort_task_set(struct
>   timeout = wait_for_completion_timeout(&evt->comp, timeout);
> 
>   if (!timeout) {
> - rc = ibmvfc_cancel_all(sdev, IBMVFC_TMF_ABORT_TASK_SET);
> + rc = ibmvfc_cancel_all(sdev, 0);
>   if (!rc) {
>   rc = ibmvfc_wait_for_ops(vhost, sdev->hostdata, 
> ibmvfc_match_key);
>   if (rc == SUCCESS)
> _

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 14/28] proc: Supply an accessor for getting the data from a PDE's parent [RFC]

2013-04-16 Thread David Howells
Supply an accessor function for getting the private data from the parent
proc_dir_entry struct of the proc_dir_entry struct associated with an inode.

ReiserFS, for instance, stores the super_block pointer in the proc directory
it makes for that super_block, and a pointer to the respective seq_file show
function in each of the proc files in that directory.

This allows a reduction in the number of file_operations structs, open
functions and seq_operations structs required.  The problem otherwise is that
each show function requires two pieces of data but only has storage for one
per PDE (and this has no release function).

Signed-off-by: David Howells 
cc: Jerry Chuang 
cc: Mauro Carvalho Chehab 
cc: Maxim Mikityanskiy 
cc: YAMANE Toshiaki 
cc: linux-wirel...@vger.kernel.org
cc: linux-scsi@vger.kernel.org
cc: de...@driverdev.osuosl.org
---

 drivers/scsi/megaraid.c|2 +-
 drivers/staging/rtl8187se/r8180_core.c |2 +-
 drivers/staging/rtl8192u/r8192U_core.c |2 +-
 fs/proc/generic.c  |7 +++
 include/linux/proc_fs.h|1 +
 5 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index ef3384d..7373255 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -2760,7 +2760,7 @@ proc_show_rdrv_40(struct seq_file *m, void *v)
  */
 static int mega_proc_open(struct inode *inode, struct file *file)
 {
-   adapter_t *adapter = PDE(inode)->parent->data;
+   adapter_t *adapter = proc_get_parent_data(inode);
int (*show)(struct seq_file *, void *) = PDE_DATA(inode);
 
return single_open(file, show, adapter);
diff --git a/drivers/staging/rtl8187se/r8180_core.c 
b/drivers/staging/rtl8187se/r8180_core.c
index ab469ce..f7c1d99 100644
--- a/drivers/staging/rtl8187se/r8180_core.c
+++ b/drivers/staging/rtl8187se/r8180_core.c
@@ -296,7 +296,7 @@ void rtl8180_proc_remove_one(struct net_device *dev)
  */
 static int rtl8180_proc_open(struct inode *inode, struct file *file)
 {
-   struct net_device *dev = PDE(inode)->parent->data;
+   struct net_device *dev = proc_get_parent_data(inode);
int (*show)(struct seq_file *, void *) = PDE_DATA(inode);
 
return single_open(file, show, dev);
diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
b/drivers/staging/rtl8192u/r8192U_core.c
index 27ba2a3..1459233 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -637,7 +637,7 @@ void rtl8192_proc_module_remove(void)
  */
 static int rtl8192_proc_open(struct inode *inode, struct file *file)
 {
-   struct net_device *dev = PDE(inode)->parent->data;
+   struct net_device *dev = proc_get_parent_data(inode);
int (*show)(struct seq_file *, void *) = PDE_DATA(inode);
 
return single_open(file, show, dev);
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index 4074da5..75e08d3 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -617,3 +617,10 @@ int remove_proc_subtree(const char *name, struct 
proc_dir_entry *parent)
return 0;
 }
 EXPORT_SYMBOL(remove_proc_subtree);
+
+void *proc_get_parent_data(const struct inode *inode)
+{
+   struct proc_dir_entry *de = PDE(inode);
+   return de->parent->data;
+}
+EXPORT_SYMBOL_GPL(proc_get_parent_data);
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index e5d8f69..12694ef 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -86,6 +86,7 @@ static inline struct proc_dir_entry *proc_create(const char 
*name, umode_t mode,
  
 extern void proc_set_size(struct proc_dir_entry *, loff_t);
 extern void proc_set_user(struct proc_dir_entry *, kuid_t, kgid_t);
+extern void *proc_get_parent_data(const struct inode *);
 #else
 
 static inline void proc_flush_task(struct task_struct *task)

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 10/28] proc: Add proc_mkdir_data() [RFC]

2013-04-16 Thread David Howells
Add proc_mkdir_data() to allow procfs directories to be created that are
annotated at the time of creation with private data rather than doing this
post-creation.  This means no access is then required to the proc_dir_entry
struct to set this.

Signed-off-by: David Howells 
cc: Neela Syam Kolli 
cc: Jerry Chuang 
cc: Mauro Carvalho Chehab 
cc: linux-scsi@vger.kernel.org
cc: de...@driverdev.osuosl.org
cc: linux-wirel...@vger.kernel.org
---

 drivers/message/i2o/i2o_proc.c |8 ++--
 drivers/scsi/megaraid.c|4 ++--
 drivers/staging/rtl8192u/r8192U_core.c |3 +--
 fs/proc/generic.c  |   30 --
 include/linux/proc_fs.h|   11 ---
 5 files changed, 25 insertions(+), 31 deletions(-)

diff --git a/drivers/message/i2o/i2o_proc.c b/drivers/message/i2o/i2o_proc.c
index 70a840f..b7d87cd 100644
--- a/drivers/message/i2o/i2o_proc.c
+++ b/drivers/message/i2o/i2o_proc.c
@@ -1913,14 +1913,12 @@ static void i2o_proc_device_add(struct proc_dir_entry 
*dir,
 
osm_debug("adding device /proc/i2o/%s/%s\n", dev->iop->name, buff);
 
-   devdir = proc_mkdir(buff, dir);
+   devdir = proc_mkdir_data(buff, 0, dir, dev);
if (!devdir) {
osm_warn("Could not allocate procdir!\n");
return;
}
 
-   devdir->data = dev;
-
i2o_proc_create_entries(devdir, generic_dev_entries, dev);
 
/* Inform core that we want updates about this device's status */
@@ -1954,12 +1952,10 @@ static int i2o_proc_iop_add(struct proc_dir_entry *dir,
 
osm_debug("adding IOP /proc/i2o/%s\n", c->name);
 
-   iopdir = proc_mkdir(c->name, dir);
+   iopdir = proc_mkdir_data(c->name, 0, dir, c);
if (!iopdir)
return -1;
 
-   iopdir->data = c;
-
i2o_proc_create_entries(iopdir, i2o_proc_generic_iop_entries, c);
 
list_for_each_entry(dev, &c->devices, list)
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index a1c90bd..ef3384d 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -2818,12 +2818,12 @@ mega_create_proc_entry(int index, struct proc_dir_entry 
*parent)
 
sprintf(string, "hba%d", adapter->host->host_no);
 
-   dir = adapter->controller_proc_dir_entry = proc_mkdir(string, parent);
+   dir = adapter->controller_proc_dir_entry =
+   proc_mkdir_data(string, 0, parent, adapter);
if(!dir) {
printk(KERN_WARNING "\nmegaraid: proc_mkdir failed\n");
return;
}
-   dir->data = adapter;
 
for (f = mega_proc_files; f->name; f++) {
de = proc_create_data(f->name, S_IRUSR, dir, &mega_proc_fops,
diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
b/drivers/staging/rtl8192u/r8192U_core.c
index 433c3df..d81d7d5 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -672,13 +672,12 @@ void rtl8192_proc_init_one(struct net_device *dev)
struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
 
if (rtl8192_proc) {
-   priv->dir_dev = proc_mkdir(dev->name, rtl8192_proc);
+   priv->dir_dev = proc_mkdir_data(dev->name, 0, rtl8192_proc, 
dev);
if (!priv->dir_dev) {
RT_TRACE(COMP_ERR, "Unable to initialize 
/proc/net/rtl8192/%s\n",
 dev->name);
return;
}
-   priv->dir_dev->data = dev;
 
for (f = rtl8192_proc_files; f->name[0]; f++) {
if (!proc_create_data(f->name, S_IFREG | S_IRUGO,
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index 5f6f6c3..4074da5 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -428,13 +428,17 @@ struct proc_dir_entry *proc_symlink(const char *name,
 }
 EXPORT_SYMBOL(proc_symlink);
 
-struct proc_dir_entry *proc_mkdir_mode(const char *name, umode_t mode,
-   struct proc_dir_entry *parent)
+struct proc_dir_entry *proc_mkdir_data(const char *name, umode_t mode,
+   struct proc_dir_entry *parent, void *data)
 {
struct proc_dir_entry *ent;
 
+   if (mode == 0)
+   mode = S_IRUGO | S_IXUGO;
+
ent = __proc_create(&parent, name, S_IFDIR | mode, 2);
if (ent) {
+   ent->data = data;
if (proc_register(parent, ent) < 0) {
kfree(ent);
ent = NULL;
@@ -442,29 +446,19 @@ struct proc_dir_entry *proc_mkdir_mode(const char *name, 
umode_t mode,
}
return ent;
 }
-EXPORT_SYMBOL(proc_mkdir_mode);
+EXPORT_SYMBOL_GPL(proc_mkdir_data);
 
-struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name,
-   struct proc_dir_entry *parent)
+struct proc_dir_entry *proc_mkdir_mode(const char *name, umode_t mode,
+  struct proc_dir_entry *parent

Re: storvsc loops with No Sense messages

2013-04-16 Thread Jari Turkia
> On Wed, Jan 30, Olaf Hering wrote:
>> Is there a way to not use WRITE_SAME at all? While browsing the code its
>> not clear if there is a conditional for this command.
>It seems scsi_device->no_write_same may avoid this command, I will
>test this patch:
># Subject: [PATCH] scsi: storvsc: avoid usage of WRITE_SAME
>Set scsi_device->no_write_same because the host does not support it.
>Also blacklist WRITE_SAME to avoid (and log) accident usage.
>Signed-off-by: Olaf Hering 

Hopefully Olaf will find time to test the patch and push it forward. I did test 
it and it solved the issue perfectly!

Most of the current Linux-distros won't work under Windows Server 2012 or 
Windows 8 Hyper-V.

Regards,
Jari Turkia--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 02/02] scsi: pcmcia: nsp_cs: remove module init/exit function prototypes

2013-04-16 Thread Greg Kroah-Hartman
From: H Hartley Sweeten 

This driver now uses the module_pcmcia_driver() macro to supply the
init/exit code. The nsp_cs_{init,exit} prototypes should be removed.

Reported-by: kbuild test robot 
Signed-off-by: H Hartley Sweeten 
Cc: YOKOTA Hiroshi 
Cc: "James E.J. Bottomley" 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/scsi/pcmcia/nsp_cs.h | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/scsi/pcmcia/nsp_cs.h b/drivers/scsi/pcmcia/nsp_cs.h
index 7fc9a9d..4d4b4f5 100644
--- a/drivers/scsi/pcmcia/nsp_cs.h
+++ b/drivers/scsi/pcmcia/nsp_cs.h
@@ -331,10 +331,6 @@ static struct Scsi_Host *nsp_detect(struct 
scsi_host_template *sht);
 /* Interrupt handler */
 //static irqreturn_t nspintr(int irq, void *dev_id);
 
-/* Module entry point*/
-static int  __init nsp_cs_init(void);
-static void __exit nsp_cs_exit(void);
-
 /* Debug */
 #ifdef NSP_DEBUG
 static void show_command (struct scsi_cmnd *SCpnt);
-- 
1.8.2.1.368.g99c2266

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 01/02] drivers/scsi: use module_pcmcia_driver() in pcmcia drivers

2013-04-16 Thread Greg KH
From: H Hartley Sweeten 

Use the new module_pcmcia_driver() macro to remove the boilerplate
module init/exit code in the pcmcia drivers.

Signed-off-by: H Hartley Sweeten 
Signed-off-by: Greg Kroah-Hartman 
---

Note, this needs the module_pcmcia_driver() macro, which is in my
char-misc-next branch and will be showing up in 3.10-rc1 - gregkh


 drivers/scsi/pcmcia/aha152x_stub.c | 14 +-
 drivers/scsi/pcmcia/fdomain_stub.c | 14 +-
 drivers/scsi/pcmcia/nsp_cs.c   | 17 +
 drivers/scsi/pcmcia/qlogic_stub.c  | 13 +
 drivers/scsi/pcmcia/sym53c500_cs.c | 16 +---
 5 files changed, 5 insertions(+), 69 deletions(-)

diff --git a/drivers/scsi/pcmcia/aha152x_stub.c 
b/drivers/scsi/pcmcia/aha152x_stub.c
index 7d1609f..df82a34 100644
--- a/drivers/scsi/pcmcia/aha152x_stub.c
+++ b/drivers/scsi/pcmcia/aha152x_stub.c
@@ -220,16 +220,4 @@ static struct pcmcia_driver aha152x_cs_driver = {
.id_table   = aha152x_ids,
.resume = aha152x_resume,
 };
-
-static int __init init_aha152x_cs(void)
-{
-   return pcmcia_register_driver(&aha152x_cs_driver);
-}
-
-static void __exit exit_aha152x_cs(void)
-{
-   pcmcia_unregister_driver(&aha152x_cs_driver);
-}
-
-module_init(init_aha152x_cs);
-module_exit(exit_aha152x_cs);
+module_pcmcia_driver(aha152x_cs_driver);
diff --git a/drivers/scsi/pcmcia/fdomain_stub.c 
b/drivers/scsi/pcmcia/fdomain_stub.c
index 714b248..ba84769 100644
--- a/drivers/scsi/pcmcia/fdomain_stub.c
+++ b/drivers/scsi/pcmcia/fdomain_stub.c
@@ -194,16 +194,4 @@ static struct pcmcia_driver fdomain_cs_driver = {
.id_table   = fdomain_ids,
.resume = fdomain_resume,
 };
-
-static int __init init_fdomain_cs(void)
-{
-   return pcmcia_register_driver(&fdomain_cs_driver);
-}
-
-static void __exit exit_fdomain_cs(void)
-{
-   pcmcia_unregister_driver(&fdomain_cs_driver);
-}
-
-module_init(init_fdomain_cs);
-module_exit(exit_fdomain_cs);
+module_pcmcia_driver(fdomain_cs_driver);
diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c
index b61a753..76ca00c 100644
--- a/drivers/scsi/pcmcia/nsp_cs.c
+++ b/drivers/scsi/pcmcia/nsp_cs.c
@@ -1773,19 +1773,4 @@ static struct pcmcia_driver nsp_driver = {
.suspend= nsp_cs_suspend,
.resume = nsp_cs_resume,
 };
-
-static int __init nsp_cs_init(void)
-{
-   return pcmcia_register_driver(&nsp_driver);
-}
-
-static void __exit nsp_cs_exit(void)
-{
-   pcmcia_unregister_driver(&nsp_driver);
-}
-
-
-module_init(nsp_cs_init)
-module_exit(nsp_cs_exit)
-
-/* end */
+module_pcmcia_driver(nsp_driver);
diff --git a/drivers/scsi/pcmcia/qlogic_stub.c 
b/drivers/scsi/pcmcia/qlogic_stub.c
index bcaf89f..8d4fdc2 100644
--- a/drivers/scsi/pcmcia/qlogic_stub.c
+++ b/drivers/scsi/pcmcia/qlogic_stub.c
@@ -300,19 +300,8 @@ static struct pcmcia_driver qlogic_cs_driver = {
.id_table   = qlogic_ids,
.resume = qlogic_resume,
 };
-
-static int __init init_qlogic_cs(void)
-{
-   return pcmcia_register_driver(&qlogic_cs_driver);
-}
-
-static void __exit exit_qlogic_cs(void)
-{
-   pcmcia_unregister_driver(&qlogic_cs_driver);
-}
+module_pcmcia_driver(qlogic_cs_driver);
 
 MODULE_AUTHOR("Tom Zerucha, Michael Griffith");
 MODULE_DESCRIPTION("Driver for the PCMCIA Qlogic FAS SCSI controllers");
 MODULE_LICENSE("GPL");
-module_init(init_qlogic_cs);
-module_exit(exit_qlogic_cs);
diff --git a/drivers/scsi/pcmcia/sym53c500_cs.c 
b/drivers/scsi/pcmcia/sym53c500_cs.c
index f5b5273..55b0b2b 100644
--- a/drivers/scsi/pcmcia/sym53c500_cs.c
+++ b/drivers/scsi/pcmcia/sym53c500_cs.c
@@ -881,18 +881,4 @@ static struct pcmcia_driver sym53c500_cs_driver = {
.id_table   = sym53c500_ids,
.resume = sym53c500_resume,
 };
-
-static int __init
-init_sym53c500_cs(void)
-{
-   return pcmcia_register_driver(&sym53c500_cs_driver);
-}
-
-static void __exit
-exit_sym53c500_cs(void)
-{
-   pcmcia_unregister_driver(&sym53c500_cs_driver);
-}
-
-module_init(init_sym53c500_cs);
-module_exit(exit_sym53c500_cs);
+module_pcmcia_driver(sym53c500_cs_driver);
-- 
1.8.2.1.368.g99c2266

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/1] scsi: Handle MLQUEUE busy response in scsi_send_eh_cmnd

2013-04-16 Thread Brian King
On 04/15/2013 05:33 PM, James Bottomley wrote:
> On Mon, 2013-04-15 at 16:55 -0500, Brian King wrote:
>> On 04/15/2013 03:45 PM, James Bottomley wrote:
>>> On Mon, 2013-04-15 at 13:39 -0500, wenxi...@linux.vnet.ibm.com wrote:
 In scsi_send_eh_cmnd(), this fix will check the return code of queuecomamnd
 when sending commands and retry for a bit if the driver returns a
 busy response.
>>>
>>> This is already handled by the timeout, I think.  If a driver
>>> continuously returns MLQUEUE BUSY, then we'll fail the request after the
>>> timeout on the command expires.
>>
>> If we get a timeout in scsi_send_eh_cmnd we call scsi_abort_eh_cmnd. If the
>> abort works, we return FAILED out of scsi_send_eh_cmnd, which results in
>> no retry being performed, since scsi_eh_tur only retries once and
>> only if NEEDS_RETRY is returned. Or am I missing something?
> 
> Sorry, I'm not being clear.  It comes with being at a conference.  What
> I mean is that if you do this, the criterion for success or failure
> should be the amount of time left not the number of retries.  This is
> what the non-eh submission path also does for retries of events that
> don't count against the retry limit ... so something like this patch
> (uncompiled and untested #include stddisclaimer.h)

Jams,

Wendy and I discussed this a bit more and I think we understand your concern.
Wendy is working on an updated patch.

Thanks,

Brian

-- 
Brian King
Power Linux I/O
IBM Linux Technology Center


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 6/6] scsi_debug: fix logical block provisioning support

2013-04-16 Thread Akinobu Mita
I tried testing the logical block provisioning support in scsi_debug,
but it didn't work as I expected.

For example, load scsi_debug module with UNMAP command supported
and fill the storage with random data.

# modprobe scsi_debug lbpu=1
# dd if=/dev/urandom of=/dev/sdb

Then, try to unmap LBA 0, but Get LBA status reports:

# sg_unmap --lba=0 --num=1 /dev/sdb
# sg_get_lba_status --lba=0 /dev/sdb
descriptor LBA: 0x  blocks: 16384  mapped

This is unexpected result.  Because UNMAP command to LBA 0 finished
without any errors, but Get LBA status shows that LBA 0 is still mapped.

This problem is due to the wrong translation between LBA and index of
provisioning map.  Fix it by using correct translation functions added
previously.

Signed-off-by: Akinobu Mita 
Cc: "James E.J. Bottomley" 
Cc: Douglas Gilbert 
Cc: "Martin K. Petersen" 
Cc: linux-scsi@vger.kernel.org
---
 drivers/scsi/scsi_debug.c | 55 ++-
 1 file changed, 21 insertions(+), 34 deletions(-)

diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 6581549..154d987 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -2016,22 +2016,20 @@ static sector_t map_index_to_lba(unsigned long index)
 
 static unsigned int map_state(sector_t lba, unsigned int *num)
 {
-   unsigned int granularity, alignment, mapped;
-   sector_t block, next, end;
+   sector_t end;
+   unsigned int mapped;
+   unsigned long index;
+   unsigned long next;
 
-   granularity = scsi_debug_unmap_granularity;
-   alignment = granularity - scsi_debug_unmap_alignment;
-   block = lba + alignment;
-   do_div(block, granularity);
-
-   mapped = test_bit(block, map_storep);
+   index = lba_to_map_index(lba);
+   mapped = test_bit(index, map_storep);
 
if (mapped)
-   next = find_next_zero_bit(map_storep, map_size, block);
+   next = find_next_zero_bit(map_storep, map_size, index);
else
-   next = find_next_bit(map_storep, map_size, block);
+   next = find_next_bit(map_storep, map_size, index);
 
-   end = next * granularity - scsi_debug_unmap_alignment;
+   end = min_t(sector_t, sdebug_store_sectors,  map_index_to_lba(next));
*num = end - lba;
 
return mapped;
@@ -2039,48 +2037,37 @@ static unsigned int map_state(sector_t lba, unsigned 
int *num)
 
 static void map_region(sector_t lba, unsigned int len)
 {
-   unsigned int granularity, alignment;
sector_t end = lba + len;
 
-   granularity = scsi_debug_unmap_granularity;
-   alignment = granularity - scsi_debug_unmap_alignment;
-
while (lba < end) {
-   sector_t block, rem;
-
-   block = lba + alignment;
-   rem = do_div(block, granularity);
+   unsigned long index = lba_to_map_index(lba);
 
-   if (block < map_size)
-   set_bit(block, map_storep);
+   if (index < map_size)
+   set_bit(index, map_storep);
 
-   lba += granularity - rem;
+   lba = map_index_to_lba(index + 1);
}
 }
 
 static void unmap_region(sector_t lba, unsigned int len)
 {
-   unsigned int granularity, alignment;
sector_t end = lba + len;
 
-   granularity = scsi_debug_unmap_granularity;
-   alignment = granularity - scsi_debug_unmap_alignment;
-
while (lba < end) {
-   sector_t block, rem;
-
-   block = lba + alignment;
-   rem = do_div(block, granularity);
+   unsigned long index = lba_to_map_index(lba);
 
-   if (rem == 0 && lba + granularity < end && block < map_size) {
-   clear_bit(block, map_storep);
-   if (scsi_debug_lbprz)
+   if (lba == map_index_to_lba(index) &&
+   lba + scsi_debug_unmap_granularity <= end &&
+   index < map_size) {
+   clear_bit(index, map_storep);
+   if (scsi_debug_lbprz) {
memset(fake_storep +
   lba * scsi_debug_sector_size, 0,
   scsi_debug_sector_size *
   scsi_debug_unmap_granularity);
+   }
}
-   lba += granularity - rem;
+   lba = map_index_to_lba(index + 1);
}
 }
 
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/6] scsi_debug: fix initialization of provisioning map

2013-04-16 Thread Akinobu Mita
provisioning map (map_storep) is a bitmap accessed by bitops.

So the allocation size should be a multiple of sizeof(unsigned long) and
also the bitmap should be cleared by using bitmap_clear() instead of
memset().

Otherwise it will cause problem on big-endian architecture if the number of
bits is not a multiple of BITS_PER_LONG.

Signed-off-by: Akinobu Mita 
Cc: "James E.J. Bottomley" 
Cc: Douglas Gilbert 
Cc: "Martin K. Petersen" 
Cc: linux-scsi@vger.kernel.org
---
 drivers/scsi/scsi_debug.c | 9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index c6de36c..6581549 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -3419,8 +3419,6 @@ static int __init scsi_debug_init(void)
 
/* Logical Block Provisioning */
if (scsi_debug_lbp()) {
-   unsigned int map_bytes;
-
scsi_debug_unmap_max_blocks =
clamp(scsi_debug_unmap_max_blocks, 0U, 0xU);
 
@@ -3439,9 +3437,8 @@ static int __init scsi_debug_init(void)
return -EINVAL;
}
 
-   map_size = (sdebug_store_sectors / 
scsi_debug_unmap_granularity);
-   map_bytes = map_size >> 3;
-   map_storep = vmalloc(map_bytes);
+   map_size = lba_to_map_index(sdebug_store_sectors - 1) + 1;
+   map_storep = vmalloc(BITS_TO_LONGS(map_size) * sizeof(long));
 
printk(KERN_INFO "scsi_debug_init: %lu provisioning blocks\n",
   map_size);
@@ -3452,7 +3449,7 @@ static int __init scsi_debug_init(void)
goto free_vm;
}
 
-   memset(map_storep, 0x0, map_bytes);
+   bitmap_zero(map_storep, map_size);
 
/* Map first 1KB for partition table */
if (scsi_debug_num_parts)
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/6] scsi_debug: add translation functions between LBA and index of provisioning map

2013-04-16 Thread Akinobu Mita
The translation from LBA to index of provisioning map (map_storep) is used
in various places (map_state(), map_region(), and unmap_region()).  But it
is not correctly calculated if scsi_debug_unmap_alignment is zero.

This introduces correct translation functions between LBA and index
of  provisioning map:

static unsigned long lba_to_map_index(sector_t lba);
static sector_t map_index_to_lba(unsigned long index);

Actual bug fixes with using these functions will be done by forthcoming
patches.

Signed-off-by: Akinobu Mita 
Cc: "James E.J. Bottomley" 
Cc: Douglas Gilbert 
Cc: "Martin K. Petersen" 
Cc: linux-scsi@vger.kernel.org
---
 drivers/scsi/scsi_debug.c | 17 +
 1 file changed, 17 insertions(+)

diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 4b5d388..c6de36c 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -1997,6 +1997,23 @@ out:
return ret;
 }
 
+static unsigned long lba_to_map_index(sector_t lba)
+{
+   if (scsi_debug_unmap_alignment) {
+   lba += scsi_debug_unmap_granularity -
+   scsi_debug_unmap_alignment;
+   }
+   do_div(lba, scsi_debug_unmap_granularity);
+
+   return lba;
+}
+
+static sector_t map_index_to_lba(unsigned long index)
+{
+   return index * scsi_debug_unmap_granularity -
+   scsi_debug_unmap_alignment;
+}
+
 static unsigned int map_state(sector_t lba, unsigned int *num)
 {
unsigned int granularity, alignment, mapped;
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/6] scsi_debug: clear correct memory region when LBPRZ is enabled

2013-04-16 Thread Akinobu Mita
The function unmap_region() clears memory region specified as the logical
block address and the number of logical blocks in ramdisk storage
(fake_storep) if lbpu and lbprz module parameters are enabled.

In the while loop of unmap_region(), it advances optimal unmap granularity
in logical blocks.  But it only clears one logical block at LBA 'block' per
loop iteration.  And furthermore, the 'block' is not pointing to a logical
block address which should be cleared, it is a index of probisioning map
(map_storep).

Signed-off-by: Akinobu Mita 
Cc: "James E.J. Bottomley" 
Cc: Douglas Gilbert 
Cc: "Martin K. Petersen" 
Cc: linux-scsi@vger.kernel.org
---
 drivers/scsi/scsi_debug.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 5c32140..4b5d388 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -2059,8 +2059,9 @@ static void unmap_region(sector_t lba, unsigned int len)
clear_bit(block, map_storep);
if (scsi_debug_lbprz)
memset(fake_storep +
-  block * scsi_debug_sector_size, 0,
-  scsi_debug_sector_size);
+  lba * scsi_debug_sector_size, 0,
+  scsi_debug_sector_size *
+  scsi_debug_unmap_granularity);
}
lba += granularity - rem;
}
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/6] scsi_debug: prohibit scsi_debug_unmap_granularity == scsi_debug_unmap_alignment

2013-04-16 Thread Akinobu Mita
scsi_debug prohibits setting scsi_debug_unmap_alignment to be greater
than scsi_debug_unmap_granularity.  But setting them to be the same value
is not prohibited.  In this case, the only difference with
scsi_debug_unmap_alignment == 0 is the logical blocks from 0 to
scsi_debug_unmap_alignment - 1 cannot be unmapped.  But the difference is
not properly handled in the current code.

So this prohibits such unusual setting.

Signed-off-by: Akinobu Mita 
Cc: "James E.J. Bottomley" 
Cc: Douglas Gilbert 
Cc: "Martin K. Petersen" 
Cc: linux-scsi@vger.kernel.org
---
 drivers/scsi/scsi_debug.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 05abf4e..5c32140 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -3413,9 +3413,10 @@ static int __init scsi_debug_init(void)
clamp(scsi_debug_unmap_granularity, 1U, 0xU);
 
if (scsi_debug_unmap_alignment &&
-   scsi_debug_unmap_granularity < scsi_debug_unmap_alignment) {
+   scsi_debug_unmap_granularity <=
+   scsi_debug_unmap_alignment) {
printk(KERN_ERR
-  "%s: ERR: unmap_granularity < unmap_alignment\n",
+  "%s: ERR: unmap_granularity <= 
unmap_alignment\n",
   __func__);
return -EINVAL;
}
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/6] scsi_debug: call map_region() and unmap_region() only when needed

2013-04-16 Thread Akinobu Mita
If the logical block provisioning is not enabled, map_region() and
unmap_region() have no effect and they don't need to be called.

So this makes map_region() and unmap_region() to be called only
when scsi_debug_lbp() returns true, i.e. logical block provisioning is
enabled.

While I'm at it, this also removes meaningless non-zero check for
scsi_debug_unmap_granularity.

Because scsi_debug_unmap_granularity cannot be zero with usual setting:
scsi_debug_unmap_granularity is 1 by default, and it can be changed to
zero with explicit module parameter setting only when the logical block
provisioning is disabled.  But it is only meaningful module parameter
when the logical block provisioning is enabled.

Signed-off-by: Akinobu Mita 
Cc: "James E.J. Bottomley" 
Cc: Douglas Gilbert 
Cc: "Martin K. Petersen" 
Cc: linux-scsi@vger.kernel.org
---
 drivers/scsi/scsi_debug.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 5cda11c..05abf4e 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -2089,7 +2089,7 @@ static int resp_write(struct scsi_cmnd *SCpnt, unsigned 
long long lba,
 
write_lock_irqsave(&atomic_rw, iflags);
ret = do_device_access(SCpnt, devip, lba, num, 1);
-   if (scsi_debug_unmap_granularity)
+   if (scsi_debug_lbp())
map_region(lba, num);
write_unlock_irqrestore(&atomic_rw, iflags);
if (-1 == ret)
@@ -2122,7 +2122,7 @@ static int resp_write_same(struct scsi_cmnd *scmd, 
unsigned long long lba,
 
write_lock_irqsave(&atomic_rw, iflags);
 
-   if (unmap && scsi_debug_unmap_granularity) {
+   if (unmap && scsi_debug_lbp()) {
unmap_region(lba, num);
goto out;
}
@@ -2146,7 +2146,7 @@ static int resp_write_same(struct scsi_cmnd *scmd, 
unsigned long long lba,
   fake_storep + (lba * scsi_debug_sector_size),
   scsi_debug_sector_size);
 
-   if (scsi_debug_unmap_granularity)
+   if (scsi_debug_lbp())
map_region(lba, num);
 out:
write_unlock_irqrestore(&atomic_rw, iflags);
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/6] scsi_debug: fix logical block provisioning support

2013-04-16 Thread Akinobu Mita
I tried testing the logical block provisioning support in scsi_debug,
but it didn't work as I expected.

For example, load scsi_debug module with UNMAP command supported
and fill the storage with random data.

# modprobe scsi_debug lbpu=1
# dd if=/dev/urandom of=/dev/sdb

Then, try to unmap LBA 0, but Get LBA status reports:

# sg_unmap --lba=0 --num=1 /dev/sdb
# sg_get_lba_status --lba=0 /dev/sdb
descriptor LBA: 0x  blocks: 16384  mapped

This is unexpected result.  Because UNMAP command to LBA 0 finished
without any errors, but Get LBA status shows that LBA 0 is still mapped.

I looked around the logical block provisioning support in scsi_debug,
and I found several problems there.  This patch series tries to fix
these problems and it is broken into small patches as much as possible
for ease of review.

Cc: "James E.J. Bottomley" 
Cc: linux-scsi@vger.kernel.org
Cc: Douglas Gilbert 
Cc: "Martin K. Petersen" 

Akinobu Mita (6):
  scsi_debug: call map_region() and unmap_region() only when needed
  scsi_debug: prohibit scsi_debug_unmap_granularity ==
scsi_debug_unmap_alignment
  scsi_debug: clear correct memory region when LBPRZ is enabled
  scsi_debug: add translation functions between LBA and index of
provisioning map
  scsi_debug: fix initialization of provisioning map
  scsi_debug: fix logical block provisioning support

 drivers/scsi/scsi_debug.c | 97 ---
 1 file changed, 50 insertions(+), 47 deletions(-)

-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [SCSI] qla4xxx: Add flash node mgmt support

2013-04-16 Thread Adheer Chandravanshi
Dan,

Thanks for pointing this out. We will post the fixes soon.

Thanks,
Adheer

> -Original Message-
> From: Dan Carpenter [mailto:dan.carpen...@oracle.com]
> Sent: Tuesday, April 16, 2013 12:25 AM
> To: Adheer Chandravanshi
> Cc: linux-scsi@vger.kernel.org
> Subject: re: [SCSI] qla4xxx: Add flash node mgmt support
>
> Hi Adheer,
>
> The patch 1e9e2be3ee03: "[SCSI] qla4xxx: Add flash node mgmt support"
> from Mar 22, 2013, has several endian bugs.
>
> drivers/scsi/qla4xxx/ql4_os.c
>   2217  fw_ddb_entry->tgt_portal_grp = cpu_to_le16(sess->tpgt);
>   2218  fw_ddb_entry->mss = cpu_to_le16(conn->max_segment_size);
>   2219  fw_ddb_entry->tcp_xmt_wsf = cpu_to_le16(conn-
> >tcp_xmit_wsf);
>   ^^^ This is u8.
>
>   2220  fw_ddb_entry->tcp_rcv_wsf = cpu_to_le16(conn-
> >tcp_recv_wsf);
>   ^^^ This is u8.
>
>   2221  fw_ddb_entry->ipv4_tos = conn->ipv4_tos;
>     fw_ddb_entry->ipv6_flow_lbl = cpu_to_le16(conn-
> >ipv6_flow_label);
>   2223  fw_ddb_entry->ka_timeout = cpu_to_le16(conn-
> >keepalive_timeout);
>   2224  fw_ddb_entry->lcl_port = cpu_to_le16(conn->local_port);
>   2225  fw_ddb_entry->stat_sn = cpu_to_le16(conn->statsn);
>   ^^^
> This is u32.
>
>   2226  fw_ddb_entry->exp_stat_sn = cpu_to_le16(conn->exp_statsn);
>   ^^^ This is u32.
>
>   2227  fw_ddb_entry->ddb_link = cpu_to_le16(sess-
> >discovery_parent_type);
>   2228  fw_ddb_entry->chap_tbl_idx = cpu_to_le16(sess-
> >chap_out_idx);
>   2229  fw_ddb_entry->tsid = cpu_to_le16(sess->tsid);
>
> Theoretically these should have been caught by Sparse:
> http://lwn.net/Articles/205624/
>
> But unfortunately, Sparse hits an error parsing the external_hw_config_reg
> union because it uses bitfields as part of __le32 data.  After you hit a 
> Sparse
> error then it doesn't bother to print warnings.  This is arguably a UI problem
> in Sparse and it took me forever to figure out why the warnings weren't
> being printed.  :/
>
> If I changed the external_hw_config_reg to use u32 instead of __le32 then
> Sparse gives the max number of warnings.  I'm not sure that that's the right
> thing to do.  Are those bitfields actually used?  Maybe we should just delete
> it.
>
> Anyway, I've attached the warnings below.
>
> regards,
> dan carpenter
>
> :1223:2: warning: #warning syscall finit_module not implemented [-
> Wcpp]
> devel/drivers/scsi/qla4xxx/ql4_os.c:1370:28: warning: incorrect type in
> assignment (different base types)
> devel/drivers/scsi/qla4xxx/ql4_os.c:1370:28:expected unsigned int
> [unsigned] [usertype] cookie
> devel/drivers/scsi/qla4xxx/ql4_os.c:1370:28:got restricted __le32
> [usertype] 
> devel/drivers/scsi/qla4xxx/ql4_os.c:1890:21: warning: incorrect type in
> assignment (different base types)
> devel/drivers/scsi/qla4xxx/ql4_os.c:1890:21:expected restricted itt_t
> [usertype] itt
> devel/drivers/scsi/qla4xxx/ql4_os.c:1890:21:got unsigned int [unsigned]
> [usertype] handle
> devel/drivers/scsi/qla4xxx/ql4_os.c:901:32: warning: cast to restricted __le64
> devel/drivers/scsi/qla4xxx/ql4_os.c:902:32: warning: cast to restricted __le64
> devel/drivers/scsi/qla4xxx/ql4_os.c:904:29: warning: cast to restricted __le32
> devel/drivers/scsi/qla4xxx/ql4_os.c:905:31: warning: cast to restricted __le32
> devel/drivers/scsi/qla4xxx/ql4_os.c:906:30: warning: cast to restricted __le32
> devel/drivers/scsi/qla4xxx/ql4_os.c:907:29: warning: cast to restricted __le32
> devel/drivers/scsi/qla4xxx/ql4_os.c:908:28: warning: cast to restricted __le32
> devel/drivers/scsi/qla4xxx/ql4_os.c:909:31: warning: cast to restricted __le32
> devel/drivers/scsi/qla4xxx/ql4_os.c:910:30: warning: cast to restricted __le32
> devel/drivers/scsi/qla4xxx/ql4_os.c:911:29: warning: cast to restricted __le32
> devel/drivers/scsi/qla4xxx/ql4_os.c:913:29: warning: cast to restricted __le32
> devel/drivers/scsi/qla4xxx/ql4_os.c:914:31: warning: cast to restricted __le32
> devel/drivers/scsi/qla4xxx/ql4_os.c:915:30: warning: cast to restricted __le32
> devel/drivers/scsi/qla4xxx/ql4_os.c:916:31: warning: cast to restricted __le32
> devel/drivers/scsi/qla4xxx/ql4_os.c:917:30: warning: cast to restricted __le32
> devel/drivers/scsi/qla4xxx/ql4_os.c:919:25: warning: cast to restricted __le32
> devel/drivers/scsi/qla4xxx/ql4_os.c:920:27: warning: cast to restricted __le32
> devel/drivers/scsi/qla4xxx/ql4_os.c:921:29: warning: cast to restricted __le32
> devel/drivers/scsi/qla4xxx/ql4_os.c:922:27: warning: cast to restricted __le32
> devel/drivers/scsi/qla4xxx/ql4_os.c:502:21: warning: restricted __le16
> degrades to integer
> devel/drivers/scsi/qla4xxx/ql4_os.c:627:9: warning: cast to restricted __le16
> devel/drivers/scsi/qla4xxx/ql4_os.c:630:13: warning: cast to restricted __le16
> devel/drivers/scsi/qla4xxx/ql4_os.c:635:28: 

Re: block: Allow merging of tail pages into the last segment

2013-04-16 Thread Jan Vesely
On 28/03/13 10:38, Jan Vesely wrote:
> Hi
> 
> These patches modify __bio_add_page to accept pages that extent the last bio
> segment. some drivers craft their buffers and rely on this behavior (see
> message in patch 2 for details)

any comments on this version would be appreciated

thanks

> 
> jan
> 
> v3: Use code from __blk_recalc_rq_segments to decide whether the page is
> mergeable, 
> 
> v2: modify a comment
> 
> Jan Vesely (2):
>   block: factor out vector mergeable decision to a helper function
>   block: modify __bio_add_page check to accept pages that don't start a 
> new
> 
>  block/blk-merge.c   | 52 +++-
>  fs/bio.c| 29 ++---
>  include/linux/bio.h |  3 +++
>  3 files changed, 52 insertions(+), 32 deletions(-)
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


-- 
Jan Vesely 
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch] [SCSI] megaraid_sas: release lock on error path

2013-04-16 Thread Dan Carpenter
We should unlock here before returning.

Signed-off-by: Dan Carpenter 

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c 
b/drivers/scsi/megaraid/megaraid_sas_base.c
index 9d53540..eb2385f 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -4931,11 +4931,12 @@ static int megasas_mgmt_ioctl_fw(struct file *file, 
unsigned long arg)
printk(KERN_ERR "megaraid_sas: timed out while"
"waiting for HBA to recover\n");
error = -ENODEV;
-   goto out_kfree_ioc;
+   goto out_up;
}
spin_unlock_irqrestore(&instance->hba_lock, flags);
 
error = megasas_mgmt_fw_ioctl(instance, user_ioc, ioc);
+  out_up:
up(&instance->ioctl_sem);
 
   out_kfree_ioc:
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html