From: Eric Sandeen <sandeen@redhat.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH, RFC] mkfs: collapse redundant logic in custom_alloc_extent()
Date: Fri, 25 Jan 2013 09:57:08 -0600 [thread overview]
Message-ID: <5102AB54.3050704@redhat.com> (raw)
It looks to me like the logic in these two if statements are
overlapping.
The test for flags & BTRFS_BLOCK_GROUP_SYSTEM in the 2nd case
should never get triggered, because it would have triggered
on the first case, right?
And since the actions are identical in both cases, this can be
collapsed into one.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
p.s.
Having done that, I now look at the nearly identical
custom_alloc_extent() copy in convert.c, and wonder if it's
intentional that the convert copy does not care about
BTRFS_BLOCK_GROUP_METADATA, but mkfs does? I'm not quite
sure what's going on there.
Thanks,
-Eric
diff --git a/mkfs.c b/mkfs.c
index ca850d9..5d77428 100644
--- a/mkfs.c
+++ b/mkfs.c
@@ -635,14 +635,10 @@ static int custom_alloc_extent(struct btrfs_root *root, u64 num_bytes,
cache = btrfs_lookup_block_group(root->fs_info, start);
BUG_ON(!cache);
- if (cache->flags & BTRFS_BLOCK_GROUP_SYSTEM ||
- last > cache->key.objectid + cache->key.offset) {
- last = cache->key.objectid + cache->key.offset;
- continue;
- }
if (cache->flags & (BTRFS_BLOCK_GROUP_SYSTEM |
- BTRFS_BLOCK_GROUP_METADATA)) {
+ BTRFS_BLOCK_GROUP_METADATA) ||
+ last > cache->key.objectid + cache->key.offset) {
last = cache->key.objectid + cache->key.offset;
continue;
}
next reply other threads:[~2013-01-25 15:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-25 15:57 Eric Sandeen [this message]
2013-01-29 13:12 ` [PATCH, RFC] mkfs: collapse redundant logic in custom_alloc_extent() Alex Lyakas
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=5102AB54.3050704@redhat.com \
--to=sandeen@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.