From: Ted Ts'o <tytso@mit.edu>
To: Yongqiang Yang <xiaoqiangnk@gmail.com>
Cc: linux-ext4@vger.kernel.org
Subject: Re: [PATCH 3/4] ext4: let AGGRESSIVE_TEST brace code only related to itself
Date: Sat, 29 Oct 2011 09:30:13 -0400 [thread overview]
Message-ID: <20111029133013.GG19536@thunk.org> (raw)
In-Reply-To: <1319613112-16807-3-git-send-email-xiaoqiangnk@gmail.com>
On Wed, Oct 26, 2011 at 03:11:51PM +0800, Yongqiang Yang wrote:
> Signed-off-by: Yongqiang Yang <xiaoqiangnk@gmail.com>
Applied, with a minor tweak --- this *is* a place where folding two
nested if statements is a good idea (and reduces ext4's lines of code
count :-).
- Ted
commit 2a83a909eab183807ca3ccbb2559e22611131336
Author: Yongqiang Yang <xiaoqiangnk@gmail.com>
Date: Sat Oct 29 09:29:11 2011 -0400
ext4: clean up AGGRESSIVE_TEST code
Signed-off-by: Yongqiang Yang <xiaoqiangnk@gmail.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 73823d5..b66cef0 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -181,12 +181,10 @@ static inline int ext4_ext_space_block(struct inode *inode, int check)
size = (inode->i_sb->s_blocksize - sizeof(struct ext4_extent_header))
/ sizeof(struct ext4_extent);
- if (!check) {
#ifdef AGGRESSIVE_TEST
- if (size > 6)
- size = 6;
+ if (!check && size > 6)
+ size = 6;
#endif
- }
return size;
}
@@ -196,12 +194,10 @@ static inline int ext4_ext_space_block_idx(struct inode *inode, int check)
size = (inode->i_sb->s_blocksize - sizeof(struct ext4_extent_header))
/ sizeof(struct ext4_extent_idx);
- if (!check) {
#ifdef AGGRESSIVE_TEST
- if (size > 5)
- size = 5;
+ if (!check && size > 5)
+ size = 5;
#endif
- }
return size;
}
@@ -212,12 +208,10 @@ static inline int ext4_ext_space_root(struct inode *inode, int check)
size = sizeof(EXT4_I(inode)->i_data);
size -= sizeof(struct ext4_extent_header);
size /= sizeof(struct ext4_extent);
- if (!check) {
#ifdef AGGRESSIVE_TEST
- if (size > 3)
- size = 3;
+ if (!check && size > 3)
+ size = 3;
#endif
- }
return size;
}
@@ -228,12 +222,10 @@ static inline int ext4_ext_space_root_idx(struct inode *inode, int check)
size = sizeof(EXT4_I(inode)->i_data);
size -= sizeof(struct ext4_extent_header);
size /= sizeof(struct ext4_extent_idx);
- if (!check) {
#ifdef AGGRESSIVE_TEST
- if (size > 4)
- size = 4;
+ if (!check && size > 4)
+ size = 4;
#endif
- }
return size;
}
next prev parent reply other threads:[~2011-10-29 18:12 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-26 7:11 [PATCH 1/4] ext4: fold two if statements into one Yongqiang Yang
2011-10-26 7:11 ` [PATCH 2/4] ext4: move variable to its scope Yongqiang Yang
2011-10-29 13:24 ` Ted Ts'o
2011-10-26 7:11 ` [PATCH 3/4] ext4: let AGGRESSIVE_TEST brace code only related to itself Yongqiang Yang
2011-10-29 13:30 ` Ted Ts'o [this message]
2011-10-26 7:11 ` [PATCH 4/4] ext4: trace punch_hole correctly in ext4_ext_map_blocks Yongqiang Yang
2011-10-29 13:51 ` Ted Ts'o
2011-10-29 13:14 ` [PATCH 1/4] ext4: fold two if statements into one Ted Ts'o
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=20111029133013.GG19536@thunk.org \
--to=tytso@mit.edu \
--cc=linux-ext4@vger.kernel.org \
--cc=xiaoqiangnk@gmail.com \
/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).