Skip to content

Commit

Permalink
Merge pull request #652 from arutk/v21.6.4-fix-flapping
Browse files Browse the repository at this point in the history
[v21.6.4] Check superblock CRC before it is used
  • Loading branch information
Robert Baldyga committed Jan 25, 2022
2 parents 2de39eb + d78842d commit c2dd225
Show file tree
Hide file tree
Showing 10 changed files with 161 additions and 421 deletions.
2 changes: 1 addition & 1 deletion inc/ocf_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
/**
* Maximum value of a valid core sequence number
*/
#define OCF_SEQ_NO_MAX (65535UL)
#define OCF_SEQ_NO_MAX ((1ULL << (sizeof(ocf_core_id_t) * 8)) - 1)
/*
* Invalid value of core sequence number
*/
Expand Down
7 changes: 7 additions & 0 deletions src/engine/cache_engine.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,3 +286,10 @@ void ocf_engine_hndl_ops_req(struct ocf_request *req)

ocf_engine_push_req_back(req, true);
}

bool ocf_req_cache_mode_has_lazy_write(ocf_req_cache_mode_t mode)
{
return ocf_cache_mode_is_valid((ocf_cache_mode_t)mode) &&
ocf_mngt_cache_mode_has_lazy_write(
(ocf_cache_mode_t)mode);
}
12 changes: 1 addition & 11 deletions src/engine/cache_engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,7 @@ static inline const char *ocf_get_io_iface_name(ocf_cache_mode_t cache_mode)
return iface ? iface->name : "Unknown";
}

static inline bool ocf_cache_mode_is_valid(ocf_cache_mode_t mode)
{
return mode >= ocf_cache_mode_wt && mode < ocf_cache_mode_max;
}

static inline bool ocf_req_cache_mode_has_lazy_write(ocf_req_cache_mode_t mode)
{
return ocf_cache_mode_is_valid((ocf_cache_mode_t)mode) &&
ocf_mngt_cache_mode_has_lazy_write(
(ocf_cache_mode_t)mode);
}
bool ocf_req_cache_mode_has_lazy_write(ocf_req_cache_mode_t mode);

bool ocf_fallback_pt_is_on(ocf_cache_t cache);

Expand Down
Loading

0 comments on commit c2dd225

Please sign in to comment.