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
;
32 explicit GenericFileStoreBackend(FileStore
*fs
);
33 ~GenericFileStoreBackend() override
{}
35 const char *get_name() override
{
38 int detect_features() override
;
39 int create_current() override
;
40 bool can_checkpoint() override
{ return false; }
41 int list_checkpoints(list
<string
>& ls
) override
{ return 0; }
42 int create_checkpoint(const string
& name
, uint64_t *cid
) override
{ return -EOPNOTSUPP
; }
43 int sync_checkpoint(uint64_t id
) override
{ return -EOPNOTSUPP
; }
44 int rollback_to(const string
& name
) override
{ return -EOPNOTSUPP
; }
45 int destroy_checkpoint(const string
& name
) override
{ return -EOPNOTSUPP
; }
46 int syncfs() override
;
47 bool has_fiemap() override
{ return ioctl_fiemap
; }
48 bool has_seek_data_hole() override
{ return seek_data_hole
; }
49 int do_fiemap(int fd
, off_t start
, size_t len
, struct fiemap
**pfiemap
) override
;
50 int clone_range(int from
, int to
, uint64_t srcoff
, uint64_t len
, uint64_t dstoff
) override
{
51 return _copy_range(from
, to
, srcoff
, len
, dstoff
);
53 int set_alloc_hint(int fd
, uint64_t hint
) override
{ return -EOPNOTSUPP
; }
54 bool has_splice() const override
{ return use_splice
; }
56 int _crc_load_or_init(int fd
, SloppyCRCMap
*cm
);
57 int _crc_save(int fd
, SloppyCRCMap
*cm
);
59 int _crc_update_write(int fd
, loff_t off
, size_t len
, const bufferlist
& bl
) override
;
60 int _crc_update_truncate(int fd
, loff_t off
) override
;
61 int _crc_update_zero(int fd
, loff_t off
, size_t len
) override
;
62 int _crc_update_clone_range(int srcfd
, int destfd
,
63 loff_t srcoff
, size_t len
, loff_t dstoff
) override
;
64 int _crc_verify_read(int fd
, loff_t off
, size_t len
, const bufferlist
& bl
,
65 ostream
*out
) override
;