diff options
author | Jeff Layton <jlayton@redhat.com> | 2017-07-06 07:02:24 -0400 |
---|---|---|
committer | Jeff Layton <jlayton@redhat.com> | 2017-07-06 07:02:24 -0400 |
commit | 84cbadadc6eafc4798513773a2c8fce37dcd2fb8 (patch) | |
tree | 0cf2168d471693e85cc39b291df98164338cb2f5 /lib/Makefile | |
parent | 5e8fcc1a0ffa0fb794b3c0efa2c3c7612a771c36 (diff) | |
download | talos-op-linux-84cbadadc6eafc4798513773a2c8fce37dcd2fb8.tar.gz talos-op-linux-84cbadadc6eafc4798513773a2c8fce37dcd2fb8.zip |
lib: add errseq_t type and infrastructure for handling it
An errseq_t is a way of recording errors in one place, and allowing any
number of "subscribers" to tell whether an error has been set again
since a previous time.
It's implemented as an unsigned 32-bit value that is managed with atomic
operations. The low order bits are designated to hold an error code
(max size of MAX_ERRNO). The upper bits are used as a counter.
The API works with consumers sampling an errseq_t value at a particular
point in time. Later, that value can be used to tell whether new errors
have been set since that time.
Note that there is a 1 in 512k risk of collisions here if new errors
are being recorded frequently, since we have so few bits to use as a
counter. To mitigate this, one bit is used as a flag to tell whether the
value has been sampled since a new value was recorded. That allows
us to avoid bumping the counter if no one has sampled it since it
was last bumped.
Later patches will build on this infrastructure to change how writeback
errors are tracked in the kernel.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Reviewed-by: NeilBrown <neilb@suse.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'lib/Makefile')
-rw-r--r-- | lib/Makefile | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Makefile b/lib/Makefile index 0166fbc0fa81..519782d9ca3f 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -41,7 +41,7 @@ obj-y += bcd.o div64.o sort.o parser.o debug_locks.o random32.o \ gcd.o lcm.o list_sort.o uuid.o flex_array.o iov_iter.o clz_ctz.o \ bsearch.o find_bit.o llist.o memweight.o kfifo.o \ percpu-refcount.o percpu_ida.o rhashtable.o reciprocal_div.o \ - once.o refcount.o usercopy.o + once.o refcount.o usercopy.o errseq.o obj-y += string_helpers.o obj-$(CONFIG_TEST_STRING_HELPERS) += test-string_helpers.o obj-y += hexdump.o |