linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yongqiang Yang <xiaoqiangnk@gmail.com>
To: tytso@mit.edu
Cc: linux-ext4@vger.kernel.org, Yongqiang Yang <xiaoqiangnk@gmail.com>
Subject: [PATCH] ext4:Fix credits computing for indirect mapped files.
Date: Fri, 25 Mar 2011 21:10:05 +0800	[thread overview]
Message-ID: <1301058605-29978-1-git-send-email-xiaoqiangnk@gmail.com> (raw)

Either the first block or the last one could be not aligned with
block boundary, 1 block is needed to fix it.

Signed-off-by: Yongqiang Yang <xiaoqiangnk@gmail.com>
---
 fs/ext4/inode.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 67e7a3c..7193f23 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -5380,11 +5380,11 @@ static int ext4_indirect_trans_blocks(struct inode *inode, int nrblocks,
 	if (chunk) {
 		/*
 		 * With N contiguous data blocks, it need at most
-		 * N/EXT4_ADDR_PER_BLOCK(inode->i_sb) indirect blocks
+		 * N/EXT4_ADDR_PER_BLOCK(inode->i_sb) + 1 indirect blocks
 		 * 2 dindirect blocks
 		 * 1 tindirect block
 		 */
-		indirects = nrblocks / EXT4_ADDR_PER_BLOCK(inode->i_sb);
+		indirects = nrblocks / EXT4_ADDR_PER_BLOCK(inode->i_sb) + 1;
 		return indirects + 3;
 	}
 	/*
-- 
1.7.4


             reply	other threads:[~2011-03-25 13:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-25 13:10 Yongqiang Yang [this message]
2011-04-04 19:39 ` [PATCH] ext4:Fix credits computing for indirect mapped files Ted Ts'o
2011-04-05  5:02   ` Yongqiang Yang

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=1301058605-29978-1-git-send-email-xiaoqiangnk@gmail.com \
    --to=xiaoqiangnk@gmail.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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).