Commit 28496968 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Ben Myers

xfs: add the xlog_grant_head structure

Add a new data structure to allow sharing code between the log grant and
regrant code.
Reviewed-by: default avatarMark Tinguely <tinguely@sgi.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
Signed-off-by: default avatarBen Myers <bpm@sgi.com>
parent 14a7235f
This diff is collapsed.
...@@ -469,6 +469,16 @@ struct xfs_cil { ...@@ -469,6 +469,16 @@ struct xfs_cil {
#define XLOG_CIL_SPACE_LIMIT(log) (log->l_logsize >> 3) #define XLOG_CIL_SPACE_LIMIT(log) (log->l_logsize >> 3)
#define XLOG_CIL_HARD_SPACE_LIMIT(log) (3 * (log->l_logsize >> 4)) #define XLOG_CIL_HARD_SPACE_LIMIT(log) (3 * (log->l_logsize >> 4))
/*
* ticket grant locks, queues and accounting have their own cachlines
* as these are quite hot and can be operated on concurrently.
*/
struct xlog_grant_head {
spinlock_t lock ____cacheline_aligned_in_smp;
struct list_head waiters;
atomic64_t grant;
};
/* /*
* The reservation head lsn is not made up of a cycle number and block number. * The reservation head lsn is not made up of a cycle number and block number.
* Instead, it uses a cycle number and byte number. Logs don't expect to * Instead, it uses a cycle number and byte number. Logs don't expect to
...@@ -520,17 +530,8 @@ typedef struct log { ...@@ -520,17 +530,8 @@ typedef struct log {
/* lsn of 1st LR with unflushed * buffers */ /* lsn of 1st LR with unflushed * buffers */
atomic64_t l_tail_lsn ____cacheline_aligned_in_smp; atomic64_t l_tail_lsn ____cacheline_aligned_in_smp;
/* struct xlog_grant_head l_reserve_head;
* ticket grant locks, queues and accounting have their own cachlines struct xlog_grant_head l_write_head;
* as these are quite hot and can be operated on concurrently.
*/
spinlock_t l_grant_reserve_lock ____cacheline_aligned_in_smp;
struct list_head l_reserveq;
atomic64_t l_grant_reserve_head;
spinlock_t l_grant_write_lock ____cacheline_aligned_in_smp;
struct list_head l_writeq;
atomic64_t l_grant_write_head;
/* The following field are used for debugging; need to hold icloglock */ /* The following field are used for debugging; need to hold icloglock */
#ifdef DEBUG #ifdef DEBUG
......
...@@ -965,9 +965,9 @@ xlog_find_tail( ...@@ -965,9 +965,9 @@ xlog_find_tail(
log->l_curr_cycle++; log->l_curr_cycle++;
atomic64_set(&log->l_tail_lsn, be64_to_cpu(rhead->h_tail_lsn)); atomic64_set(&log->l_tail_lsn, be64_to_cpu(rhead->h_tail_lsn));
atomic64_set(&log->l_last_sync_lsn, be64_to_cpu(rhead->h_lsn)); atomic64_set(&log->l_last_sync_lsn, be64_to_cpu(rhead->h_lsn));
xlog_assign_grant_head(&log->l_grant_reserve_head, log->l_curr_cycle, xlog_assign_grant_head(&log->l_reserve_head.grant, log->l_curr_cycle,
BBTOB(log->l_curr_block)); BBTOB(log->l_curr_block));
xlog_assign_grant_head(&log->l_grant_write_head, log->l_curr_cycle, xlog_assign_grant_head(&log->l_write_head.grant, log->l_curr_cycle,
BBTOB(log->l_curr_block)); BBTOB(log->l_curr_block));
/* /*
......
...@@ -782,12 +782,12 @@ DECLARE_EVENT_CLASS(xfs_loggrant_class, ...@@ -782,12 +782,12 @@ DECLARE_EVENT_CLASS(xfs_loggrant_class,
__entry->curr_res = tic->t_curr_res; __entry->curr_res = tic->t_curr_res;
__entry->unit_res = tic->t_unit_res; __entry->unit_res = tic->t_unit_res;
__entry->flags = tic->t_flags; __entry->flags = tic->t_flags;
__entry->reserveq = list_empty(&log->l_reserveq); __entry->reserveq = list_empty(&log->l_reserve_head.waiters);
__entry->writeq = list_empty(&log->l_writeq); __entry->writeq = list_empty(&log->l_write_head.waiters);
xlog_crack_grant_head(&log->l_grant_reserve_head, xlog_crack_grant_head(&log->l_reserve_head.grant,
&__entry->grant_reserve_cycle, &__entry->grant_reserve_cycle,
&__entry->grant_reserve_bytes); &__entry->grant_reserve_bytes);
xlog_crack_grant_head(&log->l_grant_write_head, xlog_crack_grant_head(&log->l_write_head.grant,
&__entry->grant_write_cycle, &__entry->grant_write_cycle,
&__entry->grant_write_bytes); &__entry->grant_write_bytes);
__entry->curr_cycle = log->l_curr_cycle; __entry->curr_cycle = log->l_curr_cycle;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment