]> git.proxmox.com Git - ceph.git/blame - ceph/src/client/ObjecterWriteback.h
import quincy beta 17.1.0
[ceph.git] / ceph / src / client / ObjecterWriteback.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#ifndef CEPH_OSDC_OBJECTERWRITEBACKHANDLER_H
4#define CEPH_OSDC_OBJECTERWRITEBACKHANDLER_H
5
6#include "osdc/Objecter.h"
7#include "osdc/WritebackHandler.h"
8
9class ObjecterWriteback : public WritebackHandler {
10 public:
9f95a23c 11 ObjecterWriteback(Objecter *o, Finisher *fin, ceph::mutex *lock)
7c673cae
FG
12 : m_objecter(o),
13 m_finisher(fin),
14 m_lock(lock) { }
15 ~ObjecterWriteback() override {}
16
17 void read(const object_t& oid, uint64_t object_no,
18 const object_locator_t& oloc, uint64_t off, uint64_t len,
19 snapid_t snapid, bufferlist *pbl, uint64_t trunc_size,
31f18b77
FG
20 __u32 trunc_seq, int op_flags,
21 const ZTracer::Trace &parent_trace,
22 Context *onfinish) override {
7c673cae
FG
23 m_objecter->read_trunc(oid, oloc, off, len, snapid, pbl, 0,
24 trunc_size, trunc_seq,
25 new C_OnFinisher(new C_Lock(m_lock, onfinish),
26 m_finisher));
27 }
28
29 bool may_copy_on_write(const object_t& oid, uint64_t read_off,
30 uint64_t read_len, snapid_t snapid) override {
31 return false;
32 }
33
34 ceph_tid_t write(const object_t& oid, const object_locator_t& oloc,
35 uint64_t off, uint64_t len,
36 const SnapContext& snapc, const bufferlist &bl,
37 ceph::real_time mtime, uint64_t trunc_size,
38 __u32 trunc_seq, ceph_tid_t journal_tid,
31f18b77 39 const ZTracer::Trace &parent_trace,
7c673cae
FG
40 Context *oncommit) override {
41 return m_objecter->write_trunc(oid, oloc, off, len, snapc, bl, mtime, 0,
42 trunc_size, trunc_seq,
43 new C_OnFinisher(new C_Lock(m_lock,
44 oncommit),
45 m_finisher));
46 }
47
48 bool can_scattered_write() override { return true; }
49 using WritebackHandler::write;
50 ceph_tid_t write(const object_t& oid, const object_locator_t& oloc,
20effc67 51 std::vector<std::pair<uint64_t, bufferlist> >& io_vec,
7c673cae
FG
52 const SnapContext& snapc, ceph::real_time mtime,
53 uint64_t trunc_size, __u32 trunc_seq,
54 Context *oncommit) override {
55 ObjectOperation op;
20effc67
TL
56 for (auto& [offset, bl] : io_vec)
57 op.write(offset, bl, trunc_size, trunc_seq);
7c673cae
FG
58
59 return m_objecter->mutate(oid, oloc, op, snapc, mtime, 0,
60 new C_OnFinisher(new C_Lock(m_lock, oncommit),
61 m_finisher));
62 }
63
64 private:
65 Objecter *m_objecter;
66 Finisher *m_finisher;
9f95a23c 67 ceph::mutex *m_lock;
7c673cae
FG
68};
69
70#endif