]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commit - drivers/ide/ide-floppy_ioctl.c
block: autoconvert trivial BKL users to private mutex
authorArnd Bergmann <arnd@arndb.de>
Wed, 2 Jun 2010 12:28:52 +0000 (14:28 +0200)
committerArnd Bergmann <arnd@arndb.de>
Tue, 5 Oct 2010 13:01:10 +0000 (15:01 +0200)
commit2a48fc0ab24241755dc93bfd4f01d68efab47f5a
treefa9ae10ce89b26b7d8ae9ce24bdfda5e3007b763
parent613655fa39ff6957754fa8ceb8559980920eb8ee
block: autoconvert trivial BKL users to private mutex

The block device drivers have all gained new lock_kernel
calls from a recent pushdown, and some of the drivers
were already using the BKL before.

This turns the BKL into a set of per-driver mutexes.
Still need to check whether this is safe to do.

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>
43 files changed:
block/bsg.c
drivers/block/DAC960.c
drivers/block/amiflop.c
drivers/block/aoe/aoeblk.c
drivers/block/aoe/aoechr.c
drivers/block/ataflop.c
drivers/block/brd.c
drivers/block/cciss.c
drivers/block/cpqarray.c
drivers/block/drbd/drbd_main.c
drivers/block/floppy.c
drivers/block/loop.c
drivers/block/nbd.c
drivers/block/paride/pcd.c
drivers/block/paride/pd.c
drivers/block/paride/pf.c
drivers/block/pktcdvd.c
drivers/block/swim.c
drivers/block/swim3.c
drivers/block/ub.c
drivers/block/viodasd.c
drivers/block/xd.c
drivers/block/xen-blkfront.c
drivers/block/xsysace.c
drivers/block/z2ram.c
drivers/cdrom/gdrom.c
drivers/cdrom/viocd.c
drivers/ide/ide-cd.c
drivers/ide/ide-disk_ioctl.c
drivers/ide/ide-floppy_ioctl.c
drivers/ide/ide-gd.c
drivers/ide/ide-tape.c
drivers/md/dm.c
drivers/md/md.c
drivers/memstick/core/mspro_block.c
drivers/message/i2o/i2o_block.c
drivers/mmc/card/block.c
drivers/mtd/mtd_blkdevs.c
drivers/s390/char/tape_block.c
drivers/scsi/sr.c
drivers/scsi/st.c
drivers/staging/hv/blkvsc_drv.c
drivers/staging/spectra/ffsport.c