[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1301058605-29978-1-git-send-email-xiaoqiangnk@gmail.com>
Date: Fri, 25 Mar 2011 21:10:05 +0800
From: Yongqiang Yang <xiaoqiangnk@...il.com>
To: tytso@....edu
Cc: linux-ext4@...r.kernel.org, Yongqiang Yang <xiaoqiangnk@...il.com>
Subject: [PATCH] ext4:Fix credits computing for indirect mapped files.
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@...il.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
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists