public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] fs/ext4/inode.c: Add unlikely() to ext4_iget
@ 2014-02-23 19:01 Fabian Frederick
  2014-02-23 22:15 ` Theodore Ts'o
  0 siblings, 1 reply; 2+ messages in thread
From: Fabian Frederick @ 2014-02-23 19:01 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm, Tytso

Isolate no memory and bad inode cases in ext4_iget.

Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
 fs/ext4/inode.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 6e39895..e11c30b9 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -4009,7 +4009,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
 	gid_t i_gid;
 
 	inode = iget_locked(sb, ino);
-	if (!inode)
+	if (unlikely(!inode))
 		return ERR_PTR(-ENOMEM);
 	if (!(inode->i_state & I_NEW))
 		return inode;
@@ -4018,14 +4018,14 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
 	iloc.bh = NULL;
 
 	ret = __ext4_get_inode_loc(inode, &iloc, 0);
-	if (ret < 0)
+	if (unlikely(ret < 0))
 		goto bad_inode;
 	raw_inode = ext4_raw_inode(&iloc);
 
 	if (EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE) {
 		ei->i_extra_isize = le16_to_cpu(raw_inode->i_extra_isize);
-		if (EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize >
-		    EXT4_INODE_SIZE(inode->i_sb)) {
+		if (unlikely(EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize >
+		    EXT4_INODE_SIZE(inode->i_sb))) {
 			EXT4_ERROR_INODE(inode, "bad extra_isize (%u != %u)",
 				EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize,
 				EXT4_INODE_SIZE(inode->i_sb));
@@ -4048,7 +4048,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
 					      sizeof(gen));
 	}
 
-	if (!ext4_inode_csum_verify(inode, raw_inode, ei)) {
+	if (unlikely(!ext4_inode_csum_verify(inode, raw_inode, ei))) {
 		EXT4_ERROR_INODE(inode, "checksum invalid");
 		ret = -EIO;
 		goto bad_inode;
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] fs/ext4/inode.c: Add unlikely() to ext4_iget
  2014-02-23 19:01 [PATCH 1/1] fs/ext4/inode.c: Add unlikely() to ext4_iget Fabian Frederick
@ 2014-02-23 22:15 ` Theodore Ts'o
  0 siblings, 0 replies; 2+ messages in thread
From: Theodore Ts'o @ 2014-02-23 22:15 UTC (permalink / raw)
  To: Fabian Frederick; +Cc: linux-kernel, akpm

On Sun, Feb 23, 2014 at 08:01:15PM +0100, Fabian Frederick wrote:
> Isolate no memory and bad inode cases in ext4_iget.
> 
> Signed-off-by: Fabian Frederick <fabf@skynet.be>

Does this result in a measurable performance difference?

     	  	      		 	     - Ted

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-02-23 22:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-23 19:01 [PATCH 1/1] fs/ext4/inode.c: Add unlikely() to ext4_iget Fabian Frederick
2014-02-23 22:15 ` Theodore Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox