Skip to content

Commit

Permalink
xfs: convert log grant heads to atomic variables
Browse files Browse the repository at this point in the history
Convert the log grant heads to atomic64_t types in preparation for
converting the accounting algorithms to atomic operations. his patch
just converts the variables; the algorithmic changes are in a
separate patch for clarity.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
  • Loading branch information
Dave Chinner authored and Dave Chinner committed Dec 3, 2010
1 parent 1c3cb9e commit c8a09ff
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions fs/xfs/xfs_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ STATIC xlog_t * xlog_alloc_log(xfs_mount_t *mp,
xfs_buftarg_t *log_target,
xfs_daddr_t blk_offset,
int num_bblks);
STATIC int xlog_space_left(struct log *log, int64_t *head);
STATIC int xlog_space_left(struct log *log, atomic64_t *head);
STATIC int xlog_sync(xlog_t *log, xlog_in_core_t *iclog);
STATIC void xlog_dealloc_log(xlog_t *log);

Expand Down Expand Up @@ -100,7 +100,7 @@ STATIC int xlog_iclogs_empty(xlog_t *log);
static void
xlog_grant_sub_space(
struct log *log,
int64_t *head,
atomic64_t *head,
int bytes)
{
int cycle, space;
Expand All @@ -119,7 +119,7 @@ xlog_grant_sub_space(
static void
xlog_grant_add_space(
struct log *log,
int64_t *head,
atomic64_t *head,
int bytes)
{
int tmp;
Expand Down Expand Up @@ -816,7 +816,7 @@ xlog_assign_tail_lsn(
STATIC int
xlog_space_left(
struct log *log,
int64_t *head)
atomic64_t *head)
{
int free_bytes;
int tail_bytes;
Expand Down
12 changes: 6 additions & 6 deletions fs/xfs/xfs_log_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -514,8 +514,8 @@ typedef struct log {
spinlock_t l_grant_lock ____cacheline_aligned_in_smp;
struct list_head l_reserveq;
struct list_head l_writeq;
int64_t l_grant_reserve_head;
int64_t l_grant_write_head;
atomic64_t l_grant_reserve_head;
atomic64_t l_grant_write_head;

/*
* l_last_sync_lsn and l_tail_lsn are atomics so they can be set and
Expand Down Expand Up @@ -596,18 +596,18 @@ xlog_assign_atomic_lsn(atomic64_t *lsn, uint cycle, uint block)
* will always get consistent component values to work from.
*/
static inline void
xlog_crack_grant_head(int64_t *head, int *cycle, int *space)
xlog_crack_grant_head(atomic64_t *head, int *cycle, int *space)
{
int64_t val = *head;
int64_t val = atomic64_read(head);

*cycle = val >> 32;
*space = val & 0xffffffff;
}

static inline void
xlog_assign_grant_head(int64_t *head, int cycle, int space)
xlog_assign_grant_head(atomic64_t *head, int cycle, int space)
{
*head = ((int64_t)cycle << 32) | space;
atomic64_set(head, ((int64_t)cycle << 32) | space);
}

/*
Expand Down

0 comments on commit c8a09ff

Please sign in to comment.