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_GENERICFILESTOREBACKEDN_H
16 #define CEPH_GENERICFILESTOREBACKEDN_H
18 #include "FileStore.h"
22 class GenericFileStoreBackend
: public FileStoreBackend
{
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 bool m_journal_rotational
= true;
34 explicit GenericFileStoreBackend(FileStore
*fs
);
35 ~GenericFileStoreBackend() override
{}
37 const char *get_name() override
{
40 int detect_features() override
;
41 int create_current() override
;
42 bool can_checkpoint() override
{ return false; }
43 bool is_rotational() override
{
46 bool is_journal_rotational() override
{
47 return m_journal_rotational
;
49 int list_checkpoints(std::list
<std::string
>& ls
) override
{ return 0; }
50 int create_checkpoint(const std::string
& name
, uint64_t *cid
) override
{ return -EOPNOTSUPP
; }
51 int sync_checkpoint(uint64_t id
) override
{ return -EOPNOTSUPP
; }
52 int rollback_to(const std::string
& name
) override
{ return -EOPNOTSUPP
; }
53 int destroy_checkpoint(const std::string
& name
) override
{ return -EOPNOTSUPP
; }
54 int syncfs() override
;
55 bool has_fiemap() override
{ return ioctl_fiemap
; }
56 bool has_seek_data_hole() override
{ return seek_data_hole
; }
57 int do_fiemap(int fd
, off_t start
, size_t len
, struct fiemap
**pfiemap
) override
;
58 int clone_range(int from
, int to
, uint64_t srcoff
, uint64_t len
, uint64_t dstoff
) override
{
59 return _copy_range(from
, to
, srcoff
, len
, dstoff
);
61 int set_alloc_hint(int fd
, uint64_t hint
) override
{ return -EOPNOTSUPP
; }
62 bool has_splice() const override
{ return use_splice
; }
64 int _crc_load_or_init(int fd
, SloppyCRCMap
*cm
);
65 int _crc_save(int fd
, SloppyCRCMap
*cm
);
67 int _crc_update_write(int fd
, loff_t off
, size_t len
, const ceph::buffer::list
& bl
) override
;
68 int _crc_update_truncate(int fd
, loff_t off
) override
;
69 int _crc_update_zero(int fd
, loff_t off
, size_t len
) override
;
70 int _crc_update_clone_range(int srcfd
, int destfd
,
71 loff_t srcoff
, size_t len
, loff_t dstoff
) override
;
72 int _crc_verify_read(int fd
, loff_t off
, size_t len
, const ceph::buffer::list
& bl
,
73 std::ostream
*out
) override
;