]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: assert extent_map bdevs and lookup_map and split
authorDavid Sterba <dsterba@suse.com>
Fri, 10 May 2019 15:48:30 +0000 (17:48 +0200)
committerDavid Sterba <dsterba@suse.com>
Mon, 18 Nov 2019 11:47:01 +0000 (12:47 +0100)
commitd3346db204851cafc48b11c32bd6927b362f4f52
treef06decac1cabe8a03096d32b9dce69b867e365dc
parentd80c1edef38fef7388ed260e7c6adea3231b9c37
btrfs: assert extent_map bdevs and lookup_map and split

This is a preparatory patch for removing extent_map::bdev. There's some
history behind the code so this is only precaution to catch if things
break before the actual removal happens.

Logically, comparing a raw low-level block device (bdev) does not make
sense for extent maps (high-level objects). This had no effect in
practice but was quite confusing in the code.  The lookup_map is set iff
EXTENT_FLAG_FS_MAPPING is set.

The two pointers were stored in the same bytes and used potentially in
two meanings. Now they're split, so the asserts are in place to check
that the condition will not change.

The lookup map pointer misused bdev, this has been changed in commit
ff0718ad4c88 ("btrfs: cleanup, stop casting for extent_map->lookup
everywhere") to the explicit type. But the semantics hasn't changed and
bdev was not actually used to decide if maps are mergeable.

Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent_map.c
fs/btrfs/extent_map.h