sync on pages containing EOF

sync on pages containing EOF

Post by Rajagopal Ananthanarayana » Thu, 22 Feb 2001 04:54:01

I was looking at some code to deal with sync (eg. sys_fsync(fd)).
Generally, sync is performed by calling filemap_fdatasync(...)
which does writepage() on pages in the dirty list of the inode,
and then using filemap_fdatawait to wait on the I/O's started by
the writepage's.

Consider writepage() on a (partial) page containing EOF. In this case,
prepare_write/commit_write is employed to write the page out.
However, commit_write will only mark the buffer dirty, and
not actually start the I/O. Subsequently, either memory pressure
(page_launder) or write pressure (flush_dirty_buffers) will
start the I/O on the EOF-page. So, it appears that filemap_fdatawait
will be delayed.

I'm just wondering if this argument is correct ...

Rajagopal Ananthanarayanan ("ananth")
Member Technical Staff, SGI.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at
Please read the FAQ at


1. "sync;sync" vs. "sync /important_only &"

As I understand it, under Linux, disk write requests are buffered and
are actually written to disk later. This is more familiarly known to me
as "write-behind cacheing". This is a useful and necessary feature, but
here's my caveat --
Among other tasks running (that require heavy disk writing), I'm typing
an important document, so I hit "save" frequently. Lightning knocks out
my power, and guess what? Due to the 512megs of RAM in my system, all
that I typed never even touched the disk. (I don't really have that much
ram -- but just to make the point)

Hardly a surprise; should have "sync"ed my disks more often. Before you
tell me to do that, I'd like to know if theres a way I can DISABLE the
write-behind cacheing for a PARTICULAR directory: for example, I may
want "/important_only" to never be write-buffered. So if I'm working on
my document and save to /important_only, it should save immediately to
the disk.

In this way, I'd rest assured knowing that certain things (like the
document i'm typing for a class thats due the next day) isn't wiped in a
power-outtage, while other less important things that have heavy disk
writes and thus make "sync"ing impractical (such as a cpu event logger
with "verbose" mode enabled) can be trashed in the outtage without much

It this possible? If not to a different directory on the same drive, how
about to a different drive or filesystem?

Thanks for any help on the topic. Understand that I'm accustomed to a
DOS+windows environ where write-buffers are usually written to disk
within seconds.

2. Adaptec 2930LP v RH 7.3

3. NFS Stale file handler for: cat <<EOF foo EOF ?

4. T/TCP support??????

5. PHP4 pages containing html displaying blank

6. Internet connection sharing

7. Netscape crashes under linux when loading a web page containing Java applet

8. pppd 2.2.0 and kernel 1.2.13

9. Konqueror - Text on pages contains garbage

10. Netscape kills itself when loading Web pages containing Java

11. 4.3.3: Which package contains man pages?

12. Which RH7 RPMs contain the system info and man pages?

13. Quote Text of page containing "mailto:"