• Filipe Manana's avatar
    btrfs: avoid pointless wake ups of drew lock readers · c79f57ea
    Filipe Manana authored
    When unlocking a write lock on a drew lock, at btrfs_drew_write_unlock(),
    it's pointless to wake up tasks waiting to acquire a read lock if we
    didn't decrement the 'writers' counter down to 0, since a read lock can
    only be acquired when the counter reaches a value of 0. Doing so is
    harmless from a functional point of view, but it's not efficient due to
    unnecessarily waking up tasks just for them to sleep again on the
    waitqueue.
    
    So change this to wake up readers only if we decremented the 'writers'
    counter to 0.
    Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
    Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    c79f57ea
locking.c 10.5 KB