Commit Graph

74 Commits

Author SHA1 Message Date
Adam Rutkowski
689c44c76b Remove ocf_metadata_probe_cores() implementation
This function must be fixed to work with metadata flapping. Until then
mark as not supported

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
Signed-off-by: Krzysztof Majzerowicz-Jaszcz <krzysztof.majzerowicz-jaszcz@intel.com>
2022-03-04 19:13:40 +01:00
Adam Rutkowski
866bba72bf Explicitly validate superblock after load
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>

Additional changes - load sb recovery CRC check

Signed-off-by: Krzysztof Majzerowicz-Jaszcz <krzysztof.majzerowicz-jaszcz@intel.com>
2022-03-04 19:12:51 +01:00
Robert Baldyga
e30fd48338
Merge pull request #656 from jfckm/extend-metadata-probe
Include cache mode and cache line size in metadata probe
2022-02-04 13:01:10 +01:00
Jan Musial
8522b0b6e6 Include cache mode and cache line size in metadata probe
Signed-off-by: Jan Musial <jan.musial@intel.com>
2022-02-04 08:15:05 +01:00
Adam Rutkowski
294e02bc1b Fail cache recovery in case of erroneous mapping
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2022-01-10 11:10:02 +01:00
Adam Rutkowski
9693b82cf9 Only flush superblock at the end of cache attach
The purpose of this change is not to write superblock to the cache
drive untill all other sections are initilized on disk in attach()
path. Combined with superblock clearing at the erarlier stage of
attach(), this assures there are no residual mappings in the collision
section in case of power failure during attach with pre-existing
metadata.

This is implemented by removing ocf_metadata_flush_all_set_status() step
at the beginning of ocf_metadata_flush_all().
ocf_metadata_flush_all() is called, except for the attach() case described
above, in two cases:
1. at the end of cache load - potentially after cache recovery
2. during detaching cache drive in cache stop.

To make sure there are no regressions in the first case, an explicit
_ocf_mngt_attach_shutdown_status() is added to load pipeline before
ocf_metadata_flush_all(). The second case is always ran after cache
drive is attached, so dirty status bit must have already be written to
the disk.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2022-01-05 13:06:59 +01:00
Adam Rutkowski
196437f9bc Zero superblock before writing metadata
This is the first step towards atomic initialization of metadata
on cache disk.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2022-01-05 13:06:59 +01:00
Robert Baldyga
c6644116ae
Merge pull request #614 from robertbaldyga/redesign-standby
Redesign failover standby API
2022-01-04 14:07:05 +01:00
Jan Musial
ae18ce274e Fix cache size requirements and some logging
Signed-off-by: Jan Musial <jan.musial@intel.com>
2022-01-03 14:30:07 +01:00
Robert Baldyga
b25cd91b86 Remove unused ocf_metadata_load_unsafe()
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-12-29 20:31:43 +01:00
Robert Baldyga
99c8c05f3f Introduce flapping of metadata config sections
This feature provides double buffering of config sections to prevent
situation when power failure during metadata flush leads to partially
updated metadata. Flapping mechanism makes it always possible to perform
graceful rollback to previous config metadata content in such situation.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-12-15 15:30:34 +01:00
Michal Mielewczyk
4ab22ee2dc Maintain runtime struct during failover standby
To allow the fastest switching from the passive-standby to active mode, the
runtime metadata must be kept 100% synced with the metadata on the drive and in
the RAM thus recovery is required after each collision section update.

To avoid long-lasting recovering of all the cachelines each time the collision
section is being updated, the passive update procedure recovers only those
which have its MD entries on the updated pages.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-11-19 11:58:09 +01:00
Michal Mielewczyk
bb0ff67fe9 Metadata clear_dirty_if_invalid() utility
Fix cacheline's metadata if it is dirty and invalid

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-11-19 11:53:48 +01:00
Rafal Stefanowski
3cc0d07197 License change to be approved by contributors
Signed-off-by: Rafal Stefanowski <rafal.stefanowski@intel.com>
2021-10-27 12:48:20 +02:00
Robert Baldyga
7587bec07c
Merge pull request #567 from robertbaldyga/optimize-out-recovery-sector-loop
Optimize out looping over cache line sectors in recovery
2021-09-08 13:57:32 +02:00
Michal Mielewczyk
612f68b3c1 Fix metadata io detection in passive mode
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-09-08 13:33:04 +02:00
Robert Baldyga
65d3e7a41a Introduce ocf_metadata_clear_valid_if_clean()
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-09-07 22:54:10 +02:00
Robert Baldyga
12a82d7fb1 Get rid of struct ocf_cache_line_settings
Remove struct that contains redundant data.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-09-07 14:53:46 +02:00
Robert Baldyga
9b3a0c968e Introduce ocf_metadata_passive_update()
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-09-06 13:49:21 +02:00
Robert Baldyga
85e8b414c4 Add ocf_metadata_load_unsafe()
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-09-03 17:22:22 +02:00
Robert Baldyga
c6c6618ad8 Move recovery code from metadata to cache mngt
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-09-03 17:22:22 +02:00
Robert Baldyga
9ab4c51dfa Expose superblock operations as part of internal metadata API
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-09-03 17:22:22 +02:00
Robert Baldyga
387cf1b9a5 Fix debug tracing in metadata
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-09-02 22:38:37 +02:00
Michal Mielewczyk
26194fc536 Use cleaning ops wrapper functions
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-07-27 15:44:18 +02:00
Robert Baldyga
f538bbd3ae Fix argument order in ocf_metadata_set_partition_id() call
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-07-09 21:31:06 +02:00
Adam Rutkowski
1e1955b833 lru refactor
rearanging lru implementation for easier journaling

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-06-21 22:32:57 +02:00
Adam Rutkowski
36107fd528 Initialize partitions during cache start
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-06-18 12:19:08 +02:00
Adam Rutkowski
33e2beac24 Rename "evp_lru*" functions to "ocf_lru*"
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-06-18 12:19:08 +02:00
Adam Rutkowski
7c0f940876 Replace eviction with lru in metadata structs
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-06-18 12:19:08 +02:00
Adam Rutkowski
88e04a4204 Remove eviction policy abstraction
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-06-18 12:19:08 +02:00
Adam Rutkowski
4f217b91a5 Remove partition list
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-06-18 12:19:08 +02:00
Adam Rutkowski
87f834c793 Move common user and freelist partition data to a new struct
New structure ocf_part is added to contain all the data common for both
user partitions and freelist partition: part_runtime and part_id.
ocf_user_part now contains ocf_part structure as well as pointer to
cleaning partition runtime metadata (moved out from part_runtime) and
user partition config (no change here).

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-06-18 12:07:10 +02:00
Robert Baldyga
73c3e97f43
Merge pull request #509 from Open-CAS/rm-metadata-updater
Remove metadata updater
2021-06-17 09:34:18 +02:00
Adam Rutkowski
953e0f25d7 replace metadata updater with metadata I/O concurrency
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-06-15 10:25:05 +02:00
Jan Musial
4031b4b2ae Delete metadata self-test
Signed-off-by: Jan Musial <jan.musial@intel.com>
2021-06-10 15:20:25 +02:00
Adam Rutkowski
0476511c00 probe: return dirty and shutdown status despite metadata mismatch
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2021-04-06 14:07:42 -05:00
Slawomir Jankowski
eeda1f3f0f Unify type of dirty_for in info structs
Reformat function that calculates how long cache/core is dirty
Update `dirty_for` types in functional tests

