ecryptfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Li Wang <liwang@nudt.edu.cn>
To: Tyler Hicks <tyhicks@canonical.com>
Cc: ecryptfs@vger.kernel.org, linux-kernel@vger.kernel.org,
	Li Wang <liwang@nudt.edu.cn>
Subject: [PATCH 2/3] eCryptfs: Remove redundant IF statement
Date: Fri, 17 Feb 2012 00:36:49 +0800	[thread overview]
Message-ID: <529380705.15452@eyou.net> (raw)
Message-ID: <1329410210-2712-2-git-send-email-liwang@nudt.edu.cn> (raw)
In-Reply-To: <1329410210-2712-1-git-send-email-liwang@nudt.edu.cn>

ecryptfs_write_begin(mmap.c)
1  ...
2  if (index != 0) {
3	if (prev_page_end_size > i_size_read(page->mapping->host)) {
4		...
5	}
6	...
7  }
The IF statement in line 2 is redundant since the IF statement in line
3 deduces that.

Signed-off-by: Li Wang <liwang@nudt.edu.cn>
---
 fs/ecryptfs/mmap.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/fs/ecryptfs/mmap.c b/fs/ecryptfs/mmap.c
index 27c0da8..59a8e57 100644
--- a/fs/ecryptfs/mmap.c
+++ b/fs/ecryptfs/mmap.c
@@ -368,8 +368,7 @@ static int ecryptfs_write_begin(struct file *file,
 	}
 	/* If creating a page or more of holes, zero them out via truncate.
 	 * Note, this will increase i_size. */
-	if (index != 0) {
-		if (prev_page_end_size > i_size_read(page->mapping->host)) {
+	if (prev_page_end_size > i_size_read(page->mapping->host)) {
 			rc = ecryptfs_truncate(file->f_path.dentry,
 					       prev_page_end_size);
 			if (rc) {
@@ -379,7 +378,6 @@ static int ecryptfs_write_begin(struct file *file,
 				       prev_page_end_size, rc);
 				goto out;
 			}
-		}
 	}
 out:
 	if (unlikely(rc)) {
-- 
1.7.6.5

  parent reply	other threads:[~2012-02-16  8:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1329410210-2712-1-git-send-email-liwang@nudt.edu.cn>
2012-02-16 16:36 ` [PATCH 1/3] eCryptfs: Write bug for non-ecryptfs file Li Wang
2012-02-16 16:36 ` Li Wang
     [not found] ` <1329410210-2712-2-git-send-email-liwang@nudt.edu.cn>
2012-02-16 16:36   ` [PATCH 2/3] eCryptfs: Remove redundant IF statement Li Wang
2012-02-16 16:36   ` Li Wang [this message]
     [not found] ` <1329410210-2712-3-git-send-email-liwang@nudt.edu.cn>
2012-02-16 16:36   ` [PATCH 3/3] eCryptfs: Remove unreached codes Li Wang
2012-02-16 16:36   ` Li Wang

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=529380705.15452@eyou.net \
    --to=liwang@nudt.edu.cn \
    --cc=ecryptfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tyhicks@canonical.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).