]> git.baikalelectronics.ru Git - kernel.git/commit
bcache: add a comment in journal bucket reading
authorTang Junhui <tang.junhui@zte.com.cn>
Fri, 24 Nov 2017 23:14:24 +0000 (15:14 -0800)
committerJens Axboe <axboe@kernel.dk>
Fri, 24 Nov 2017 23:22:55 +0000 (16:22 -0700)
commit3cf3e51223c723e78c01ae904c522f7921fb45d0
treef291c1f0880394193ecda5eeec146d9a61d3fdb7
parent58e0b18d9f5a84930df23b13451e0280e4df9e1c
bcache: add a comment in journal bucket reading

Journal bucket is a circular buffer, the bucket
can be like YYYNNNYY, which means the first valid journal in
the 7th bucket, and the latest valid journal in third bucket, in
this case, if we do not try we the zero index first, We
may get a valid journal in the 7th bucket, then we call
find_next_bit(bitmap,ca->sb.njournal_buckets, l + 1) to get the
first invalid bucket after the 7th bucket, because all these
buckets is valid, so no bit 1 in bitmap, thus find_next_bit()
function would return with ca->sb.njournal_buckets (8). So, after
that, bcache only read journal in 7th and 8the bucket,
the first to the third buckets are lost.

So, it is important to let developer know that, we need to try
the zero index at first in the hash-search, and avoid any breaks
in future's code modification.

[ML: Fixed whitespace & formatting & file permissions]

Signed-off-by: Tang Junhui <tang.junhui@zte.com.cn>
Signed-off-by: Michael Lyle <mlyle@lyle.org>
Reviewed-by: Michael Lyle <mlyle@lyle.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/md/bcache/journal.c