Don't remove inactive core if it has dirt cache lines assigned unless `force`
flag is specified.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
Type of `dirty_for` in structs needs to be unified.
Values stored in these fields (both in cache and core info structs)
are unsigned 64-bits ints but `dirty_for`s were unsigned 32-bits ints
(vide changes in OCF).
Signed-off-by: Slawomir Jankowski <slawomir.jankowski@intel.com>
Add `remove_inactive_core` function to casadm's code
to handle `remove inactive` command.
Print messages based on errors returned when command fails.
Add documentation comment to new function.
Add CLI part of introduced command.
Signed-off-by: Slawomir Jankowski <slawomir.jankowski@intel.com>
New error code will allow to properly handle issues caused by wrong
usage of `remove inactive core` command.
It will also allow to print meaningful error messages.
Signed-off-by: Slawomir Jankowski <slawomir.jankowski@intel.com>
Change extended error message for `KCAS_ERR_REMOVED_DIRTY`.
Print informative messages when `remove core` command fails.
Make separate error messages for detaching.
Update help printouts.
Update documentation comments.
Signed-off-by: Slawomir Jankowski <slawomir.jankowski@intel.com>
On some systems, e.g. Ubuntu, the order of linking `math` library is
important and when linking is done too early, openCAS making fails.
Signed-off-by: Slawomir Jankowski <slawomir.jankowski@intel.com>
If an underflowed float number was casted to an int explicitly, it's value was
rounded to a lower value.
Using `round()` function ensures that the number will be always rounded to a
nearest integer.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
Force option is used to enforce metadata erasure despite
dirty data, metadata mistmatch and/or dirty shutdown.
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
Kernel adapter now returns is_cache_device=1 and newly added
metadata_compatible=0 in case of metadata detected with
differing version (instead of is_cache_device = 0).
This allows zero-superblock command to recognize old
cache instance and clear it.
casadm --script --check-cache-device still returns 'Is cache'='no'
in this case, as this layer only cares about metadata in current
version to be able to detect dirty datas tatus.
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
This check covers the previous case (cache started) as well as
other potential incorrect usages of the command. Also now
the check is made exactly at the moment of opening the
device to write to.
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
to `print_slow_atomic_cache_start_info` after removing check from lower
function `_check_cache_device`.
Signed-off-by: Slawomir Jankowski <slawomir.jankowski@intel.com>
Not every usage of `set_device_path()` needs to print message.
Sometimes it's internal operation and can contain misleading info.
Signed-off-by: Slawomir Jankowski <slawomir.jankowski@intel.com>