Red Hat Bugzilla – Bug 445649
[PATCH][RHEL5.1] Performance Improvement of fdatasync(2) in case of Overwrite
Last modified: 2009-01-20 15:23:19 EST
Description of problem and Proposal of improvement:
In the kernel implementation of RHEL4 or RHEL5,
Even if fdatasync(2) is used, it always becomes considerable fsync(2).
fdatasync(2) (that contains only the overwrite) becomes high-speed
by not synchronizing the inode in only case of overwrite which the
meta-data doesn't change.
Then, I propose the following patches. The patch can be easily applied
even by RHEL4 and RHEL5. It has already been taken into Vanilla-kernel.
> > --- a/fs/ext3/fsync.c
> > +++ b/fs/ext3/fsync.c
> > @@ -72,6 +72,9 @@ int ext3_sync_file(struct file * file, struct dentry
*dentry, int datasync)
> > goto out;
> > }
> > + if (datasync && !(inode->i_state & I_DIRTY_DATASYNC))
> > + goto out;
> > +
> > /*
> > * The VFS has written the file data. If the inode is unaltered
> > * then we need not start a commit.
For PostgreSQL, the patch has a dramatic effect on to the performance gain.
Because fdatasync(2) is executed the following steps:
1. Enhance the transaction log file (= WAL) by 0 padding.
2. Write the contents of transaction.
3. Synchronize by executing fdatasync(2) per a transaction.
Please take it by the following update! (RHEL5.2 or 5.3, RHEL4.7 or 4.8)
Fixing summary as this is the RHEL5 specific bug.
Created attachment 305962 [details]
Here is the RHEL5 version of this patch.
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release. Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products. This request is not yet committed for inclusion in an Update
You can download this test kernel from http://people.redhat.com/dzickus/el5
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.