]> git.proxmox.com Git - ceph.git/blob - ceph/src/mds/events/EOpen.h
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / mds / events / EOpen.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) 2004-2006 Sage Weil <sage@newdream.net>
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 CEPH_MDS_EOPEN_H
16 #define CEPH_MDS_EOPEN_H
17
18 #include "../LogEvent.h"
19 #include "EMetaBlob.h"
20
21 class EOpen : public LogEvent {
22 public:
23 EMetaBlob metablob;
24 vector<inodeno_t> inos;
25 vector<vinodeno_t> snap_inos;
26
27 EOpen() : LogEvent(EVENT_OPEN) { }
28 explicit EOpen(MDLog *mdlog) :
29 LogEvent(EVENT_OPEN), metablob(mdlog) { }
30
31 void print(ostream& out) const override {
32 out << "EOpen " << metablob << ", " << inos.size() << " open files";
33 }
34
35 EMetaBlob *get_metablob() override { return &metablob; }
36
37 void add_clean_inode(CInode *in) {
38 if (!in->is_base()) {
39 metablob.add_dir_context(in->get_projected_parent_dn()->get_dir());
40 metablob.add_primary_dentry(in->get_projected_parent_dn(), 0, false);
41 if (in->last == CEPH_NOSNAP)
42 inos.push_back(in->ino());
43 else
44 snap_inos.push_back(in->vino());
45 }
46 }
47 void add_ino(inodeno_t ino) {
48 inos.push_back(ino);
49 }
50
51 void encode(bufferlist& bl, uint64_t features) const override;
52 void decode(bufferlist::iterator& bl) override;
53 void dump(Formatter *f) const override;
54 static void generate_test_instances(list<EOpen*>& ls);
55
56 void update_segment() override;
57 void replay(MDSRank *mds) override;
58 };
59 WRITE_CLASS_ENCODER_FEATURES(EOpen)
60
61 #endif