diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 18:24:20 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 18:24:20 +0000 |
commit | 483eb2f56657e8e7f419ab1a4fab8dce9ade8609 (patch) | |
tree | e5d88d25d870d5dedacb6bbdbe2a966086a0a5cf /src/mds/ScrubHeader.h | |
parent | Initial commit. (diff) | |
download | ceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.tar.xz ceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.zip |
Adding upstream version 14.2.21.upstream/14.2.21upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/mds/ScrubHeader.h')
-rw-r--r-- | src/mds/ScrubHeader.h | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/src/mds/ScrubHeader.h b/src/mds/ScrubHeader.h new file mode 100644 index 00000000..f49598d8 --- /dev/null +++ b/src/mds/ScrubHeader.h @@ -0,0 +1,68 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab +/* + * Ceph - scalable distributed file system + * + * Copyright (C) 2016 Red Hat Inc + * + * This is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software + * Foundation. See file COPYING. + * + */ + + +#ifndef SCRUB_HEADER_H_ +#define SCRUB_HEADER_H_ + +#include <string_view> + +class CInode; + +/** + * Externally input parameters for a scrub, associated with the root + * of where we are doing a recursive scrub + */ +class ScrubHeader { +public: + ScrubHeader(std::string_view tag_, bool is_tag_internal_, bool force_, + bool recursive_, bool repair_, Formatter *f_) + : tag(tag_), is_tag_internal(is_tag_internal_), force(force_), + recursive(recursive_), repair(repair_), formatter(f_), origin(nullptr) + { + ceph_assert(formatter != nullptr); + } + + // Set after construction because it won't be known until we've + // started resolving path and locking + void set_origin(CInode *origin_) { origin = origin_; } + + bool get_recursive() const { return recursive; } + bool get_repair() const { return repair; } + bool get_force() const { return force; } + bool is_internal_tag() const { return is_tag_internal; } + CInode *get_origin() const { return origin; } + std::string_view get_tag() const { return tag; } + Formatter &get_formatter() const { return *formatter; } + + bool get_repaired() const { return repaired; } + void set_repaired() { repaired = true; } + +protected: + const std::string tag; + bool is_tag_internal; + const bool force; + const bool recursive; + const bool repair; + Formatter * const formatter; + CInode *origin; + + bool repaired = false; // May be set during scrub if repairs happened +}; + +typedef std::shared_ptr<ScrubHeader> ScrubHeaderRef; +typedef std::shared_ptr<const ScrubHeader> ScrubHeaderRefConst; + +#endif // SCRUB_HEADER_H_ + |