Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 269918
b: refs/heads/master
c: 1da2f2d
h: refs/heads/master
v: v3
  • Loading branch information
Christoph Hellwig authored and Alex Elder committed Oct 12, 2011
1 parent 095a3e8 commit be23b6d
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 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: 670ce93fef93bba8c8a422a79747385bec8e846a
refs/heads/master: 1da2f2dbf2d2aaa1b0f6ca2f61fcf07e24eb659b
31 changes: 30 additions & 1 deletion trunk/fs/xfs/xfs_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,35 @@ xfs_iozero(
return (-status);
}

/*
* Fsync operations on directories are much simpler than on regular files,
* as there is no file data to flush, and thus also no need for explicit
* cache flush operations, and there are no non-transaction metadata updates
* on directories either.
*/
STATIC int
xfs_dir_fsync(
struct file *file,
loff_t start,
loff_t end,
int datasync)
{
struct xfs_inode *ip = XFS_I(file->f_mapping->host);
struct xfs_mount *mp = ip->i_mount;
xfs_lsn_t lsn = 0;

trace_xfs_dir_fsync(ip);

xfs_ilock(ip, XFS_ILOCK_SHARED);
if (xfs_ipincount(ip))
lsn = ip->i_itemp->ili_last_lsn;
xfs_iunlock(ip, XFS_ILOCK_SHARED);

if (!lsn)
return 0;
return _xfs_log_force_lsn(mp, lsn, XFS_LOG_SYNC, NULL);
}

STATIC int
xfs_file_fsync(
struct file *file,
Expand Down Expand Up @@ -1140,7 +1169,7 @@ const struct file_operations xfs_dir_file_operations = {
#ifdef CONFIG_COMPAT
.compat_ioctl = xfs_file_compat_ioctl,
#endif
.fsync = xfs_file_fsync,
.fsync = xfs_dir_fsync,
};

static const struct vm_operations_struct xfs_file_vm_ops = {
Expand Down
1 change: 1 addition & 0 deletions trunk/fs/xfs/xfs_trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,7 @@ DEFINE_INODE_EVENT(xfs_vm_bmap);
DEFINE_INODE_EVENT(xfs_file_ioctl);
DEFINE_INODE_EVENT(xfs_file_compat_ioctl);
DEFINE_INODE_EVENT(xfs_ioctl_setattr);
DEFINE_INODE_EVENT(xfs_dir_fsync);
DEFINE_INODE_EVENT(xfs_file_fsync);
DEFINE_INODE_EVENT(xfs_destroy_inode);
DEFINE_INODE_EVENT(xfs_write_inode);
Expand Down

0 comments on commit be23b6d

Please sign in to comment.