Commit Graph

85 Commits

Author SHA1 Message Date
Tom Marshall 7b50dc7de7 Add explicit include for pagemap.h
This is required by newer kernels.
2022-01-16 11:05:44 -08:00
Tom Marshall d87de4e238 WIP: Add info command
This just reads the sysfs nodes and presents the information in a
convenient way.
2021-05-22 09:57:10 -07:00
Tom Marshall d3d581ecb6 Simplify lbd a bit, as logical block shift cannot be zero 2021-05-17 13:36:46 -07:00
Tom Marshall 32b0c7556d Use MAKE variable for sub-make 2021-05-17 13:36:46 -07:00
Tom Marshall 2ab9d9c4c6 Add ignore for newer kernel module build outputs 2021-05-17 13:36:46 -07:00
Tom Marshall 9ff7a1ddaf Remove variable pblk and pbat sizes, optimize, and cleanup 2021-05-17 13:36:40 -07:00
Tom Marshall 2fab692cdf Implement cbd tune plus some cleanup and rearranging
Still need to implement cbd tune --repack.
2019-11-18 00:47:10 +01:00
Tom Marshall 8b08b0c2c1 Make detect zeros a runtime flag 2019-11-17 10:09:58 -08:00
Tom Marshall 9f9722bb26 Validate lbat element length on read 2019-11-16 20:29:06 -08:00
Tom Marshall f1bb01ab48 Use bio_chain instead of rolling our own 2019-11-17 04:59:54 +01:00
Tom Marshall 79eaf7dc7c Update pbat stats in pbat_alloc/pbat_flush, not lbatview_elem_realloc 2019-11-17 04:41:12 +01:00
Tom Marshall b169a0fbcc Add zone lazy init and do more cleanup
* Add lazy init logic to cb format.  Override with --full-init.
 * Make cbd check lazy init aware.
 * Fix up a bunch of size calculation errors.
 * Add pblk validity check in lbd_flush, lbd_read.
2019-11-16 18:39:03 +01:00
Tom Marshall 8b9b922344 Handle various open failures better 2019-11-14 19:59:40 +01:00
Tom Marshall c6fe92715c Implement mount options cache_pages and sync
Also fixup kernel arg parsing.
2019-11-14 19:12:41 +01:00
Tom Marshall be3d28a255 Handle jiffies wrap 2019-11-14 18:37:28 +01:00
Tom Marshall 45676ae7d1 Add an install target
The kernel depmod script bails on pre-built distro kernels so silence
the sub-make output and run depmod anyway.
2019-11-14 18:20:50 +01:00
Tom Marshall bfecc33c54 Clean up compress_ctr and compress_dtr
Always set dm_target.error on initialization error.

Always cleanup properly on error.
2019-11-14 15:06:36 +01:00
Tom Marshall 2df4071304 Fix dm_target_pblk_size() 2019-11-14 14:23:17 +01:00
Tom Marshall 2e5bbb95b4 Write zone metadata in a single write() 2019-11-14 13:58:30 +01:00
Tom Marshall 6e92d5071a Fix variable pblk len, cleanup, rearrange
This is tested with the performance profile and works.

Lots of cleanup and rearranging also.
2019-11-13 15:36:33 -08:00
Tom Marshall 8229ef90bd Make pblk len variable, add format profiles, and cleanup 2019-11-12 23:49:36 +01:00
Tom Marshall efc83e0dc2 Rename [pl]blk_alloc to [pl]blk_used
Also a bit of minor cleanup.
2019-11-12 14:57:06 +01:00
Tom Marshall e70d283921 Add stats
In /sys/fs/compress/device-name:
	lblk_size,
	pblk_used/total,
	lblk_used/total,
	pbat_r/w,
	lbatpblk_r/w,
	lbd_r/w
2019-11-12 14:45:42 +01:00
Tom Marshall c4aabad212 Rename lbatpage to lbatpblk
This is more accurate, and will matter if pblk size is variable.
2019-11-11 21:07:11 +01:00
Tom Marshall ceb0eb3230 Make cbd check actually do a check and do some cleanup
* cbd check now works (ish).
 * Added full-check arg to cbd check, link with liblz4, libz.
 * Added libcbd/util.c with goodies like verbose, ask_user_bool.
 * Rework kernel side params, stats to separate from user space.
 * Lock kernel stats when updating.
 * Add lblk_used to stats.

