Skip to content

Commit baecb2c

Browse files
committed
fix dynamic prefetch, to support prefetch path "/"
Signed-off-by: zhuangbowei.zbw <zhuangbowei.zbw@alibaba-inc.com>
1 parent be5e0a4 commit baecb2c

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

src/prefetch.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,18 @@ limitations under the License.
2929
#include "prefetch.h"
3030
#include "tools/comm_func.h"
3131
#include "overlaybd/lsmt/file.h"
32+
#include "overlaybd/zfile/crc32/crc32c.h"
33+
3234
#include <photon/common/alog.h>
3335
#include <photon/common/alog-stdstring.h>
3436
#include <photon/fs/forwardfs.h>
3537
#include <photon/fs/localfs.h>
3638
#include <photon/thread/thread11.h>
37-
#include "overlaybd/zfile/crc32/crc32c.h"
38-
#include "photon/fs/filesystem.h"
39-
#include "photon/fs/fiemap.h"
40-
#include "photon/fs/path.h"
41-
#include "photon/common/enumerable.h"
39+
#include <photon/fs/filesystem.h>
40+
#include <photon/fs/fiemap.h>
41+
#include <photon/fs/path.h>
42+
#include <photon/common/enumerable.h>
43+
#include <photon/fs/extfs/extfs.h>
4244

4345

4446
using namespace std;
@@ -370,7 +372,7 @@ class DynamicPrefetcher : public PrefetcherImpl {
370372
while (start <= end && str[start] == c) {
371373
++start;
372374
}
373-
while (end >= start && str[start] == c) {
375+
while (end >= start && str[end] == c) {
374376
--end;
375377
}
376378
return str.substr(start, end - start + 1);
@@ -394,7 +396,7 @@ class DynamicPrefetcher : public PrefetcherImpl {
394396
file.seekg(0, ios::beg);
395397
std::string line;
396398
while (std::getline(file, line)) {
397-
line = trim(trim(line, ' '), '/');
399+
line = trim(line, ' ');
398400
if (line.empty() || !invalid_abs_path(line)) {
399401
continue;
400402
}
@@ -470,7 +472,7 @@ class DynamicPrefetcher : public PrefetcherImpl {
470472
if (fstype == "erofs")
471473
fs = create_erofs_fs(const_cast<IFile*>(imagefile), 4096);
472474
else
473-
fs = create_ext4fs(const_cast<IFile*>(imagefile), false, true, "/");
475+
fs = new_extfs(const_cast<IFile*>(imagefile), true);
474476

475477
if (fs == nullptr) {
476478
LOG_ERROR_RETURN(0, -1, "unrecognized filesystem in dynamic prefetcher");

0 commit comments

Comments
 (0)