linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Davide Italiano <dccitaliano@gmail.com>
To: linux-ext4@vger.kernel.org
Cc: Davide Italiano <dccitaliano@gmail.com>
Subject: [PATCH] ext4: Remove redundant check under lock scope
Date: Mon,  6 Apr 2015 22:35:01 -0700	[thread overview]
Message-ID: <1428384901-2304-2-git-send-email-dccitaliano@gmail.com> (raw)
In-Reply-To: <1428384901-2304-1-git-send-email-dccitaliano@gmail.com>

ext4_zero_range() and ext4_collapse_range() duplicate
the check in ext4_fallocate(). The checks are made with
inode lock held when there's no need for that. Remove them,
reducing the scope of the lock.

Signed-off-by: Davide Italiano <dccitaliano@gmail.com>
---
 fs/ext4/extents.c | 16 ----------------
 1 file changed, 16 deletions(-)

diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index bed4308..9e6fa09 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -4810,15 +4810,6 @@ static long ext4_zero_range(struct file *file, loff_t offset,
 		flags |= EXT4_GET_BLOCKS_KEEP_SIZE;
 
 	mutex_lock(&inode->i_mutex);
-
-	/*
-	 * Indirect files do not support unwritten extnets
-	 */
-	if (!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))) {
-		ret = -EOPNOTSUPP;
-		goto out_mutex;
-	}
-
 	if (!(mode & FALLOC_FL_KEEP_SIZE) &&
 	     offset + len > i_size_read(inode)) {
 		new_size = offset + len;
@@ -5445,13 +5436,6 @@ int ext4_collapse_range(struct inode *inode, loff_t offset, loff_t len)
 		ret = -EINVAL;
 		goto out_mutex;
 	}
-
-	/* Currently just for extent based files */
-	if (!ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)) {
-		ret = -EOPNOTSUPP;
-		goto out_mutex;
-	}

  reply	other threads:[~2015-04-07  5:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-07  5:35 [PATCH] Remove redundant check under lock scope in fallocate() Davide Italiano
2015-04-07  5:35 ` Davide Italiano [this message]
2015-04-07 10:13   ` [PATCH] ext4: Remove redundant check under lock scope Dmitry Monakhov
2015-04-07 18:15     ` Davide Italiano

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=1428384901-2304-2-git-send-email-dccitaliano@gmail.com \
    --to=dccitaliano@gmail.com \
    --cc=linux-ext4@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).