https://bugzilla.kernel.org/show_bug.cgi?id=103111 --- Comment #11 from Eric Sandeen <sandeen@xxxxxxxxxx> --- IOWS, it handles these two cases: fd = open("foo.new") write(fd,..) close(fd) rename("foo.new", "foo") // syncs out foo.new if it has delalloc blocks and fd = open("foo", O_TRUNC) write(fd,..) close(fd) // syncs out foo if "foo" had blocks prior to the O_TRUNC truncate Your testcase does this if foo.new doesn't already exist: fd = open("foo.new", O_TRUNC) // if foo.new has no blocks, O_TRUNC does nothing rename("foo.new", "foo") // foo.new has no delalloc blocks, does nothing write(fd) close(fd) If "foo.new" does exist, fd = open("foo.new", O_TRUNC) // if foo.new has blocks, sets da_alloc flag rename("foo.new", "foo") // foo.new has no delalloc blocks, does nothing write(fd) close(fd) // syncs out the data IOWS, if example.txt starts with allocated blocks, this: # rm example.txt1 # echo foobar > example.txt # sync # ./testcase works as you hope, because testcase does: fd = open("example.txt", O_TRUNC) // example.txt has blocks, sets da_alloc flag rename("example.txt", "example.txt1") // "example.txt" no has delalloc blocks nothing happens write(fd) // now we have delalloc blocks close(fd) // syncs out the data So it's not that the heuristic is broken; your testcase just doesn't necessarily meet the conditions of the heuristic. -- You are receiving this mail because: You are watching the assignee of the bug. -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html