Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 84487
b: refs/heads/master
c: 249a8c1
h: refs/heads/master
i:
  84485: 74f4eda
  84483: 9468d4c
  84479: e30caf1
v: v3
  • Loading branch information
David Chinner authored and Lachlan McIlroy committed Feb 7, 2008
1 parent 81c8c73 commit 17c3bb6
Show file tree
Hide file tree
Showing 8 changed files with 283 additions and 109 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: 4576758db5817a91b8974c696247d459dc653db2
refs/heads/master: 249a8c1124653fa90f3a3afff869095a31bc229f
59 changes: 59 additions & 0 deletions trunk/fs/xfs/linux-2.6/xfs_super.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
#include "xfs_vfsops.h"
#include "xfs_version.h"
#include "xfs_log_priv.h"
#include "xfs_trans_priv.h"

#include <linux/namei.h>
#include <linux/init.h>
Expand Down Expand Up @@ -765,6 +766,64 @@ xfs_blkdev_issue_flush(
blkdev_issue_flush(buftarg->bt_bdev, NULL);
}

/*
* XFS AIL push thread support
*/
void
xfsaild_wakeup(
xfs_mount_t *mp,
xfs_lsn_t threshold_lsn)
{
mp->m_ail.xa_target = threshold_lsn;
wake_up_process(mp->m_ail.xa_task);
}

int
xfsaild(
void *data)
{
xfs_mount_t *mp = (xfs_mount_t *)data;
xfs_lsn_t last_pushed_lsn = 0;
long tout = 0;

while (!kthread_should_stop()) {
if (tout)
schedule_timeout_interruptible(msecs_to_jiffies(tout));
tout = 1000;

/* swsusp */
try_to_freeze();

ASSERT(mp->m_log);
if (XFS_FORCED_SHUTDOWN(mp))
continue;

tout = xfsaild_push(mp, &last_pushed_lsn);
}

return 0;
} /* xfsaild */

int
xfsaild_start(
xfs_mount_t *mp)
{
mp->m_ail.xa_target = 0;
mp->m_ail.xa_task = kthread_run(xfsaild, mp, "xfsaild");
if (IS_ERR(mp->m_ail.xa_task))
return -PTR_ERR(mp->m_ail.xa_task);
return 0;
}

void
xfsaild_stop(
xfs_mount_t *mp)
{
kthread_stop(mp->m_ail.xa_task);
}



