Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 148846
b: refs/heads/master
c: 075fe10
h: refs/heads/master
v: v3
  • Loading branch information
Christoph Hellwig authored and Christoph Hellwig committed Jun 8, 2009
1 parent 35b97c7 commit 98896ba
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 31 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: fe588ed32867b42e0d906db558ca92fd9f8b128e
refs/heads/master: 075fe1028699f6a280545dfc2cfc5ac82d555c8c
4 changes: 3 additions & 1 deletion trunk/fs/xfs/linux-2.6/xfs_quotaops.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,11 @@ xfs_fs_quota_sync(
{
struct xfs_mount *mp = XFS_M(sb);

if (sb->s_flags & MS_RDONLY)
return -EROFS;
if (!XFS_IS_QUOTA_RUNNING(mp))
return -ENOSYS;
return -xfs_sync_inodes(mp, SYNC_DELWRI);
return -xfs_sync_data(mp, 0);
}

STATIC int
Expand Down
13 changes: 12 additions & 1 deletion trunk/fs/xfs/linux-2.6/xfs_super.c
Original file line number Diff line number Diff line change
Expand Up @@ -1071,7 +1071,18 @@ xfs_fs_put_super(
int unmount_event_flags = 0;

xfs_syncd_stop(mp);
xfs_sync_inodes(mp, SYNC_ATTR|SYNC_DELWRI);

if (!(sb->s_flags & MS_RDONLY)) {
/*
* XXX(hch): this should be SYNC_WAIT.
*
* Or more likely not needed at all because the VFS is already
* calling ->sync_fs after shutting down all filestem
* operations and just before calling ->put_super.
*/
xfs_sync_data(mp, 0);
xfs_sync_attr(mp, 0);
}

#ifdef HAVE_DMAPI
if (mp->m_flags & XFS_MOUNT_DMAPI) {
Expand Down
55 changes: 34 additions & 21 deletions trunk/fs/xfs/linux-2.6/xfs_sync.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,29 +268,42 @@ xfs_sync_inode_attr(
return error;
}

/*
* Write out pagecache data for the whole filesystem.
*/
int
xfs_sync_inodes(
xfs_mount_t *mp,
int flags)
xfs_sync_data(
struct xfs_mount *mp,
int flags)
{
int error = 0;
int lflags = XFS_LOG_FORCE;
int error;

if (mp->m_flags & XFS_MOUNT_RDONLY)
return 0;
ASSERT((flags & ~(SYNC_TRYLOCK|SYNC_WAIT|SYNC_IOWAIT)) == 0);

if (flags & SYNC_WAIT)
lflags |= XFS_LOG_SYNC;
error = xfs_inode_ag_iterator(mp, xfs_sync_inode_data, flags,
XFS_ICI_NO_TAG);
if (error)
return XFS_ERROR(error);

if (flags & SYNC_DELWRI)
error = xfs_inode_ag_iterator(mp, xfs_sync_inode_data, flags, XFS_ICI_NO_TAG);
xfs_log_force(mp, 0,
(flags & SYNC_WAIT) ?
XFS_LOG_FORCE | XFS_LOG_SYNC :
XFS_LOG_FORCE);
return 0;
}

if (flags & SYNC_ATTR)
error = xfs_inode_ag_iterator(mp, xfs_sync_inode_attr, flags, XFS_ICI_NO_TAG);
/*
* Write out inode metadata (attributes) for the whole filesystem.
*/
int
xfs_sync_attr(
struct xfs_mount *mp,
int flags)
{
ASSERT((flags & ~SYNC_WAIT) == 0);

if (!error && (flags & SYNC_DELWRI))
xfs_log_force(mp, 0, lflags);
return XFS_ERROR(error);
return xfs_inode_ag_iterator(mp, xfs_sync_inode_attr, flags,
XFS_ICI_NO_TAG);
}

STATIC int
Expand Down Expand Up @@ -404,12 +417,12 @@ xfs_quiesce_data(
int error;

/* push non-blocking */
xfs_sync_inodes(mp, SYNC_DELWRI|SYNC_BDFLUSH);
xfs_sync_data(mp, 0);
xfs_qm_sync(mp, SYNC_BDFLUSH);
xfs_filestream_flush(mp);

/* push and block */
xfs_sync_inodes(mp, SYNC_DELWRI|SYNC_WAIT|SYNC_IOWAIT);
xfs_sync_data(mp, SYNC_WAIT|SYNC_IOWAIT);
xfs_qm_sync(mp, SYNC_WAIT);

/* write superblock and hoover up shutdown errors */
Expand Down Expand Up @@ -438,7 +451,7 @@ xfs_quiesce_fs(
* logged before we can write the unmount record.
*/
do {
xfs_sync_inodes(mp, SYNC_ATTR|SYNC_WAIT);
xfs_sync_attr(mp, SYNC_WAIT);
pincount = xfs_flush_buftarg(mp->m_ddev_targp, 1);
if (!pincount) {
delay(50);
Expand Down Expand Up @@ -521,8 +534,8 @@ xfs_flush_inodes_work(
void *arg)
{
struct inode *inode = arg;
xfs_sync_inodes(mp, SYNC_DELWRI | SYNC_TRYLOCK);
xfs_sync_inodes(mp, SYNC_DELWRI | SYNC_TRYLOCK | SYNC_IOWAIT);
xfs_sync_data(mp, SYNC_TRYLOCK);
xfs_sync_data(mp, SYNC_TRYLOCK | SYNC_IOWAIT);
iput(inode);
}

Expand Down
5 changes: 2 additions & 3 deletions trunk/fs/xfs/linux-2.6/xfs_sync.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ typedef struct xfs_sync_work {
struct completion *w_completion;
} xfs_sync_work_t;

#define SYNC_ATTR 0x0001 /* sync attributes */
#define SYNC_DELWRI 0x0002 /* look at delayed writes */
#define SYNC_WAIT 0x0004 /* wait for i/o to complete */
#define SYNC_BDFLUSH 0x0008 /* BDFLUSH is calling -- don't block */
#define SYNC_IOWAIT 0x0010 /* wait for all I/O to complete */
Expand All @@ -39,7 +37,8 @@ typedef struct xfs_sync_work {
int xfs_syncd_init(struct xfs_mount *mp);
void xfs_syncd_stop(struct xfs_mount *mp);

int xfs_sync_inodes(struct xfs_mount *mp, int flags);
int xfs_sync_attr(struct xfs_mount *mp, int flags);
int xfs_sync_data(struct xfs_mount *mp, int flags);
int xfs_sync_fsdata(struct xfs_mount *mp, int flags);

int xfs_quiesce_data(struct xfs_mount *mp);
Expand Down
6 changes: 2 additions & 4 deletions trunk/fs/xfs/xfs_filestream.c
Original file line number Diff line number Diff line change
Expand Up @@ -542,10 +542,8 @@ xfs_filestream_associate(
* waiting for the lock because someone else is waiting on the lock we
* hold and we cannot drop that as we are in a transaction here.
*
* Lucky for us, this inversion is rarely a problem because it's a
* directory inode that we are trying to lock here and that means the
* only place that matters is xfs_sync_inodes() and SYNC_DELWRI is
* used. i.e. freeze, remount-ro, quotasync or unmount.
* Lucky for us, this inversion is not a problem because it's a
* directory inode that we are trying to lock here.
*
* So, if we can't get the iolock without sleeping then just give up
*/
Expand Down

0 comments on commit 98896ba

Please sign in to comment.