Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 43314
b: refs/heads/master
c: 33c3de3
h: refs/heads/master
v: v3
  • Loading branch information
Steven Whitehouse committed Nov 30, 2006
1 parent ae18686 commit e889607
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: aac1a3c77a46c2d06f297641760dd740ac2a84af
refs/heads/master: 33c3de32872ef3c075e4dac04c0de8f86ac39f6f
30 changes: 27 additions & 3 deletions trunk/fs/gfs2/ops_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <linux/ext2_fs.h>
#include <linux/crc32.h>
#include <linux/lm_interface.h>
#include <linux/writeback.h>
#include <asm/uaccess.h>

#include "gfs2.h"
Expand Down Expand Up @@ -503,16 +504,39 @@ static int gfs2_close(struct inode *inode, struct file *file)
* @file: the file that points to the dentry (we ignore this)
* @dentry: the dentry that points to the inode to sync
*
* The VFS will flush "normal" data for us. We only need to worry
* about metadata here. For journaled data, we just do a log flush
* as we can't avoid it. Otherwise we can just bale out if datasync
* is set. For stuffed inodes we must flush the log in order to
* ensure that all data is on disk.
*
* Returns: errno
*/

static int gfs2_fsync(struct file *file, struct dentry *dentry, int datasync)
{
struct gfs2_inode *ip = GFS2_I(dentry->d_inode);
struct inode *inode = dentry->d_inode;
int sync_state = inode->i_state & (I_DIRTY_SYNC|I_DIRTY_DATASYNC);
int ret = 0;
struct writeback_control wbc = {
.sync_mode = WB_SYNC_ALL,
.nr_to_write = 0,
};

if (gfs2_is_jdata(GFS2_I(inode))) {
gfs2_log_flush(GFS2_SB(inode), GFS2_I(inode)->i_gl);
return 0;
}

gfs2_log_flush(ip->i_gl->gl_sbd, ip->i_gl);
if (sync_state != 0) {
if (!datasync)
ret = sync_inode(inode, &wbc);

return 0;
if (gfs2_is_stuffed(GFS2_I(inode)))
gfs2_log_flush(GFS2_SB(inode), GFS2_I(inode)->i_gl);
}

return ret;
}

/**
Expand Down

0 comments on commit e889607

Please sign in to comment.