]> git.proxmox.com Git - ceph.git/blob - ceph/src/mds/ScrubHeader.h
update sources to v12.2.5
[ceph.git] / ceph / src / mds / ScrubHeader.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
3 /*
4 * Ceph - scalable distributed file system
5 *
6 * Copyright (C) 2016 Red Hat Inc
7 *
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.
12 *
13 */
14
15
16 #ifndef SCRUB_HEADER_H_
17 #define SCRUB_HEADER_H_
18
19 #include <boost/utility/string_view.hpp>
20
21 class CInode;
22
23 /**
24 * Externally input parameters for a scrub, associated with the root
25 * of where we are doing a recursive scrub
26 */
27 class ScrubHeader {
28 public:
29 ScrubHeader(boost::string_view tag_, bool force_, bool recursive_,
30 bool repair_, Formatter *f_)
31 : tag(tag_), force(force_), recursive(recursive_), repair(repair_),
32 formatter(f_), origin(nullptr)
33 {
34 assert(formatter != nullptr);
35 }
36
37 // Set after construction because it won't be known until we've
38 // started resolving path and locking
39 void set_origin(CInode *origin_) { origin = origin_; }
40
41 bool get_recursive() const { return recursive; }
42 bool get_repair() const { return repair; }
43 bool get_force() const { return force; }
44 const CInode *get_origin() const { return origin; }
45 boost::string_view get_tag() const { return tag; }
46 Formatter &get_formatter() const { return *formatter; }
47
48 bool get_repaired() const { return repaired; }
49 void set_repaired() { repaired = true; }
50
51 protected:
52 const std::string tag;
53 const bool force;
54 const bool recursive;
55 const bool repair;
56 Formatter * const formatter;
57 CInode *origin;
58
59 bool repaired = false; // May be set during scrub if repairs happened
60 };
61
62 typedef ceph::shared_ptr<ScrubHeader> ScrubHeaderRef;
63 typedef ceph::shared_ptr<const ScrubHeader> ScrubHeaderRefConst;
64
65 #endif // SCRUB_HEADER_H_
66