]>
git.proxmox.com Git - ceph.git/blob - ceph/src/mds/Anchor.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) 2018 Red Hat
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.
20 #include "include/types.h"
22 #include "include/buffer.h"
25 * Anchor represents primary linkage of an inode. When adding inode to an
26 * anchor table, MDS ensures that the table also contains inode's ancestor
27 * inodes. MDS can get inode's path by looking up anchor table recursively.
32 Anchor(inodeno_t i
, inodeno_t di
, std::string_view str
, __u8 tp
) :
33 ino(i
), dirino(di
), d_name(str
), d_type(tp
) {}
35 void encode(bufferlist
&bl
) const;
36 void decode(bufferlist::const_iterator
&bl
);
37 void dump(Formatter
*f
) const;
38 static void generate_test_instances(std::list
<Anchor
*>& ls
);
39 bool operator==(const Anchor
&r
) const {
40 return ino
== r
.ino
&& dirino
== r
.dirino
&&
41 d_name
== r
.d_name
&& d_type
== r
.d_type
&&
45 inodeno_t ino
; // anchored ino
49 std::set
<frag_t
> frags
;
51 int omap_idx
= -1; // stored in which omap object
53 WRITE_CLASS_ENCODER(Anchor
)
55 class RecoveredAnchor
: public Anchor
{
59 mds_rank_t auth
= MDS_RANK_NONE
; // auth hint
62 class OpenedAnchor
: public Anchor
{
64 OpenedAnchor(inodeno_t i
, inodeno_t di
, std::string_view str
, __u8 tp
, int nr
) :
65 Anchor(i
, di
, str
, tp
),
69 mutable int nref
= 0; // how many children
72 std::ostream
& operator<<(std::ostream
& out
, const Anchor
&a
);