xfs
[Top] [All Lists]

[PATCH 042/102] xfs: add xlog_grant_head_init

To: xfs@xxxxxxxxxxx
Subject: [PATCH 042/102] xfs: add xlog_grant_head_init
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Thu, 23 Aug 2012 15:02:00 +1000
In-reply-to: <1345698180-13612-1-git-send-email-david@xxxxxxxxxxxxx>
References: <1345698180-13612-1-git-send-email-david@xxxxxxxxxxxxx>
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>

Upstream commit: c303c5b8c3b8eace41c4fba26205b50c0f8e4ca0

Reviewed-by: Mark Tinguely <tinguely@xxxxxxx>
Signed-off-by: Christoph Hellwig <hch@xxxxxx>
Reviewed-by: Dave Chinner <dchinner@xxxxxxxxxx>
Signed-off-by: Ben Myers <bpm@xxxxxxx>
---
 fs/xfs/xfs_log.c |   18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index 5c5aa54..6ef0264 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -150,6 +150,15 @@ xlog_grant_add_space(
        } while (head_val != old);
 }
 
+STATIC void
+xlog_grant_head_init(
+       struct xlog_grant_head  *head)
+{
+       xlog_assign_grant_head(&head->grant, 1, 0);
+       INIT_LIST_HEAD(&head->waiters);
+       spin_lock_init(&head->lock);
+}
+
 STATIC bool
 xlog_reserveq_wake(
        struct log              *log,
@@ -1108,12 +1117,9 @@ xlog_alloc_log(xfs_mount_t       *mp,
        xlog_assign_atomic_lsn(&log->l_tail_lsn, 1, 0);
        xlog_assign_atomic_lsn(&log->l_last_sync_lsn, 1, 0);
        log->l_curr_cycle  = 1;     /* 0 is bad since this is initial value */
-       xlog_assign_grant_head(&log->l_reserve_head.grant, 1, 0);
-       xlog_assign_grant_head(&log->l_write_head.grant, 1, 0);
-       INIT_LIST_HEAD(&log->l_reserve_head.waiters);
-       INIT_LIST_HEAD(&log->l_write_head.waiters);
-       spin_lock_init(&log->l_reserve_head.lock);
-       spin_lock_init(&log->l_write_head.lock);
+
+       xlog_grant_head_init(&log->l_reserve_head);
+       xlog_grant_head_init(&log->l_write_head);
 
        error = EFSCORRUPTED;
        if (xfs_sb_version_hassector(&mp->m_sb)) {
-- 
1.7.10

<Prev in Thread] Current Thread [Next in Thread>