diff options
author | Alex Elder <elder@dreamhost.com> | 2012-01-24 01:49:27 +0400 |
---|---|---|
committer | Alex Elder <elder@dreamhost.com> | 2012-03-22 19:47:45 +0400 |
commit | f64a93172b97dcfcfa68f595652220653562f605 (patch) | |
tree | 7553ae9e69417d41467431e43b2b8e0d0694ded1 /fs/sync.c | |
parent | a5bc3129a296fd4663c3ef0be5575e82453739dd (diff) | |
download | linux-f64a93172b97dcfcfa68f595652220653562f605.tar.xz |
ceph: kill addr_str_lock spinlock; use atomic instead
A spinlock is used to protect a value used for selecting an array
index for a string used for formatting a socket address for human
consumption. The index is reset to 0 if it ever reaches the maximum
index value.
Instead, use an ever-increasing atomic variable as a sequence
number, and compute the array index by masking off all but the
sequence number's lowest bits. Make the number of entries in the
array a power of two to allow the use of such a mask (to avoid jumps
in the index value when the sequence number wraps).
The length of these strings is somewhat arbitrarily set at 60 bytes.
The worst-case length of a string produced is 54 bytes, for an IPv6
address that can't be shortened, e.g.:
[1234:5678:9abc:def0:1111:2222:123.234.210.100]:32767
Change it so we arbitrarily use 64 bytes instead; if nothing else
it will make the array of these line up better in hex dumps.
Rename a few things to reinforce the distinction between the number
of strings in the array and the length of individual strings.
Signed-off-by: Alex Elder <elder@newdream.net>
Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/sync.c')
0 files changed, 0 insertions, 0 deletions