WSL2-Linux-Kernel/drivers/block
Arnd Bergmann 613655fa39 drivers: 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.

These drivers do not seem to be under active
maintainance from my brief investigation. Apologies
to those maintainers that I have missed.

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>
2010-10-05 15:01:04 +02:00
..
aoe block: push down BKL into .open and .release 2010-08-07 18:25:34 +02:00
drbd Merge branch 'for-2.6.36' of git://git.kernel.dk/linux-2.6-block 2010-08-10 15:22:42 -07:00
paride drivers: autoconvert trivial BKL users to private mutex 2010-10-05 15:01:04 +02:00
DAC960.c block: push down BKL into .open and .release 2010-08-07 18:25:34 +02:00
DAC960.h
Kconfig paride: fix menu indentation 2010-05-11 09:02:55 +02:00
Makefile The DRBD driver 2009-10-01 21:17:49 +02:00
amiflop.c block: push down BKL into .open and .release 2010-08-07 18:25:34 +02:00
ataflop.c block: push down BKL into .open and .release 2010-08-07 18:25:34 +02:00
brd.c block: push down BKL into .locked_ioctl 2010-08-07 18:25:00 +02:00
cciss.c cciss: fix reporting of max queue depth since init 2010-08-25 19:58:53 +02:00
cciss.h cciss: use consistent variable names 2010-08-07 18:52:30 +02:00
cciss_cmd.h cciss: fix hard reset code. 2010-08-07 18:52:30 +02:00
cciss_scsi.c cciss: change printks to dev_warn, etc. 2010-08-07 18:52:30 +02:00
cciss_scsi.h cciss: remove C99-style comments 2010-02-22 13:44:45 +01:00
cpqarray.c cpqarray: check put_user() result 2010-08-07 18:53:03 +02:00
cpqarray.h
cryptoloop.c drivers: Remove unnecessary inclusions of asm/semaphore.h 2008-04-18 22:16:32 -04:00
floppy.c floppy: make controller const 2010-08-07 18:52:31 +02:00
hd.c block: remove wrappers for request type/flags 2010-08-07 18:17:56 +02:00
ida_cmd.h
ida_ioctl.h
loop.c BLOCK: fix bio.bi_rw handling 2010-08-23 12:33:10 +02:00
mg_disk.c block: switch s390 tape_block and mg_disk to elevator_change() 2010-08-23 14:02:44 +02:00
nbd.c Merge branch 'for-2.6.36' of git://git.kernel.dk/linux-2.6-block 2010-08-10 15:22:42 -07:00
osdblk.c block: remove q->prepare_flush_fn completely 2010-08-07 18:24:15 +02:00
pktcdvd.c block: push down BKL into .open and .release 2010-08-07 18:25:34 +02:00
ps3disk.c block: remove q->prepare_flush_fn completely 2010-08-07 18:24:15 +02:00
ps3vram.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
smart1,2.h
sunvdc.c block: Consolidate phys_segment and hw_segment limits 2010-02-26 13:58:08 +01:00
swim.c block: push down BKL into .open and .release 2010-08-07 18:25:34 +02:00
swim3.c block: push down BKL into .open and .release 2010-08-07 18:25:34 +02:00
swim_asm.S m68k: mac - Add SWIM floppy support 2009-03-26 21:15:27 +01:00
sx8.c block: Consolidate phys_segment and hw_segment limits 2010-02-26 13:58:08 +01:00
ub.c block: push down BKL into .open and .release 2010-08-07 18:25:34 +02:00
umem.c block: unify flags for struct bio and struct request 2010-08-07 18:20:39 +02:00
umem.h
viodasd.c block: push down BKL into .open and .release 2010-08-07 18:25:34 +02:00
virtio_blk.c Merge branch 'for-2.6.36' of git://git.kernel.dk/linux-2.6-block 2010-08-10 15:22:42 -07:00
xd.c block: push down BKL into .locked_ioctl 2010-08-07 18:25:00 +02:00
xd.h [PATCH] switch xd 2008-10-21 07:48:11 -04:00
xen-blkfront.c xen: pvhvm: rename xen_emul_unplug=ignore to =unnnecessary 2010-08-23 11:59:29 +01:00
xsysace.c of: fix missing headers for of_address_to_resource() in MTD and SysACE drivers 2010-08-17 13:16:47 -06:00
z2ram.c block: push down BKL into .open and .release 2010-08-07 18:25:34 +02:00