]> git.proxmox.com Git - ceph.git/blob - ceph/src/os/filestore/GenericFileStoreBackend.h
8478067fa8fb86b72e13621e0bc29a60be359be3
[ceph.git] / ceph / src / os / filestore / GenericFileStoreBackend.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_GENERICFILESTOREBACKEDN_H
16 #define CEPH_GENERICFILESTOREBACKEDN_H
17
18 #include "FileStore.h"
19
20 class SloppyCRCMap;
21
22 class GenericFileStoreBackend : public FileStoreBackend {
23 private:
24 bool ioctl_fiemap;
25 bool seek_data_hole;
26 bool use_splice;
27 bool m_filestore_fiemap;
28 bool m_filestore_seek_data_hole;
29 bool m_filestore_fsync_flushes_journal_data;
30 bool m_filestore_splice;
31 bool m_rotational = true;
32 public:
33 explicit GenericFileStoreBackend(FileStore *fs);
34 ~GenericFileStoreBackend() override {}
35
36 const char *get_name() override {
37 return "generic";
38 }
39 int detect_features() override;
40 int create_current() override;
41 bool can_checkpoint() override { return false; }
42 bool is_rotational() override {
43 return m_rotational;
44 }
45 int list_checkpoints(list<string>& ls) override { return 0; }
46 int create_checkpoint(const string& name, uint64_t *cid) override { return -EOPNOTSUPP; }
47 int sync_checkpoint(uint64_t id) override { return -EOPNOTSUPP; }
48 int rollback_to(const string& name) override { return -EOPNOTSUPP; }
49 int destroy_checkpoint(const string& name) override { return -EOPNOTSUPP; }
50 int syncfs() override;
51 bool has_fiemap() override { return ioctl_fiemap; }
52 bool has_seek_data_hole() override { return seek_data_hole; }
53 int do_fiemap(int fd, off_t start, size_t len, struct fiemap **pfiemap) override;
54 int clone_range(int from, int to, uint64_t srcoff, uint64_t len, uint64_t dstoff) override {
55 return _copy_range(from, to, srcoff, len, dstoff);
56 }
57 int set_alloc_hint(int fd, uint64_t hint) override { return -EOPNOTSUPP; }
58 bool has_splice() const override { return use_splice; }
59 private:
60 int _crc_load_or_init(int fd, SloppyCRCMap *cm);
61 int _crc_save(int fd, SloppyCRCMap *cm);
62 public:
63 int _crc_update_write(int fd, loff_t off, size_t len, const bufferlist& bl) override;
64 int _crc_update_truncate(int fd, loff_t off) override;
65 int _crc_update_zero(int fd, loff_t off, size_t len) override;
66 int _crc_update_clone_range(int srcfd, int destfd,
67 loff_t srcoff, size_t len, loff_t dstoff) override;
68 int _crc_verify_read(int fd, loff_t off, size_t len, const bufferlist& bl,
69 ostream *out) override;
70 };
71 #endif