Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f76d28d2 authored by Roman Zippel's avatar Roman Zippel Committed by Linus Torvalds
Browse files

[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: default avatarRoman Zippel <zippel@linux-m68k.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 0072b138
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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;
+3 −1
Original line number Diff line number Diff line
@@ -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)