summaryrefslogtreecommitdiffstats
path: root/src/librbd/object_map/ResizeRequest.h
blob: 5183940075a000447b13f9bc28a7ac91ccd940dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab

#ifndef CEPH_LIBRBD_OBJECT_MAP_RESIZE_REQUEST_H
#define CEPH_LIBRBD_OBJECT_MAP_RESIZE_REQUEST_H

#include "include/int_types.h"
#include "librbd/object_map/Request.h"
#include "common/bit_vector.hpp"

class Context;

namespace librbd {

class ImageCtx;

namespace object_map {

class ResizeRequest : public Request {
public:
  ResizeRequest(ImageCtx &image_ctx, ceph::BitVector<2> *object_map,
                uint64_t snap_id, uint64_t new_size,
      	  uint8_t default_object_state, Context *on_finish)
    : Request(image_ctx, snap_id, on_finish), m_object_map(object_map),
      m_num_objs(0), m_new_size(new_size),
      m_default_object_state(default_object_state)
  {
  }

  static void resize(ceph::BitVector<2> *object_map, uint64_t num_objs,
                     uint8_t default_state);

  void send() override;

protected:
  void finish_request() override;

private:
  ceph::BitVector<2> *m_object_map;
  uint64_t m_num_objs;
  uint64_t m_new_size;
  uint8_t m_default_object_state;
};

} // namespace object_map
} // namespace librbd

#endif // CEPH_LIBRBD_OBJECT_MAP_RESIZE_REQUEST_H