... and probably some other forgotten things.
2019-11-11 20:48:46 +01:00
Tom Marshall d43a37531f Set error flag on lbat alloc failure 2019-11-09 20:34:29 +01:00
Tom Marshall dbea68ddd2 Do not vmap singe pages, just use page_address 2019-11-09 17:07:38 +01:00
Tom Marshall 66eeec39f5 Add error flag to cbd_params, set it on write error 2019-11-09 17:02:53 +01:00
Tom Marshall 97eb421b58 Improve lbdcache locking
* Separate cache and flush locks.
   Note lock order: flush -> cache

 * Never flush lbd with either cache or flush lock held.

 * Rename locks in other caches for consistency.
2019-11-08 15:28:05 -08:00
Tom Marshall bd51b7cb89 Flush lbd on a timer in lbdcache instead of the main module 2019-11-08 12:24:21 -08:00
Tom Marshall 68956f70e8 Minimize the amount of pbat reading to find free pblks
* Keep track of full pbats.
 * Allow specifying whether pbat must be non-full in pbatcache_get().
2019-11-06 14:58:04 -08:00
Tom Marshall a2e4f303fd Implement better caching
* Total cache size is the minimum of:
   - 1/1k of system RAM.
   - 1/64k of backing device.
   - 32 * 2 * CPUs.
   The latter ensures that we have at least 2*CPUs lbd objects
   which is required for the top level compress operations.

 * Implement LRU for all caches.

 * Track pblk full and last allocated block for better performance.

Still could use better parsing for cache_pages parameter and more
granularity, but this is workable for now.
2019-11-06 13:23:28 -08:00
Tom Marshall 3e81efb9f6 Defer releasing lbd until all I/O ops are done
This greatly increases performance.
2019-11-05 13:56:47 -08:00
Tom Marshall d7fb50911b Start implementing stats
Just pblks allocated for now.

Also update device layout info in README.
2019-11-04 12:25:54 -08:00
Tom Marshall 94551dffdd Simplify object error logic
Write error always sets error on all written pages and we always write
the first page.  So only check the first page.
2019-11-04 11:36:20 -08:00
Tom Marshall cbf8777042 Reset objects outside cache lock
Also update TODO
2019-11-04 11:36:20 -08:00
Tom Marshall f37155f527 Add flags to header
Initial flag definition includes dirty flag.

Also remove unused pblk_read().

Also add pbat-len arg to format.
2019-11-04 11:36:12 -08:00
Tom Marshall 141888fa98 Make pbat len variable
Also a bit of cleanup in lbd.c
2019-11-04 11:18:28 -08:00
Tom Marshall b8395c8a83 Alloc compress state using vmalloc 2019-11-03 09:00:28 -08:00
Tom Marshall 92fc5158e2 Remove percpu comment 2019-11-03 08:31:13 -08:00
Tom Marshall 309bb2d5ef Tidy up lblk percpu stuff 2019-11-03 08:28:13 -08:00
Tom Marshall f90c744a38 Update TODO 2019-11-03 08:18:24 -08:00
Tom Marshall 7a743a7e65 Rewrite lbatview_elem_realloc
* Only touch the data we need to touch.
 * Handle failure gracefully by reverting to old data.
 * Adjust libcbd check_one_lblk to ignore unused allocs.
2019-11-03 08:15:43 -08:00
Tom Marshall 5be74b3346 Make pblk_read/write take block_device, not cbd_params 2019-11-02 08:11:12 -07:00
Tom Marshall f1513f8cb3 pbat_write tweaks
* Rename pblk_endio to pblk_write_endio.
 * Unlock pages last in pblk_write_endio.
 * Do page ops when prepare fails.
 * Ditch header guard.
2019-11-02 08:00:37 -07:00
Tom Marshall 7fbf77b1f3 Revert "Add md5 for debugging"
This reverts commit 351e43b953.
2019-11-02 07:54:02 -07:00
Tom Marshall 11cc8a229e Use page vector and vmap for lbd 2019-11-02 07:49:09 -07:00
Tom Marshall 8e1630b08c Rearrange compress init 2019-11-01 15:08:34 -07:00
Tom Marshall ee7eacd4a6 First really working version 2019-11-01 14:41:11 -07:00
Tom Marshall 9a543670aa Fix writeback for lbatpage 2019-10-31 14:48:12 -07:00