Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 339379
b: refs/heads/master
c: c7eea6f
h: refs/heads/master
i:
  339377: 6a7e47a
  339375: ec94712
v: v3
  • Loading branch information
Dave Chinner authored and Ben Myers committed Oct 17, 2012
1 parent 97c3cb8 commit 43de1d3
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 69 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: 34061f5c420561dd42addd252811a1fa4b0ac69b
refs/heads/master: c7eea6f7adca4501d2c2db7f0f7c9dc88efac95e
67 changes: 67 additions & 0 deletions trunk/fs/xfs/xfs_super.c
Original file line number Diff line number Diff line change
Expand Up @@ -1148,6 +1148,73 @@ xfs_restore_resvblks(struct xfs_mount *mp)
xfs_reserve_blocks(mp, &resblks, NULL);
}

/*
* Trigger writeback of all the dirty metadata in the file system.
*
* This ensures that the metadata is written to their location on disk rather
* than just existing in transactions in the log. This means after a quiesce
* there is no log replay required to write the inodes to disk (this is the main
* difference between a sync and a quiesce).
*
* This shoul deffectively mimic the code in xfs_unmountfs() and
* xfs_log_umount() but without tearing down any structures.
* XXX: bug fixes needed!
*
* Note: this stops background log work - the callers must ensure it is started
* again when appropriate.
*/
void
xfs_quiesce_attr(
struct xfs_mount *mp)
{
int error = 0;

/* wait for all modifications to complete */
while (atomic_read(&mp->m_active_trans) > 0)
delay(100);

/* force the log to unpin objects from the now complete transactions */
xfs_log_force(mp, XFS_LOG_SYNC);

/* reclaim inodes to do any IO before the freeze completes */
xfs_reclaim_inodes(mp, 0);
xfs_reclaim_inodes(mp, SYNC_WAIT);

/* flush all pending changes from the AIL */
xfs_ail_push_all_sync(mp->m_ail);

/* stop background log work */
cancel_delayed_work_sync(&mp->m_log->l_work);

/*
* Just warn here till VFS can correctly support
* read-only remount without racing.
*/
WARN_ON(atomic_read(&mp->m_active_trans) != 0);

/* Push the superblock and write an unmount record */
error = xfs_log_sbcount(mp);
if (error)
xfs_warn(mp, "xfs_attr_quiesce: failed to log sb changes. "
"Frozen image may not be consistent.");
xfs_log_unmount_write(mp);

/*
* At this point we might have modified the superblock again and thus
* added an item to the AIL, thus flush it again.
*/
xfs_ail_push_all_sync(mp->m_ail);

/*
* The superblock buffer is uncached and xfsaild_push() will lock and
* set the XBF_ASYNC flag on the buffer. We cannot do xfs_buf_iowait()
* here but a lock on the superblock buffer will block until iodone()
* has completed.
*/
xfs_buf_lock(mp->m_sb_bp);
xfs_buf_unlock(mp->m_sb_bp);
}

STATIC int
xfs_fs_remount(
struct super_block *sb,
Expand Down
65 changes: 0 additions & 65 deletions trunk/fs/xfs/xfs_sync.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,71 +214,6 @@ xfs_inode_ag_iterator(
return XFS_ERROR(last_error);
}

/*
* Second stage of a quiesce. The data is already synced, now we have to take
* care of the metadata. New transactions are already blocked, so we need to
* wait for any remaining transactions to drain out before proceeding.
*
* The second phase ensures that the inodes are written to their
* location on disk rather than just existing in transactions in the log. This
* means after a quiesce there is no log replay required to write the inodes to
* disk (this is the main difference between a sync and a quiesce).
*
* Note: this stops background sync work - the callers must ensure it is started
* again when appropriate.
*/
void
xfs_quiesce_attr(
struct xfs_mount *mp)
{
int error = 0;

/* wait for all modifications to complete */
while (atomic_read(&mp->m_active_trans) > 0)
delay(100);

/* force the log to unpin objects from the now complete transactions */
xfs_log_force(mp, XFS_LOG_SYNC);

/* reclaim inodes to do any IO before the freeze completes */
xfs_reclaim_inodes(mp, 0);
xfs_reclaim_inodes(mp, SYNC_WAIT);

/* flush all pending changes from the AIL */
xfs_ail_push_all_sync(mp->m_ail);

/* stop background log work */
cancel_delayed_work_sync(&mp->m_log->l_work);

/*
* Just warn here till VFS can correctly support
* read-only remount without racing.
*/
WARN_ON(atomic_read(&mp->m_active_trans) != 0);

/* Push the superblock and write an unmount record */
error = xfs_log_sbcount(mp);
if (error)
xfs_warn(mp, "xfs_attr_quiesce: failed to log sb changes. "
"Frozen image may not be consistent.");
xfs_log_unmount_write(mp);

/*
* At this point we might have modified the superblock again and thus
* added an item to the AIL, thus flush it again.
*/
xfs_ail_push_all_sync(mp->m_ail);

/*
* The superblock buffer is uncached and xfsaild_push() will lock and
* set the XBF_ASYNC flag on the buffer. We cannot do xfs_buf_iowait()
* here but a lock on the superblock buffer will block until iodone()
* has completed.
*/
xfs_buf_lock(mp->m_sb_bp);
xfs_buf_unlock(mp->m_sb_bp);
}

/*
* Queue a new inode reclaim pass if there are reclaimable inodes and there
* isn't a reclaim pass already in progress. By default it runs every 5s based
Expand Down
3 changes: 0 additions & 3 deletions trunk/fs/xfs/xfs_sync.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ struct xfs_perag;

void xfs_reclaim_worker(struct work_struct *work);

int xfs_quiesce_data(struct xfs_mount *mp);
void xfs_quiesce_attr(struct xfs_mount *mp);

int xfs_reclaim_inodes(struct xfs_mount *mp, int mode);
int xfs_reclaim_inodes_count(struct xfs_mount *mp);
void xfs_reclaim_inodes_nr(struct xfs_mount *mp, int nr_to_scan);
Expand Down

0 comments on commit 43de1d3

Please sign in to comment.