From: Nikolay Borisov <nborisov@suse.com>
To: linux-btrfs@vger.kernel.org
Cc: Nikolay Borisov <nborisov@suse.com>
Subject: [PATCH 3/3] btrfs-progs: check: lowmem: Refactor extent type checks in check_file_extent
Date: Thu, 13 Sep 2018 15:05:07 +0300 [thread overview]
Message-ID: <20180913120507.18197-4-nborisov@suse.com> (raw)
In-Reply-To: <20180913120507.18197-1-nborisov@suse.com>
Make the checks in check_file_extent a bit more explicit. First we check
for unknown type and fail accordingly. Then we check for inline extent
and handle it in the newly introduced check_file_extent_inline. Finally
if none of the above checks triggered then we must have a regular or
prealloc extents.
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
check/mode-lowmem.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/check/mode-lowmem.c b/check/mode-lowmem.c
index 3a6fbb33c858..aa946a1307de 100644
--- a/check/mode-lowmem.c
+++ b/check/mode-lowmem.c
@@ -1915,21 +1915,23 @@ static int check_file_extent(struct btrfs_root *root, struct btrfs_path *path,
btrfs_item_key_to_cpu(node, &fkey, slot);
fi = btrfs_item_ptr(node, slot, struct btrfs_file_extent_item);
-
- /* Check inline extent */
extent_type = btrfs_file_extent_type(node, fi);
- if (extent_type == BTRFS_FILE_EXTENT_INLINE)
- return check_file_extent_inline(root, path, size, end);
/* Check extent type */
if (extent_type != BTRFS_FILE_EXTENT_REG &&
- extent_type != BTRFS_FILE_EXTENT_PREALLOC) {
+ extent_type != BTRFS_FILE_EXTENT_PREALLOC &&
+ extent_type != BTRFS_FILE_EXTENT_INLINE) {
err |= FILE_EXTENT_ERROR;
error("root %llu EXTENT_DATA[%llu %llu] type bad",
root->objectid, fkey.objectid, fkey.offset);
return err;
}
+ /* Check inline extent */
+ if (extent_type == BTRFS_FILE_EXTENT_INLINE)
+ return check_file_extent_inline(root, path, size, end);
+
+
/* Check REG_EXTENT/PREALLOC_EXTENT */
disk_bytenr = btrfs_file_extent_disk_bytenr(node, fi);
disk_num_bytes = btrfs_file_extent_disk_num_bytes(node, fi);
--
2.17.1
next prev parent reply other threads:[~2018-09-13 17:14 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-13 12:05 [PATCH 0/3] Misc refactoring of check_file_extent Nikolay Borisov
2018-09-13 12:05 ` [PATCH 1/3] btrfs-progs: check: lowmem: Factor out inline extent checking code in its own function Nikolay Borisov
2018-09-13 23:05 ` Qu Wenruo
2018-10-31 9:35 ` misono.tomohiro
2018-10-31 9:43 ` Nikolay Borisov
2018-10-31 17:19 ` David Sterba
2018-10-31 9:40 ` misono.tomohiro
2018-09-13 12:05 ` [PATCH 2/3] btrfs-progs: check: lowmem: Refactor extent len test in check_file_extent_inline Nikolay Borisov
2018-09-13 23:07 ` Qu Wenruo
2018-09-13 12:05 ` Nikolay Borisov [this message]
2018-09-13 23:08 ` [PATCH 3/3] btrfs-progs: check: lowmem: Refactor extent type checks in check_file_extent Qu Wenruo
2018-09-13 12:23 ` [PATCH 0/3] Misc refactoring of check_file_extent Lu Fengqi
2018-10-24 17:45 ` David Sterba
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180913120507.18197-4-nborisov@suse.com \
--to=nborisov@suse.com \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).