STATIC struct inode *
xfs_fs_alloc_inode(
struct super_block *sb)
Expand Down
33 changes: 26 additions & 7 deletions trunk/fs/xfs/xfs_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -498,11 +498,14 @@ xfs_log_reserve(xfs_mount_t *mp,
* Return error or zero.
*/
int
xfs_log_mount(xfs_mount_t *mp,
xfs_buftarg_t *log_target,
xfs_daddr_t blk_offset,
int num_bblks)
xfs_log_mount(
xfs_mount_t *mp,
xfs_buftarg_t *log_target,
xfs_daddr_t blk_offset,
int num_bblks)
{
int error;

if (!(mp->m_flags & XFS_MOUNT_NORECOVERY))
cmn_err(CE_NOTE, "XFS mounting filesystem %s", mp->m_fsname);
else {
Expand All @@ -514,12 +517,22 @@ xfs_log_mount(xfs_mount_t *mp,

mp->m_log = xlog_alloc_log(mp, log_target, blk_offset, num_bblks);

/*
* Initialize the AIL now we have a log.
*/
spin_lock_init(&mp->m_ail_lock);
error = xfs_trans_ail_init(mp);
if (error) {
cmn_err(CE_WARN, "XFS: AIL initialisation failed: error %d", error);
goto error;
}

/*
* skip log recovery on a norecovery mount. pretend it all
* just worked.
*/
if (!(mp->m_flags & XFS_MOUNT_NORECOVERY)) {
int error, readonly = (mp->m_flags & XFS_MOUNT_RDONLY);
int readonly = (mp->m_flags & XFS_MOUNT_RDONLY);

if (readonly)
mp->m_flags &= ~XFS_MOUNT_RDONLY;
Expand All @@ -530,8 +543,7 @@ xfs_log_mount(xfs_mount_t *mp,
mp->m_flags |= XFS_MOUNT_RDONLY;
if (error) {
cmn_err(CE_WARN, "XFS: log mount/recovery failed: error %d", error);
xlog_dealloc_log(mp->m_log);
return error;
goto error;
}
}

Expand All @@ -540,6 +552,9 @@ xfs_log_mount(xfs_mount_t *mp,

/* End mounting message in xfs_log_mount_finish */
return 0;
error:
xfs_log_unmount_dealloc(mp);
return error;
} /* xfs_log_mount */

/*
Expand Down Expand Up @@ -722,10 +737,14 @@ xfs_log_unmount_write(xfs_mount_t *mp)

/*
* Deallocate log structures for unmount/relocation.
*
* We need to stop the aild from running before we destroy
* and deallocate the log as the aild references the log.
*/
void
xfs_log_unmount_dealloc(xfs_mount_t *mp)
{
xfs_trans_ail_destroy(mp);
xlog_dealloc_log(mp->m_log);
}

Expand Down
6 changes: 0 additions & 6 deletions trunk/fs/xfs/xfs_mount.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,9 @@ xfs_mount_init(void)
mp->m_flags |= XFS_MOUNT_NO_PERCPU_SB;
}

spin_lock_init(&mp->m_ail_lock);
spin_lock_init(&mp->m_sb_lock);
mutex_init(&mp->m_ilock);
mutex_init(&mp->m_growlock);
/*
* Initialize the AIL.
*/
xfs_trans_ail_init(mp);

atomic_set(&mp->m_active_trans, 0);

return mp;
Expand Down
10 changes: 8 additions & 2 deletions trunk/fs/xfs/xfs_mount.h
Original file line number Diff line number Diff line change
Expand Up @@ -219,12 +219,18 @@ extern void xfs_icsb_sync_counters_flags(struct xfs_mount *, int);
#define xfs_icsb_sync_counters_flags(mp, flags) do { } while (0)
#endif

typedef struct xfs_ail {
xfs_ail_entry_t xa_ail;
uint xa_gen;
struct task_struct *xa_task;
xfs_lsn_t xa_target;
} xfs_ail_t;

typedef struct xfs_mount {
struct super_block *m_super;
xfs_tid_t m_tid; /* next unused tid for fs */
spinlock_t m_ail_lock; /* fs AIL mutex */
xfs_ail_entry_t m_ail; /* fs active log item list */
uint m_ail_gen; /* fs AIL generation count */
xfs_ail_t m_ail; /* fs active log item list */
xfs_sb_t m_sb; /* copy of fs superblock */
spinlock_t m_sb_lock; /* sb counter lock */
struct xfs_buf *m_sb_bp; /* buffer for superblock */
Expand Down
5 changes: 3 additions & 2 deletions trunk/fs/xfs/xfs_trans.h
Original file line number Diff line number Diff line change
Expand Up @@ -992,8 +992,9 @@ int _xfs_trans_commit(xfs_trans_t *,
int *);
#define xfs_trans_commit(tp, flags) _xfs_trans_commit(tp, flags, NULL)
void xfs_trans_cancel(xfs_trans_t *, int);
void xfs_trans_ail_init(struct xfs_mount *);
xfs_lsn_t xfs_trans_push_ail(struct xfs_mount *, xfs_lsn_t);
int xfs_trans_ail_init(struct xfs_mount *);
void xfs_trans_ail_destroy(struct xfs_mount *);
void xfs_trans_push_ail(struct xfs_mount *, xfs_lsn_t);
xfs_lsn_t xfs_trans_tail_ail(struct xfs_mount *);
void xfs_trans_unlocked_item(struct xfs_mount *,
xfs_log_item_t *);
Expand Down
Loading

0 comments on commit 17c3bb6

Please sign in to comment.