]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
librbd/cache/pwl: solve the problem of calc m_bytes_allocated when reload entries. 42883/head
authorJianpeng Ma <jianpeng.ma@intel.com>
Tue, 31 Aug 2021 01:02:56 +0000 (09:02 +0800)
committerJianpeng Ma <jianpeng.ma@intel.com>
Tue, 31 Aug 2021 01:02:56 +0000 (09:02 +0800)
commita96ca93d69d5c1f302f3141082302d4699915397
tree85f161d7bb00f762e233f773933783177022ca61
parent980cf670ed7cb8afe9f58c26782e34e559848051
librbd/cache/pwl: solve the problem of calc m_bytes_allocated  when reload entries.

Currently, it will load existing entries after restart and cacl
m_bytes_allocated based on those entries. But currently there are
the following problems:
1: The allocated of write-same is not calculated for rwl & ssd cache.
2: for ssd cache, it not include the size of log-entry itself and don't
consider data alignment. This will cause less calculation and more
allocatation later. And will overwrite the data which don't flush to osd
and make data lost.

The calculation methods of ssd and rwl are different. So add new api
allocated_and_cached_data() to implement their own method.

For SSD cache, we dirtly use m_first_valid_entry & m_first_free_entry to
calc m_bytes_allocated.

Fixes:https://tracker.ceph.com/issues/52341
Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
src/librbd/cache/pwl/AbstractWriteLog.cc
src/librbd/cache/pwl/AbstractWriteLog.h
src/librbd/cache/pwl/rwl/WriteLog.cc
src/librbd/cache/pwl/rwl/WriteLog.h
src/librbd/cache/pwl/ssd/WriteLog.cc
src/librbd/cache/pwl/ssd/WriteLog.h