Commit Graph

47 Commits

Author SHA1 Message Date
hongxu-jia
9311aa6483 fix compile failed with libc musl (#103)
There is a failure while compiling with libc musl:
[snip]
|./block-cache/io_engine.h:18:17: error: expected
unqualified-id before numeric constant
|  unsigned const PAGE_SIZE = 4096;
[snip]

The musl defeines macro PAGE_SIZE, undef it conditionally
could fix the issue.

http://musl.openwall.narkive.com/tO8vrHdP/why-musl-define-page-size

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
2018-08-01 07:10:26 +01:00
Jörg Thalheim
6a7351da0d Fix musl build (#96)
a) Fix build if limits.h provides definition for PAGE_SIZE, as musl does w/musl per XSI[1] although it's apparently optional [2].
   This value is only provided when it's known to be a constant, to avoid the need to discover the value dynamically.
b) If not using system-provided (kernel headers, or libc headers, or something) use the POSIX approach of querying the value
   dynamically using sysconf(_SC_PAGE_SIZE) instead of hardcoded value that hopefully is correct.
[1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/limits.h.html
[2] http://www.openwall.com/lists/musl/2015/09/11/8

This patch originate from:

  https://raw.githubusercontent.com/voidlinux/void-packages/a0ece13ad7ab2aae760e09e41e0459bd999a3695/srcpkgs/thin-provisioning-tools/patches/musl.patch

and was also applied in NixOS:

  https://github.com/NixOS/nixpkgs/pull/40559/

cc @dtzWill
2018-05-22 14:02:49 +01:00
Joe Thornber
666a32da9c [block-cache] remove spurious FIXME 2017-08-14 14:12:05 +01:00
Joe Thornber
da3f9ca476 [block-cache] tidy hit/miss tracking 2017-08-14 14:11:53 +01:00
Joe Thornber
0a47ad5a85 [block-cache] remove BF_PREVIOUSLY_DIRTY and improve nr_dirty_ accounting. 2017-08-14 13:44:21 +01:00
Joe Thornber
a45ffd896a [block-cache] writeback could get stuck in a loop
If a block had a non zero ref count.
2017-08-14 10:40:41 +01:00
Joe Thornber
dfd066e59e [block-cache] remove unused var 2017-08-14 10:34:59 +01:00
Joe Thornber
398d53e0d6 [block-cache] add comment to stop me removing the list sizes again. 2017-08-14 10:17:56 +01:00
Joe Thornber
4489a9bae6 [block-cache] reverse earlier patch which took out manual counts for
nr_dirty etc.

The block list type doesn't have a constant time size() method.
2017-08-14 10:13:32 +01:00
Joe Thornber
0a06e4b21b [block-cache] Remove nr_dirty_ and nr_io_pending_.
Better to use the size of the relevant list.
2017-07-24 16:08:49 +01:00
Joe Thornber
2c6278ed4b [block_cache] Be better about flushing dirty blocks on demand.
Dirty blocks could prevent a clean lock being given.  Patch from mingus.
2017-07-24 15:35:10 +01:00
Joe Thornber
5fd0b02e40 [io-engine] Add missing include 2017-03-13 13:20:27 +00:00
Joe Thornber
803b2f3a40 Merge branch 'v0.7-devel'
Conflicts:
	VERSION
2017-03-08 11:05:50 -05:00
Ming-Hung Tsai
6c1be8d6fa [block-cache] Fix error handling in reading libaio events
io_event::res is a signed int64 in kernel, but libaio defines it
as unsigned long. We should cast it to a signed value.
2016-10-06 23:42:27 +08:00
Joe Thornber
a124b7ce26 [block-cache] Fix some bugs in the copier 2016-06-14 16:27:17 +01:00
Joe Thornber
0f778a0a38 [block-cache] FIx some bugs in the io engine 2016-06-14 16:26:37 +01:00
Joe Thornber
e5f969817e [block cache] improve exception message 2016-06-14 14:27:22 +01:00
Joe Thornber
07f44e9c77 [io_engine] Add exclusive flag to io_engine 2016-06-07 13:45:27 +01:00
Joe Thornber
a94bfea798 [block-cache] unit tests + debug io_engine and copier 2016-06-07 11:12:27 +01:00
Joe Thornber
34c039d7dc [mempool] more tests 2016-06-01 14:46:27 +01:00
Joe Thornber
73a69abfd2 [unit-tests] copier and mem_pool tests.
More to come
2016-05-07 11:47:40 +01:00
Joe Thornber
c8fec7ec40 [cache_writeback] Coded, needs testing 2016-04-14 08:54:32 +01:00
Joe Thornber
4573ebb218 [cache_writeback] work in progress 2016-03-17 15:15:52 +00:00
Joe Thornber
286f70ceac Merge remote-tracking branch 'remotes/github-m-h-tsai/v0.6.2-repairtool' into 2016-02-29-mingus-merge
Conflicts:
	Makefile.in
	VERSION
	thin-provisioning/commands.cc
	thin-provisioning/commands.h
	thin-provisioning/thin_delta.cc
2016-02-29 10:29:28 +00:00
Ming-Hung Tsai
778c153c1e [block-cache] Add check_raw() to bcache::validator 2016-02-27 15:21:13 +08:00
Ming-Hung Tsai
11cd796652 Show the block address if block_cache::get() failed 2016-02-27 15:04:08 +08:00
Joe Thornber
a5a53648c9 Merge branch '2015-08-19-thin-show-duplicates' into merge-thin-ls
Conflicts:
	Makefile.in
	block-cache/block_cache.h
	main.cc
	thin-provisioning/commands.h
2016-02-24 14:31:51 +00:00
Joe Thornber
767c39cf71 [build] switch to c++11
Conflicts:
	Makefile.in
	chunker/cache_stream.cc
	chunker/cache_stream.h
	thin-provisioning/thin_archive.cc
	thin-provisioning/thin_show_duplicates.cc
	unit-tests/Makefile.in
2016-02-16 16:45:44 +00:00
Joe Thornber
639af9c3bf [block-cache] convert to use boost::intrusive rather than kernel style lists.
Major change, do not release until a lot of testing has been done.

Conflicts:
	block-cache/block_cache.h
2016-02-16 16:18:13 +00:00
Joe Thornber
c8d3ce6af5 [thin_show_duplicates] start factoring out a chunk_stream abstraction 2015-08-24 11:18:31 +01:00
Joe Thornber
b493a30b65 [block-cache] tweak when validators are swapped
Makes it more consitent in the face of exceptions
2014-08-21 14:23:14 +01:00
Joe Thornber
6f760ccd87 [block-cache] When changing validators the new validator check fn was only being called if the block was dirty. 2014-08-21 14:22:14 +01:00
Joe Thornber
b5a9cd6043 [block-cache] Create just one noop_validator
No need to create a separate one for each block.
2014-08-21 14:20:36 +01:00
Joe Thornber
4799becb01 [block-cache] fix leaking validators
The memory for the blocks is explicitly managed, and the destructors
for the blocks wasn't being called.
2014-08-21 14:19:36 +01:00
Joe Thornber
0d3942cae8 [block-manager] ensure the superblock cannot be taken concurrently with any other lock. 2014-08-21 12:18:05 +01:00
Joe Thornber
ad38cfe9c9 [block cache] Comment out the statistics output for now 2014-08-12 10:15:14 +01:00
Joe Thornber
48c6dc0762 Flush the block cache stats when they're complete 2014-08-05 14:53:03 +01:00
Joe Thornber
f534664f96 Add stats to block cache and remove the info fn 2014-07-31 12:18:01 +01:00
Joe Thornber
eee9004354 whitespace 2014-07-30 12:27:33 +01:00
Joe Thornber
a99d6896a8 Fix a bug in the block cache read path. 2014-07-29 13:41:45 +01:00
Joe Thornber
f06a2673c5 wip 2014-07-29 11:34:26 +01:00
Joe Thornber
d482a76bda Use placement new to initialise the blocks 2014-07-28 14:32:33 +01:00
Joe Thornber
840be1b6c9 wip 2014-07-28 14:13:28 +01:00
Joe Thornber
11469a2fda Beginning to work 2014-07-25 16:14:24 +01:00
Joe Thornber
7e870ea5a6 start removing block_manager<>::block 2014-07-25 14:46:51 +01:00
Joe Thornber
b32908d5c2 work in progress 2014-07-25 10:35:04 +01:00
Joe Thornber
d9040949fc forgot block_cache itself 2014-07-22 16:43:44 +01:00