Bug 445649 - [PATCH][RHEL5.1] Performance Improvement of fdatasync(2) in case of Overwrite
[PATCH][RHEL5.1] Performance Improvement of fdatasync(2) in case of Overwrite
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: kernel (Show other bugs)
All Linux
low Severity medium
: rc
: ---
Assigned To: Josef Bacik
Martin Jenner
Depends On:
  Show dependency treegraph
Reported: 2008-05-08 06:02 EDT by Masaki MAENO
Modified: 2009-01-20 15:23 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2009-01-20 15:23:19 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
proposed patch (416 bytes, patch)
2008-05-19 11:35 EDT, Josef Bacik
no flags Details | Diff

  None (edit)
Description Masaki MAENO 2008-05-08 06:02:46 EDT
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.

Additional info:

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)
Comment 1 Josef Bacik 2008-05-19 11:34:08 EDT
Fixing summary as this is the RHEL5 specific bug.
Comment 2 Josef Bacik 2008-05-19 11:35:06 EDT
Created attachment 305962 [details]
proposed patch

Here is the RHEL5 version of this patch.
Comment 4 RHEL Product and Program Management 2008-06-06 11:44:45 EDT
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
Comment 5 Don Zickus 2008-07-23 14:55:39 EDT
in kernel-2.6.18-99.el5
You can download this test kernel from http://people.redhat.com/dzickus/el5
Comment 10 errata-xmlrpc 2009-01-20 15:23:19 EST
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.


Note You need to log in before you can comment on or make changes to this bug.