linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Manish Sharma <manishrma@gmail.com>
To: Phillip Lougher <phillip@squashfs.org.uk>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	kernelnewbies@kernelnewbies.org,
	Manish Sharma <manishrma@gmail.com>
Subject: [PATCH 1/1] Squashfs: Optimized uncompressed buffer loop
Date: Tue,  6 Aug 2013 00:16:27 +0530	[thread overview]
Message-ID: <1375728387-3595-1-git-send-email-manishrma@gmail.com> (raw)

Merged the two for loops. We might get a little gain by overlapping
wait_on_bh and the memcpy operations.

Signed-off-by: Manish Sharma <manishrma@gmail.com>
---
 fs/squashfs/block.c |    9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/fs/squashfs/block.c b/fs/squashfs/block.c
index fb50652..5012f98 100644
--- a/fs/squashfs/block.c
+++ b/fs/squashfs/block.c
@@ -169,12 +169,6 @@ int squashfs_read_data(struct super_block *sb, void **buffer, u64 index,
		 */
		int i, in, pg_offset = 0;

-		for (i = 0; i < b; i++) {
-			wait_on_buffer(bh[i]);
-			if (!buffer_uptodate(bh[i]))
-				goto block_release;
-		}
-
		for (bytes = length; k < b; k++) {
			in = min(bytes, msblk->devblksize - offset);
			bytes -= in;
@@ -185,6 +179,9 @@ int squashfs_read_data(struct super_block *sb, void **buffer, u64 index,
				}
				avail = min_t(int, in, PAGE_CACHE_SIZE -
						pg_offset);
+				wait_on_buffer(bh[k]);
+				if (!buffer_uptodate(bh[k]))
+					goto block_release;
				memcpy(buffer[page] + pg_offset,
						bh[k]->b_data + offset, avail);
				in -= avail;
--
1.7.9.5

             reply	other threads:[~2013-08-05 18:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-05 18:46 Manish Sharma [this message]
2013-08-29  2:42 ` [PATCH 1/1] Squashfs: Optimized uncompressed buffer loop Phillip Lougher
2013-08-29  3:24 Phillip Lougher

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=1375728387-3595-1-git-send-email-manishrma@gmail.com \
    --to=manishrma@gmail.com \
    --cc=kernelnewbies@kernelnewbies.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=phillip@squashfs.org.uk \
    /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).