login
Header Space

 
 

Correct behavior on O_DIRECT sparse file writes

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <linux-fsdevel@...>, Andrew Morton <akpm@...>
Date: Friday, October 12, 2007 - 4:39 pm

Hello everyone,

The test below creates a sparse file and then fills a hole with
O_DIRECT.  As far as I can tell from reading generic_osync_inode, the
filesystem metadata is only forced to disk if i_size changes during the
file write.  I've tested ext3, xfs and reiserfs and they all skip the
commit when filling holes.

I would argue that filling holes via O_DIRECT is supposed to commit the
metadata required to find those file blocks later.  At least on ext3,
O_SYNC does force a commit on fill holes  (haven't tested others).

So, is the current behavior a bug or a feature?

dd if=/dev/zero of=foo bs=1M seek=1 count=1 oflag=direct

hexdump foo | head -n 2
0000000 62b1 ea2d 73e8 c64f f5ef 1af5 dd09 8ccd
0000010 75ec 9581 e0ea ae9b e28f b76d a700 4d5b

dd if=/dev/urandom of=foo bs=4k count=1 conv=notrunc oflag=direct
reboot -nf

(after reboot)

hexdump foo
0000000 0000 0000 0000 0000 0000 0000 0000 0000
*
0200000

-chris


-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Correct behavior on O_DIRECT sparse file writes, Chris Mason, (Fri Oct 12, 4:39 pm)
Re: Correct behavior on O_DIRECT sparse file writes, Andrew Morton, (Fri Oct 12, 5:02 pm)
Re: Correct behavior on O_DIRECT sparse file writes, Bryan Henderson, (Mon Oct 15, 12:53 pm)
Re: Correct behavior on O_DIRECT sparse file writes, Florian Weimer, (Sat Oct 13, 7:24 am)
Re: Correct behavior on O_DIRECT sparse file writes, Chuck Lever, (Mon Oct 15, 11:36 am)
speck-geostationary