Commit a69ed03c authored by Dave Chinner's avatar Dave Chinner Committed by Dave Chinner

xfs: combine grant heads into a single 64 bit integer

Prepare for switching the grant heads to atomic variables by
combining the two 32 bit values that make up the grant head into a
single 64 bit variable.  Provide wrapper functions to combine and
split the grant heads appropriately for calculations and use them as
necessary.
Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
parent 663e496a
...@@ -786,10 +786,12 @@ DECLARE_EVENT_CLASS(xfs_loggrant_class, ...@@ -786,10 +786,12 @@ DECLARE_EVENT_CLASS(xfs_loggrant_class,
__entry->flags = tic->t_flags; __entry->flags = tic->t_flags;
__entry->reserveq = list_empty(&log->l_reserveq); __entry->reserveq = list_empty(&log->l_reserveq);
__entry->writeq = list_empty(&log->l_writeq); __entry->writeq = list_empty(&log->l_writeq);
__entry->grant_reserve_cycle = log->l_grant_reserve_cycle; xlog_crack_grant_head(&log->l_grant_reserve_head,
__entry->grant_reserve_bytes = log->l_grant_reserve_bytes; &__entry->grant_reserve_cycle,
__entry->grant_write_cycle = log->l_grant_write_cycle; &__entry->grant_reserve_bytes);
__entry->grant_write_bytes = log->l_grant_write_bytes; xlog_crack_grant_head(&log->l_grant_write_head,
&__entry->grant_write_cycle,
&__entry->grant_write_bytes);
__entry->curr_cycle = log->l_curr_cycle; __entry->curr_cycle = log->l_curr_cycle;
__entry->curr_block = log->l_curr_block; __entry->curr_block = log->l_curr_block;
__entry->tail_lsn = log->l_tail_lsn; __entry->tail_lsn = log->l_tail_lsn;
......
This diff is collapsed.
...@@ -518,10 +518,8 @@ typedef struct log { ...@@ -518,10 +518,8 @@ typedef struct log {
spinlock_t l_grant_lock ____cacheline_aligned_in_smp; spinlock_t l_grant_lock ____cacheline_aligned_in_smp;
struct list_head l_reserveq; struct list_head l_reserveq;
struct list_head l_writeq; struct list_head l_writeq;
int l_grant_reserve_cycle; int64_t l_grant_reserve_head;
int l_grant_reserve_bytes; int64_t l_grant_write_head;
int l_grant_write_cycle;
int l_grant_write_bytes;
/* 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
...@@ -560,6 +558,26 @@ int xlog_write(struct log *log, struct xfs_log_vec *log_vector, ...@@ -560,6 +558,26 @@ int xlog_write(struct log *log, struct xfs_log_vec *log_vector,
struct xlog_ticket *tic, xfs_lsn_t *start_lsn, struct xlog_ticket *tic, xfs_lsn_t *start_lsn,
xlog_in_core_t **commit_iclog, uint flags); xlog_in_core_t **commit_iclog, uint flags);
/*
* When we crack the grrant head, we sample it first so that the value will not
* change while we are cracking it into the component values. This means we
* will always get consistent component values to work from.
*/
static inline void
xlog_crack_grant_head(int64_t *head, int *cycle, int *space)
{
int64_t val = *head;
*cycle = val >> 32;
*space = val & 0xffffffff;
}
static inline void
xlog_assign_grant_head(int64_t *head, int cycle, int space)
{
*head = ((int64_t)cycle << 32) | space;
}
/* /*
* Committed Item List interfaces * Committed Item List interfaces
*/ */
......
...@@ -938,10 +938,10 @@ xlog_find_tail( ...@@ -938,10 +938,10 @@ xlog_find_tail(
log->l_curr_cycle++; log->l_curr_cycle++;
log->l_tail_lsn = be64_to_cpu(rhead->h_tail_lsn); log->l_tail_lsn = be64_to_cpu(rhead->h_tail_lsn);
log->l_last_sync_lsn = be64_to_cpu(rhead->h_lsn); log->l_last_sync_lsn = be64_to_cpu(rhead->h_lsn);
log->l_grant_reserve_cycle = log->l_curr_cycle; xlog_assign_grant_head(&log->l_grant_reserve_head, log->l_curr_cycle,
log->l_grant_reserve_bytes = BBTOB(log->l_curr_block); BBTOB(log->l_curr_block));
log->l_grant_write_cycle = log->l_curr_cycle; xlog_assign_grant_head(&log->l_grant_write_head, log->l_curr_cycle,
log->l_grant_write_bytes = BBTOB(log->l_curr_block); BBTOB(log->l_curr_block));
/* /*
* Look for unmount record. If we find it, then we know there * Look for unmount record. If we find it, then we know there
......
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