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) 2004-2006 Sage Weil <sage@newdream.net>
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.
15 #ifndef CEPH_MDS_EOPEN_H
16 #define CEPH_MDS_EOPEN_H
18 #include "../LogEvent.h"
19 #include "EMetaBlob.h"
21 class EOpen : public LogEvent {
24 vector<inodeno_t> inos;
25 vector<vinodeno_t> snap_inos;
27 EOpen() : LogEvent(EVENT_OPEN) { }
28 explicit EOpen(MDLog *mdlog) :
29 LogEvent(EVENT_OPEN), metablob(mdlog) { }
31 void print(ostream& out) const override {
32 out << "EOpen " << metablob << ", " << inos.size() << " open files";
35 EMetaBlob *get_metablob() override { return &metablob; }
37 void add_clean_inode(CInode *in) {
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());
44 snap_inos.push_back(in->vino());
47 void add_ino(inodeno_t ino) {
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);
56 void update_segment() override;
57 void replay(MDSRank *mds) override;
59 WRITE_CLASS_ENCODER_FEATURES(EOpen)