[prev in list] [next in list] [prev in thread] [next in thread]
List: btrfs-devel
Subject: [btrfs-devel][patch]skip update inode->i_blocks when extent is a hole
From: yanzheng () 21cn ! com (Yan Zheng)
Date: 2007-09-17 4:49:58
Message-ID: 3d0408630709170449p4aa32ee2v7d353f22434fa645 () mail ! gmail ! com
[Download RAW message or body]
Hello
I think check whether extent is a hole before update 'inode->i_blocks'
is unconditional required. (original codes check it only when
del_item isn't equal to 0)
Regards
YZ
diff -r d0921c0349a9 inode.c
--- a/inode.c Fri Sep 14 10:23:29 2007 -0400
+++ b/inode.c Mon Sep 17 19:23:15 2007 +0800
@@ -591,6 +591,7 @@ static int btrfs_truncate_in_trans(struc
btrfs_file_extent_type(fi) !=
BTRFS_FILE_EXTENT_INLINE) {
u64 num_dec;
+ extent_start = btrfs_file_extent_disk_blocknr(fi);
if (!del_item) {
u64 orig_num_blocks =
btrfs_file_extent_num_blocks(fi);
@@ -600,12 +601,13 @@ static int btrfs_truncate_in_trans(struc
extent_num_blocks >>= inode->i_blkbits;
btrfs_set_file_extent_num_blocks(fi,
extent_num_blocks);
- inode->i_blocks -= (orig_num_blocks -
- extent_num_blocks) << 3;
+ num_dec = (orig_num_blocks -
+ extent_num_blocks) << 3;
+ if (extent_start != 0) {
+ inode->i_blocks -= num_dec;
+ }
btrfs_mark_buffer_dirty(path->nodes[0]);
} else {
- extent_start =
- btrfs_file_extent_disk_blocknr(fi);
extent_num_blocks =
btrfs_file_extent_disk_num_blocks(fi);
/* FIXME blocksize != 4096 */
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic