From: Roman Zippel Date: Tue, 2 Aug 2005 04:11:40 +0000 (-0700) Subject: [PATCH] hfs: don't dirty unchanged inode X-Git-Tag: v2.6.13-rc5~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f76d28d235cf777dd2e1c1d48c16ee10c1d1587f;p=platform%2Fkernel%2Flinux-exynos.git [PATCH] hfs: don't dirty unchanged inode If inode size hasn't changed, don't do anything further in truncate, which also prevents a dirty inode, what might upset some readonly devices quite badly. Signed-off-by: Roman Zippel Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/hfs/extent.c b/fs/hfs/extent.c index cbc8510..5ea6b3d 100644 --- a/fs/hfs/extent.c +++ b/fs/hfs/extent.c @@ -482,7 +482,8 @@ void hfs_file_truncate(struct inode *inode) page_cache_release(page); mark_inode_dirty(inode); return; - } + } else if (inode->i_size == HFS_I(inode)->phys_size) + return; size = inode->i_size + HFS_SB(sb)->alloc_blksz - 1; blk_cnt = size / HFS_SB(sb)->alloc_blksz; alloc_cnt = HFS_I(inode)->alloc_blocks; diff --git a/fs/hfsplus/extents.c b/fs/hfsplus/extents.c index 376498c..e7235ca 100644 --- a/fs/hfsplus/extents.c +++ b/fs/hfsplus/extents.c @@ -461,7 +461,9 @@ void hfsplus_file_truncate(struct inode *inode) page_cache_release(page); mark_inode_dirty(inode); return; - } + } else if (inode->i_size == HFSPLUS_I(inode).phys_size) + return; + blk_cnt = (inode->i_size + HFSPLUS_SB(sb).alloc_blksz - 1) >> HFSPLUS_SB(sb).alloc_blksz_shift; alloc_cnt = HFSPLUS_I(inode).alloc_blocks; if (blk_cnt == alloc_cnt)