Merge pull request #345 from arutk/resize_discard_alloc
Fix discard request map allocation
This commit is contained in:
commit
1dfae0d166
2
env/posix/ocf_env.h
vendored
2
env/posix/ocf_env.h
vendored
@ -71,6 +71,8 @@ typedef uint64_t sector_t;
|
||||
|
||||
#define ENV_BUG() assert(0)
|
||||
#define ENV_BUG_ON(cond) do { if (cond) ENV_BUG(); } while (0)
|
||||
#define ENV_BUILD_BUG_ON(cond) _Static_assert(!(cond), "static "\
|
||||
"assertion failure")
|
||||
|
||||
/* MISC UTILITIES */
|
||||
#define container_of(ptr, type, member) ({ \
|
||||
|
@ -352,6 +352,6 @@ typedef enum {
|
||||
* @}
|
||||
*/
|
||||
|
||||
#define MAX_TRIM_RQ_SIZE (1 * MiB)
|
||||
#define MAX_TRIM_RQ_SIZE (512 * KiB)
|
||||
|
||||
#endif /* __OCF_DEF_H__ */
|
||||
|
@ -42,7 +42,7 @@ struct ocf_req_allocator {
|
||||
|
||||
static inline size_t ocf_req_sizeof_map(struct ocf_request *req)
|
||||
{
|
||||
uint32_t lines = req->alloc_core_line_count;
|
||||
uint32_t lines = req->core_line_count;
|
||||
size_t size = (lines * sizeof(struct ocf_map_info));
|
||||
|
||||
ENV_BUG_ON(lines == 0);
|
||||
@ -224,6 +224,9 @@ int ocf_req_alloc_map(struct ocf_request *req)
|
||||
|
||||
int ocf_req_alloc_map_discard(struct ocf_request *req)
|
||||
{
|
||||
ENV_BUILD_BUG_ON(MAX_TRIM_RQ_SIZE / ocf_cache_line_size_4 *
|
||||
sizeof(struct ocf_map_info) > 4 * KiB);
|
||||
|
||||
if (req->byte_length <= MAX_TRIM_RQ_SIZE)
|
||||
return ocf_req_alloc_map(req);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user