]> git.proxmox.com Git - ceph.git/blame - ceph/src/mds/LogSegment.h
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / mds / LogSegment.h
CommitLineData
7c673cae
FG
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_LOGSEGMENT_H
16#define CEPH_LOGSEGMENT_H
17
18#include "include/elist.h"
19#include "include/interval_set.h"
20#include "include/Context.h"
11fdf7f2 21#include "MDSContext.h"
7c673cae
FG
22#include "mdstypes.h"
23#include "CInode.h"
24#include "CDentry.h"
25#include "CDir.h"
7c673cae
FG
26
27#include "include/unordered_set.h"
28using ceph::unordered_set;
29
30class CDir;
31class CInode;
32class CDentry;
33class MDSRank;
34struct MDSlaveUpdate;
35
36typedef uint64_t log_segment_seq_t;
37
38class LogSegment {
39 public:
40 const log_segment_seq_t seq;
41 uint64_t offset, end;
42 int num_events;
43
44 // dirty items
45 elist<CDir*> dirty_dirfrags, new_dirfrags;
46 elist<CInode*> dirty_inodes;
47 elist<CDentry*> dirty_dentries;
48
49 elist<CInode*> open_files;
50 elist<CInode*> dirty_parent_inodes;
51 elist<CInode*> dirty_dirfrag_dir;
52 elist<CInode*> dirty_dirfrag_nest;
53 elist<CInode*> dirty_dirfrag_dirfragtree;
54
55 elist<MDSlaveUpdate*> slave_updates;
56
57 set<CInode*> truncating_inodes;
58
59 map<int, ceph::unordered_set<version_t> > pending_commit_tids; // mdstable
60 set<metareqid_t> uncommitted_masters;
61 set<dirfrag_t> uncommitted_fragments;
62
63 // client request ids
64 map<int, ceph_tid_t> last_client_tids;
65
66 // potentially dirty sessions
67 std::set<entity_name_t> touched_sessions;
68
69 // table version
70 version_t inotablev;
71 version_t sessionmapv;
72 map<int,version_t> tablev;
73
74 // try to expire
75 void try_to_expire(MDSRank *mds, MDSGatherBuilder &gather_bld, int op_prio);
76
11fdf7f2 77 MDSContext::vec expiry_waiters;
7c673cae 78
11fdf7f2 79 void wait_for_expiry(MDSContext *c)
7c673cae 80 {
11fdf7f2 81 ceph_assert(c != NULL);
7c673cae
FG
82 expiry_waiters.push_back(c);
83 }
84
85 // cons
86 LogSegment(uint64_t _seq, loff_t off=-1) :
87 seq(_seq), offset(off), end(off), num_events(0),
88 dirty_dirfrags(member_offset(CDir, item_dirty)),
89 new_dirfrags(member_offset(CDir, item_new)),
90 dirty_inodes(member_offset(CInode, item_dirty)),
91 dirty_dentries(member_offset(CDentry, item_dirty)),
92 open_files(member_offset(CInode, item_open_file)),
93 dirty_parent_inodes(member_offset(CInode, item_dirty_parent)),
94 dirty_dirfrag_dir(member_offset(CInode, item_dirty_dirfrag_dir)),
95 dirty_dirfrag_nest(member_offset(CInode, item_dirty_dirfrag_nest)),
96 dirty_dirfrag_dirfragtree(member_offset(CInode, item_dirty_dirfrag_dirfragtree)),
97 slave_updates(0), // passed to begin() manually
98 inotablev(0), sessionmapv(0)
99 { }
100};
101
102#endif