]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: Factor out read portion of btrfs_get_blocks_direct
authorNikolay Borisov <nborisov@suse.com>
Wed, 2 May 2018 12:19:32 +0000 (15:19 +0300)
committerDavid Sterba <dsterba@suse.com>
Wed, 30 May 2018 17:01:43 +0000 (19:01 +0200)
commitbddecea66d6349154ae946808ec1403b873b2970
treeb7efe4b80688df675a2ecbde7455eed64760463c
parent9977034e474fc807816c5a6dd2956f10a41f67f5
btrfs: Factor out read portion of btrfs_get_blocks_direct

Currently this function handles both the READ and WRITE dio cases. This
is facilitated by a bunch of 'if' statements, a goto short-circuit
statement and a very perverse aliasing of "!created"(READ) case
by setting lockstart = lockend and checking for lockstart < lockend for
detecting the write. Let's simplify this mess by extracting the
READ-only code into a separate __btrfs_get_block_direct_read function.
This is only the first step, the next one will be to factor out the
write side as well. The end goal will be to have the common locking/
unlocking code in btrfs_get_blocks_direct and then it will call either
the read|write subvariants. No functional changes.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/inode.c