浏览代码

__ufs_truncate_blocks(): avoid excessive dirtying of indirect blocks

There's a case when an indirect block gets dirtied for no good
reason - when there's a hole starting in the middle of area
covered by it and spanning past its end, and truncate() is done
precisely to the beginning of the hole.

The block is obviously not modified at all - all removals happen
beyond it.  However, existing code ends up dirtying it just in
case.  It's trivial to fix and while it's not a real bug by any
stretch of imagination, it makes the damn thing harder to follow.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Al Viro 10 年之前
父节点
当前提交
f53bd1421b
共有 1 个文件被更改,包括 1 次插入3 次删除
  1. 1 3
      fs/ufs/inode.c

+ 1 - 3
fs/ufs/inode.c

@@ -1251,10 +1251,8 @@ static void __ufs_truncate_blocks(struct inode *inode)
 			}
 			}
 			p = ubh_get_data_ptr(uspi, ubh[i], offsets[i + 1]);
 			p = ubh_get_data_ptr(uspi, ubh[i], offsets[i + 1]);
 		}
 		}
-		while (i--) {
-			ubh_mark_buffer_dirty(ubh[i]);
+		while (i--)
 			free_branch_tail(inode, offsets[i + 1], ubh[i], depth - i - 1);
 			free_branch_tail(inode, offsets[i + 1], ubh[i], depth - i - 1);
-		}
 	}
 	}
 	for (i = offsets[0]; i <= UFS_TIND_BLOCK; i++) {
 	for (i = offsets[0]; i <= UFS_TIND_BLOCK; i++) {
 		p = ufs_get_direct_data_ptr(uspi, ufsi, i);
 		p = ufs_get_direct_data_ptr(uspi, ufsi, i);