]> git.proxmox.com Git - ceph.git/blob - ceph/src/tools/cephfs/PgFiles.h
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / tools / cephfs / PgFiles.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
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 #ifndef PG_EFFECTS_H_
16 #define PG_EFFECTS_H_
17
18 #include "include/cephfs/libcephfs.h"
19 #include "osd/osd_types.h"
20 #include <set>
21 #include "osdc/Objecter.h"
22
23 /**
24 * This utility scans the files (via an online MDS) and works out
25 * which ones rely on named PGs. For use when someone has
26 * some bad/damaged PGs and wants to see which files might be
27 * affected.
28 */
29 class PgFiles
30 {
31 private:
32 Objecter *objecter;
33 struct ceph_mount_info *cmount;
34
35 std::set<pg_t> pgs;
36 std::set<uint64_t> pools;
37
38 void hit_file(std::string const &path, const struct ceph_statx &stx);
39 void hit_dir(std::string const &path);
40
41
42 public:
43 PgFiles(Objecter *o, std::set<pg_t> pgs_);
44 ~PgFiles();
45
46 int init();
47 int scan_path(std::string const &path);
48 };
49
50 #endif
51