linux/drivers/scsi/aacraid
Arnd Bergmann c45d15d24e scsi: autoconvert trivial BKL users to private mutex
All these files use the big kernel lock in a trivial
way to serialize their private file operations,
typically resulting from an earlier semi-automatic
pushdown from VFS.

None of these drivers appears to want to lock against
other code, and they all use the BKL as the top-level
lock in their file operations, meaning that there
is no lock-order inversion problem.

Consequently, we can remove the BKL completely,
replacing it with a per-file mutex in every case.
Using a scripted approach means we can avoid
typos.

file=$1
name=$2
if grep -q lock_kernel ${file} ; then
    if grep -q 'include.*linux.mutex.h' ${file} ; then
            sed -i '/include.*<linux\/smp_lock.h>/d' ${file}
    else
            sed -i 's/include.*<linux\/smp_lock.h>.*$/include <linux\/mutex.h>/g' ${file}
    fi
    sed -i ${file} \
        -e "/^#include.*linux.mutex.h/,$ {
                1,/^\(static\|int\|long\)/ {
                     /^\(static\|int\|long\)/istatic DEFINE_MUTEX(${name}_mutex);

} }"  \
    -e "s/\(un\)*lock_kernel\>[ ]*()/mutex_\1lock(\&${name}_mutex)/g" \
    -e '/[      ]*cycle_kernel_lock();/d'
else
    sed -i -e '/include.*\<smp_lock.h\>/d' ${file}  \
                -e '/cycle_kernel_lock()/d'
fi

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: linux-scsi@vger.kernel.org
Cc: "James E.J. Bottomley" <James.Bottomley@suse.de>
2010-09-15 21:00:45 +02:00
..
Makefile [SCSI] aacraid: Begin adding support for new adapter type 2007-01-27 09:27:31 -06:00
TODO
aachba.c [SCSI] aacraid: prohibit access to array container space 2010-05-16 22:49:46 -04:00
aacraid.h [SCSI] aacraid: add an ifdef'd device delete case instead of taking the device offline 2010-05-16 22:58:27 -04:00
commctrl.c [SCSI] aacraid: Eliminate use after free 2010-05-25 10:59:07 -05:00
comminit.c [SCSI] aacraid: fix File System going into read-only mode 2010-01-17 12:16:17 -06:00
commsup.c [SCSI] aacraid: add an ifdef'd device delete case instead of taking the device offline 2010-05-16 22:58:27 -04:00
dpcsup.c [SCSI] aacraid: fix File System going into read-only mode 2010-01-17 12:16:17 -06:00
linit.c scsi: autoconvert trivial BKL users to private mutex 2010-09-15 21:00:45 +02:00
nark.c [SCSI] aacraid: draw line in sand, sundry cleanup and version update 2007-07-27 09:13:28 -04:00
rkt.c [SCSI] Clean up my email address and use a single standard address for everything 2008-12-29 11:24:12 -06:00
rx.c drivers: scsi: use newly introduced hex_to_bin() method 2010-08-11 08:59:02 -07:00
sa.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00