Why reiser does a disk write on every sync() call?
I'm using iostat to measure disk reads/writes associated with various file operations under Reiser. One thing I noticed and can't explain is that every sync() call by itself (not following a write or anything) will cause an I/O write. Any ideas?
Lin
Hello
Quoted 5 lines · Lin Shen (lshen)
I'm using iostat to measure disk reads/writes associated with various file operations under Reiser. One thing I noticed and can't explain is that every
sync()call by itself (not following a write or anything) will cause an I/O write. Any ideas?
The I/O write is performed by reiserfs implementation of sync_fs method of struct super_operations.
If filesystem is mounted r/w - reiserfs_sync_fs begins a transaction (or joins an existing one), journal super block if the transaction has zero length, closes the transaction and flushes old transactions including the one which was just closed. So, if there were no transaction to flush before sync() - one transaction of length 1 gets created, closed, committed and flushed. 5 blocks get written to disk in this case. My calculation can be wrong, though. How much I/O do you notice?
Quoted 3 lines
Lin
I saw 32 blocks by calling sync() alone.
Lin
Quoted 35 lines
-----Original Message-----
From: Vladimir V. Saveliev [mailto:[email protected]]
Sent: Tuesday, March 27, 2007 1:00 AM
To: Lin Shen (lshen)
Cc: [email protected]
Subject: Re: Why reiser does a disk write on everysync()call?Hello
Quoted 1 line · Lin Shen (lshen)
I'm using iostat to measure disk reads/writes associated
with various
Quoted 1 line
file operations under Reiser. One thing I noticed and can't
explain is
Quoted 1 line
that every
sync()call by itself (not following a write oranything)
Quoted 2 lines
will cause an I/O write. Any ideas?
The I/O write is performed by reiserfs implementation of
sync_fsmethod of structsuper_operations.
If filesystem is mounted r/w -reiserfs_sync_fsbegins a transaction (or joins an existing one), journal super block if the transaction has zero length, closes the transaction and flushes old transactions including the one which was just closed. So, if there were no transaction to flush beforesync()- one transaction of length 1 gets created, closed, committed and flushed. 5 blocks get written to disk in this case. My calculation can be wrong, though.
How much I/O do you notice?Quoted 3 lines
Lin
Hello
Quoted 2 lines · Lin Shen (lshen)
I saw 32 blocks by calling
sync()alone.
iostat used to count sectors which are 512 bytes long. Did you take that into account?
Quoted 39 lines
Lin
Quoted 35 lines
-----Original Message-----
From: Vladimir V. Saveliev [mailto:[email protected]]
Sent: Tuesday, March 27, 2007 1:00 AM
To: Lin Shen (lshen)
Cc: [email protected]
Subject: Re: Why reiser does a disk write on everysync()call?Hello
Quoted 1 line · Lin Shen (lshen)
I'm using iostat to measure disk reads/writes associated
with various
Quoted 1 line
file operations under Reiser. One thing I noticed and can't
explain is
Quoted 1 line
that every
sync()call by itself (not following a write oranything)
Quoted 2 lines
will cause an I/O write. Any ideas?
The I/O write is performed by reiserfs implementation of
sync_fsmethod of structsuper_operations.
If filesystem is mounted r/w -reiserfs_sync_fsbegins a transaction (or joins an existing one), journal super block if the transaction has zero length, closes the transaction and flushes old transactions including the one which was just closed. So, if there were no transaction to flush beforesync()- one transaction of length 1 gets created, closed, committed and flushed. 5 blocks get written to disk in this case. My calculation can be wrong, though.
How much I/O do you notice?Quoted 3 lines
Lin
sounds like useless waste of time and space
You haven't stated the reason, why it has to create and commit empty transaction.
Signature · 1 line
GJ
Quoted 3 lines · Grzegorz JaÅ›kiewicz
sounds like useless waste of time and space
You haven't stated the reason, why it has to create and commit empty transaction.
Why'd you call sync()?
--T
Quoted 3 lines
Signature · 2 lines
-- GJ
Hello
Quoted 4 lines · Grzegorz JaÅ›kiewicz
sounds like useless waste of time and space
You haven't stated the reason, why it has to create and commit empty transaction.
I think we should fix that.
Chris, do you think that we could avoid creating fake transactions with the below patch?
fs/reiserfs/super.c renamed from fs/reiserfs/super.c~reiserfs-avoid-syncing-clean-fs +1 -1
@@ -62,7 +62,7 @@ static int reiserfs_statfs(struct dentrystatic int reiserfs_sync_fs (struct super_block *s,int wait) { -if (!(s->s_flags &MS_RDONLY )) { +if (!(s->s_flags &MS_RDONLY ) && s->s_dirt) {struct reiserfs_transaction_handle th;reiserfs_write_lock (s);if (!journal_begin (&th, s,1 ))
_