Bug 445649

Summary: [PATCH][RHEL5.1] Performance Improvement of fdatasync(2) in case of Overwrite
Product: Red Hat Enterprise Linux 5 Reporter: Masaki MAENO <maeno.masaki>
Component: kernelAssignee: Josef Bacik <jbacik>
Status: CLOSED ERRATA QA Contact: Martin Jenner <mjenner>
Severity: medium Docs Contact:
Priority: low    
Version: 5.1CC: dzickus, esandeen
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
URL: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=3d61f75eefedf75914ab4453c67aaa2ee64bcf93;hp=8b91582500ae750db22bd515379616e5e9ad06ab
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-01-20 20:23:19 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
proposed patch none

Description Masaki MAENO 2008-05-08 10:02:46 UTC
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.
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=3d61f75eefedf75914ab4453c67aaa2ee64bcf93;hp=8b91582500ae750db22bd515379616e5e9ad06ab
> > --- 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 15:34:08 UTC
Fixing summary as this is the RHEL5 specific bug.

Comment 2 Josef Bacik 2008-05-19 15:35:06 UTC
Created attachment 305962 [details]
proposed patch

Here is the RHEL5 version of this patch.

Comment 4 RHEL Program Management 2008-06-06 15:44:45 UTC
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
release.

Comment 5 Don Zickus 2008-07-23 18:55:39 UTC
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 20:23:19 UTC
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.

http://rhn.redhat.com/errata/RHSA-2009-0225.html