Signed-off-by: Dongsheng Yang <[email protected]>
---
drivers/md/dm-pcache/cache_req.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/md/dm-pcache/cache_req.c b/drivers/md/dm-pcache/cache_req.c
index 992a1ad98909..e0b90bfea4fe 100644
--- a/drivers/md/dm-pcache/cache_req.c
+++ b/drivers/md/dm-pcache/cache_req.c
@@ -45,6 +45,7 @@ static int cache_data_alloc(struct pcache_cache *cache,
struct pcache_cache_key
preempt_disable();
data_head = get_data_head(cache);
again:
+ to_alloc = key->len - allocated;
if (!data_head->head_pos.cache_seg) {
seg_remain = 0;
} else {
@@ -54,7 +55,6 @@ static int cache_data_alloc(struct pcache_cache *cache,
struct pcache_cache_key
head_pos = &data_head->head_pos;
cache_seg = head_pos->cache_seg;
seg_remain = cache_seg_remain(head_pos);
- to_alloc = key->len - allocated;
}
if (seg_remain > to_alloc) {
--
2.43.0