]>
git.proxmox.com Git - ceph.git/blob - ceph/src/tools/cephfs/JournalScanner.h
1 // -*- mode:c++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * ceph - scalable distributed file system
6 * copyright (c) 2014 john spray <john.spray@inktank.com>
8 * this is free software; you can redistribute it and/or
9 * modify it under the terms of the gnu lesser general public
10 * license version 2.1, as published by the free software
11 * foundation. see file copying.
14 #ifndef JOURNAL_SCANNER_H
15 #define JOURNAL_SCANNER_H
17 // For Journaler::Header, can't forward-declare nested classes
18 #include <osdc/Journaler.h>
24 #include "JournalFilter.h"
27 * A simple sequential reader for metadata journals. Unlike
28 * the MDS Journaler class, this is written to detect, record,
29 * and read past corruptions and missing objects. It is also
30 * less efficient but more plainly written.
39 JournalFilter
const filter
;
47 JournalFilter
const &filter_
) :
51 pointer_present(false),
53 header_present(false),
62 pointer_present(false),
64 header_present(false),
70 int scan(bool const full
=true);
74 void report(std::ostream
&out
) const;
76 std::string
obj_name(uint64_t offset
) const;
77 std::string
obj_name(inodeno_t ino
, uint64_t offset
) const;
79 // The results of the scan
80 inodeno_t ino
; // Corresponds to JournalPointer.front
83 EventRecord() : log_event(NULL
), raw_size(0) {}
84 EventRecord(LogEvent
*le
, uint32_t rs
) : log_event(le
), raw_size(rs
) {}
86 uint32_t raw_size
; //< Size from start offset including all encoding overhead
92 std::string description
;
93 EventError(int r_
, const std::string
&desc_
)
94 : r(r_
), description(desc_
) {}
97 typedef std::map
<uint64_t, EventRecord
> EventMap
;
98 typedef std::map
<uint64_t, EventError
> ErrorMap
;
99 typedef std::pair
<uint64_t, uint64_t> Range
;
100 bool pointer_present
;
104 Journaler::Header
*header
;
106 bool is_healthy() const;
107 bool is_readable() const;
108 std::vector
<std::string
> objects_valid
;
109 std::vector
<uint64_t> objects_missing
;
110 std::vector
<Range
> ranges_invalid
;
111 std::vector
<uint64_t> events_valid
;
114 // For events present in ::events (i.e. scanned successfully),
115 // any subsequent errors handling them (e.g. replaying)
120 // Forbid copy construction because I have ptr members
121 JournalScanner(const JournalScanner
&rhs
);
124 #endif // JOURNAL_SCANNER_H