diff options
author | Dave Chinner <dchinner@redhat.com> | 2010-12-03 08:02:40 -0500 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2010-12-03 08:02:40 -0500 |
commit | c8a09ff8ca2235bccdaea8a52fbd5349646a8ba4 (patch) | |
tree | a06b4fa59672fd6fa9dd884e1e0bc746adc011b6 | |
parent | 1c3cb9ec07fabf0c0970adc46fd2a1f09c1186dd (diff) |
xfs: convert log grant heads to atomic variables
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>
-rw-r--r-- | fs/xfs/xfs_log.c | 8 | ||||
-rw-r--r-- | fs/xfs/xfs_log_priv.h | 12 |
2 files changed, 10 insertions, 10 deletions
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c index d118bf804480..a1d7d12fc51f 100644 --- a/fs/xfs/xfs_log.c +++ b/fs/xfs/xfs_log.c | |||
@@ -47,7 +47,7 @@ STATIC xlog_t * xlog_alloc_log(xfs_mount_t *mp, | |||
47 | xfs_buftarg_t *log_target, | 47 | xfs_buftarg_t *log_target, |
48 | xfs_daddr_t blk_offset, | 48 | xfs_daddr_t blk_offset, |
49 | int num_bblks); | 49 | int num_bblks); |
50 | STATIC int xlog_space_left(struct log *log, int64_t *head); | 50 | STATIC int xlog_space_left(struct log *log, atomic64_t *head); |
51 | STATIC int xlog_sync(xlog_t *log, xlog_in_core_t *iclog); | 51 | STATIC int xlog_sync(xlog_t *log, xlog_in_core_t *iclog); |
52 | STATIC void xlog_dealloc_log(xlog_t *log); | 52 | STATIC void xlog_dealloc_log(xlog_t *log); |
53 | 53 | ||
@@ -100,7 +100,7 @@ STATIC int xlog_iclogs_empty(xlog_t *log); | |||
100 | static void | 100 | static void |
101 | xlog_grant_sub_space( | 101 | xlog_grant_sub_space( |
102 | struct log *log, | 102 | struct log *log, |
103 | int64_t *head, | 103 | atomic64_t *head, |
104 | int bytes) | 104 | int bytes) |
105 | { | 105 | { |
106 | int cycle, space; | 106 | int cycle, space; |
@@ -119,7 +119,7 @@ xlog_grant_sub_space( | |||
119 | static void | 119 | static void |
120 | xlog_grant_add_space( | 120 | xlog_grant_add_space( |
121 | struct log *log, | 121 | struct log *log, |
122 | int64_t *head, | 122 | atomic64_t *head, |
123 | int bytes) | 123 | int bytes) |
124 | { | 124 | { |
125 | int tmp; | 125 | int tmp; |
@@ -816,7 +816,7 @@ xlog_assign_tail_lsn( | |||
816 | STATIC int | 816 | STATIC int |
817 | xlog_space_left( | 817 | xlog_space_left( |
818 | struct log *log, | 818 | struct log *log, |
819 | int64_t *head) | 819 | atomic64_t *head) |
820 | { | 820 | { |
821 | int free_bytes; | 821 | int free_bytes; |
822 | int tail_bytes; | 822 | int tail_bytes; |
diff --git a/fs/xfs/xfs_log_priv.h b/fs/xfs/xfs_log_priv.h index d34af1c21ed2..7619d6a02388 100644 --- a/fs/xfs/xfs_log_priv.h +++ b/fs/xfs/xfs_log_priv.h | |||
@@ -514,8 +514,8 @@ typedef struct log { | |||
514 | spinlock_t l_grant_lock ____cacheline_aligned_in_smp; | 514 | spinlock_t l_grant_lock ____cacheline_aligned_in_smp; |
515 | struct list_head l_reserveq; | 515 | struct list_head l_reserveq; |
516 | struct list_head l_writeq; | 516 | struct list_head l_writeq; |
517 | int64_t l_grant_reserve_head; | 517 | atomic64_t l_grant_reserve_head; |
518 | int64_t l_grant_write_head; | 518 | atomic64_t l_grant_write_head; |
519 | 519 | ||
520 | /* | 520 | /* |
521 | * l_last_sync_lsn and l_tail_lsn are atomics so they can be set and | 521 | * l_last_sync_lsn and l_tail_lsn are atomics so they can be set and |
@@ -596,18 +596,18 @@ xlog_assign_atomic_lsn(atomic64_t *lsn, uint cycle, uint block) | |||
596 | * will always get consistent component values to work from. | 596 | * will always get consistent component values to work from. |
597 | */ | 597 | */ |
598 | static inline void | 598 | static inline void |
599 | xlog_crack_grant_head(int64_t *head, int *cycle, int *space) | 599 | xlog_crack_grant_head(atomic64_t *head, int *cycle, int *space) |
600 | { | 600 | { |
601 | int64_t val = *head; | 601 | int64_t val = atomic64_read(head); |
602 | 602 | ||
603 | *cycle = val >> 32; | 603 | *cycle = val >> 32; |
604 | *space = val & 0xffffffff; | 604 | *space = val & 0xffffffff; |
605 | } | 605 | } |
606 | 606 | ||
607 | static inline void | 607 | static inline void |
608 | xlog_assign_grant_head(int64_t *head, int cycle, int space) | 608 | xlog_assign_grant_head(atomic64_t *head, int cycle, int space) |
609 | { | 609 | { |
610 | *head = ((int64_t)cycle << 32) | space; | 610 | atomic64_set(head, ((int64_t)cycle << 32) | space); |
611 | } | 611 | } |
612 | 612 | ||
613 | /* | 613 | /* |