Values stored in info structs fields (both in cache and core structs)
are unsigned 64-bits ints but `dirty_for`s were unsigned 32-bits ints.

Use existing function to transform returned value to seconds.
Replace seconds stored in metadata with seconds.
Replacement was done if old value of replaced field was equal to zero.
Acquiring monotonic high precission timestamp is potentially
slow and it makes sense to compare the field's value
to zero before calling atomic function.

Signed-off-by: Slawomir Jankowski <slawomir.jankowski@intel.com>
2021-02-25 14:51:53 +01:00
Rafal Stefanowski
6ed4cf8a24 Update copyright statements (2021)
Signed-off-by: Rafal Stefanowski <rafal.stefanowski@intel.com>
2021-01-21 13:17:34 +01:00
Robert Baldyga
5a88ab2d61 Flush metadata collision segment on core remove
If there is any dirty data on the cache associated with removed core,
we must flush collision metadata after removing core to make metadata
persistent in case of dirty shutdown.

This fixes the problem when recovery procedure erroneously interprets
cache lines that belonged to removed core as valid ones.

This also fixes the problem, when after removing core containing dirty
data another core is added, and then recovery procedure following dirty
shutdown assigns cache lines from removed core to the new one, effectively
leading to data corruption.

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2021-01-19 13:34:28 +01:00
Michal Mielewczyk
fcef130919 Bug on metadata access error
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2021-01-07 18:10:44 -05:00
Rafal Stefanowski
d3b61e474c Remove init_mode and use metadata.is_volatile instead
Signed-off-by: Rafal Stefanowski <rafal.stefanowski@intel.com>
2020-12-23 16:31:55 +01:00
Adam Rutkowski
1b8bfb36f5 Add missing part->id initialization
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2020-12-22 11:52:20 +01:00
Adam Rutkowski
822cd7c45a Introduce metadata superblock & segment structures
Refactoring metadata superblock and segment ops code
to make it less tightly coupled.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2020-12-20 16:35:53 +01:00
Adam Rutkowski
3eb5568608 rename segment->segment_id and segemnt_ops->segment
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2020-12-20 16:35:53 +01:00
Adam Rutkowski
b074d77797 Spliting metadata implementation to match header files
Moving metadata implementation out of obsolete metadata_hash.c
to .c files corresponding to function declaration header files.
This requires adding shared header for metadata implementation
metadata_internal.h. Some metadata header files did not have
a corresponding .c file - in this case it is added in this
commit.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2020-12-20 16:35:49 +01:00
Adam Rutkowski
98cba1603f Replace metadata ifc wrappers with direct calls to hash ifc
Metadata wrapper functions (calling iface->func) in header
files are changed to be declarations only. Hash interface
implementation functions in metadata_hash.c are given an
external linkage and are renamed to drop "hash" prefix.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2020-12-20 15:09:49 +01:00
Adam Rutkowski
d2af0bafda Remove redundant locks from metadata flush/load all
Locks acquired in ocf_metadata_flush(/load)_all are
acquired only for the duration of queueing asynch
service for flush/load, no actual metadata accesses
are performed there.

Also flush/load all are always performed with metadata
marked as deinitialized (metadata reference counter freezed),
so no I/O is reading nor writing the metadata. The only source
of potential concurrent metadata accesses are other management
operations, which should be synchronized using management lock.

Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
2020-12-20 15:09:49 +01:00
Rafal Stefanowski
38e7e19290 Update copyright statements
Signed-off-by: Rafal Stefanowski <rafal.stefanowski@intel.com>
2020-04-28 13:37:54 +02:00
Michal Rakowski
b78557a2cc Change env_spinlock_init to non-void function
Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
2019-09-30 17:15:27 +02:00
Robert Bałdyga
75569ecaba
Merge pull request #284 from mmichal10/prevent-cache-name-duplicate
Prevent cache name duplicate
2019-09-25 15:36:08 +02:00