summaryrefslogtreecommitdiffstats
path: root/src/cls/cephfs/cls_cephfs.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
commit483eb2f56657e8e7f419ab1a4fab8dce9ade8609 (patch)
treee5d88d25d870d5dedacb6bbdbe2a966086a0a5cf /src/cls/cephfs/cls_cephfs.h
parentInitial commit. (diff)
downloadceph-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/cls/cephfs/cls_cephfs.h')
-rw-r--r--src/cls/cephfs/cls_cephfs.h147
1 files changed, 147 insertions, 0 deletions
diff --git a/src/cls/cephfs/cls_cephfs.h b/src/cls/cephfs/cls_cephfs.h
new file mode 100644
index 00000000..89f4dab4
--- /dev/null
+++ b/src/cls/cephfs/cls_cephfs.h
@@ -0,0 +1,147 @@
+// -*- 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) 2015 Red Hat
+ *
+ * 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.
+ *
+ */
+
+#include "include/encoding.h"
+
+/**
+ * Value class for the xattr we'll use to accumulate
+ * the highest object seen for a given inode
+ */
+class ObjCeiling {
+ public:
+ uint64_t id;
+ uint64_t size;
+
+ ObjCeiling()
+ : id(0), size(0)
+ {}
+
+ ObjCeiling(uint64_t id_, uint64_t size_)
+ : id(id_), size(size_)
+ {}
+
+ bool operator >(ObjCeiling const &rhs) const
+ {
+ return id > rhs.id;
+ }
+
+ void encode(bufferlist &bl) const
+ {
+ ENCODE_START(1, 1, bl);
+ encode(id, bl);
+ encode(size, bl);
+ ENCODE_FINISH(bl);
+ }
+
+ void decode(bufferlist::const_iterator &p)
+ {
+ DECODE_START(1, p);
+ decode(id, p);
+ decode(size, p);
+ DECODE_FINISH(p);
+ }
+};
+WRITE_CLASS_ENCODER(ObjCeiling)
+
+class AccumulateArgs
+{
+public:
+ uint64_t obj_index;
+ uint64_t obj_size;
+ int64_t mtime;
+ std::string obj_xattr_name;
+ std::string mtime_xattr_name;
+ std::string obj_size_xattr_name;
+
+ AccumulateArgs(
+ uint64_t obj_index_,
+ uint64_t obj_size_,
+ time_t mtime_,
+ const std::string &obj_xattr_name_,
+ const std::string &mtime_xattr_name_,
+ const std::string &obj_size_xattr_name_)
+ : obj_index(obj_index_),
+ obj_size(obj_size_),
+ mtime(mtime_),
+ obj_xattr_name(obj_xattr_name_),
+ mtime_xattr_name(mtime_xattr_name_),
+ obj_size_xattr_name(obj_size_xattr_name_)
+ {}
+
+ AccumulateArgs()
+ : obj_index(0), obj_size(0), mtime(0)
+ {}
+
+ void encode(bufferlist &bl) const
+ {
+ ENCODE_START(1, 1, bl);
+ encode(obj_xattr_name, bl);
+ encode(mtime_xattr_name, bl);
+ encode(obj_size_xattr_name, bl);
+ encode(obj_index, bl);
+ encode(obj_size, bl);
+ encode(mtime, bl);
+ ENCODE_FINISH(bl);
+ }
+
+ void decode(bufferlist::const_iterator &bl)
+ {
+ DECODE_START(1, bl);
+ decode(obj_xattr_name, bl);
+ decode(mtime_xattr_name, bl);
+ decode(obj_size_xattr_name, bl);
+ decode(obj_index, bl);
+ decode(obj_size, bl);
+ decode(mtime, bl);
+ DECODE_FINISH(bl);
+ }
+};
+
+class InodeTagFilterArgs
+{
+ public:
+ std::string scrub_tag;
+
+ void encode(bufferlist &bl) const
+ {
+ ENCODE_START(1, 1, bl);
+ encode(scrub_tag, bl);
+ ENCODE_FINISH(bl);
+ }
+
+ void decode(bufferlist::const_iterator &bl)
+ {
+ DECODE_START(1, bl);
+ decode(scrub_tag, bl);
+ DECODE_FINISH(bl);
+ }
+};
+
+class AccumulateResult
+{
+public:
+ // Index of the highest-indexed object seen
+ uint64_t ceiling_obj_index;
+ // Size of the highest-index object seen
+ uint64_t ceiling_obj_size;
+ // Largest object seen
+ uint64_t max_obj_size;
+ // Highest mtime seen
+ int64_t max_mtime;
+
+ AccumulateResult()
+ : ceiling_obj_index(0), ceiling_obj_size(0), max_obj_size(0), max_mtime(0)
+ {}
+};
+