]>
git.proxmox.com Git - ceph.git/blob - ceph/src/os/FuseStore.cc
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 #include "include/compat.h"
6 #include "os/ObjectStore.h"
7 #include "include/stringify.h"
8 #include "common/errno.h"
10 #define FUSE_USE_VERSION 30
13 #include <sys/types.h>
16 #include <fcntl.h> /* Definition of AT_* constants */
19 #if defined(__APPLE__) || defined(__FreeBSD__)
20 #include <sys/param.h>
21 #include <sys/mount.h>
24 #define dout_context store->cct
25 #define dout_subsys ceph_subsys_fuse
26 #include "common/debug.h"
28 #define dout_prefix *_dout << "fuse "
30 // some fuse-y bits of state
32 struct fuse_args args
;
38 int FuseStore::open_file(string p
, struct fuse_file_info
*fi
,
39 std::function
<int(bufferlist
*bl
)> f
)
41 if (open_files
.count(p
)) {
42 OpenFile
*o
= open_files
[p
];
43 fi
->fh
= reinterpret_cast<uint64_t>(o
);
52 OpenFile
*o
= new OpenFile
;
56 fi
->fh
= reinterpret_cast<uint64_t>(o
);
61 FuseStore::FuseStore(ObjectStore
*s
, string p
)
69 FuseStore::~FuseStore()
77 * $cid/type - objectstore type
78 * $cid/bitwise_hash_start = lowest hash value
79 * $cid/bitwise_hash_end = highest hash value
80 * $cid/bitwise_hash_bits - how many bits are significant
81 * $cid/pgmeta/ - pgmeta object
82 * $cid/all/ - all objects
84 * $cid/all/$obj/bitwise_hash
86 * $cid/all/$obj/omap/$key
87 * $cid/all/$obj/attr/$name
88 * $cid/by_bitwise_hash/$hash/$bits/$obj - all objects with this (bitwise) hash (prefix)
100 FN_OBJECT_OMAP_HEADER
,
110 static int parse_fn(CephContext
* cct
, const char *path
, coll_t
*cid
,
111 ghobject_t
*oid
, string
*key
,
112 uint32_t *hash
, uint32_t *hash_bits
)
115 for (const char *p
= path
; *p
; ++p
) {
119 for (e
= p
+ 1; *e
&& *e
!= '/'; e
++) ;
126 ldout(cct
, 10) << __func__
<< " path " << path
<< " -> " << v
<< dendl
;
131 if (v
.front() == "type")
134 if (!cid
->parse(v
.front())) {
138 return FN_COLLECTION
;
141 if (v
.front() == "bitwise_hash_start")
142 return FN_HASH_START
;
143 if (v
.front() == "bitwise_hash_end")
145 if (v
.front() == "bitwise_hash_bits")
147 if (v
.front() == "pgmeta") {
149 if (cid
->is_pg(&pgid
)) {
150 *oid
= pgid
.make_pgmeta_oid();
158 if (v
.front() == "all") {
164 if (v
.front() == "by_bitwise_hash") {
168 unsigned long hv
, hm
;
169 int r
= sscanf(v
.front().c_str(), "%lx", &hv
);
172 int shift
= 32 - v
.front().length() * 4;
176 r
= sscanf(v
.front().c_str(), "%ld", &hm
);
179 if (hm
< 1 || hm
> 32)
182 *hash
= hv
<< shift
;//hobject_t::_reverse_bits(hv << shift);
192 string o
= v
.front();
193 if (!oid
->parse(o
)) {
202 if (v
.front() == "data")
203 return FN_OBJECT_DATA
;
204 if (v
.front() == "omap_header")
205 return FN_OBJECT_OMAP_HEADER
;
206 if (v
.front() == "omap") {
209 return FN_OBJECT_OMAP
;
213 return FN_OBJECT_OMAP_VAL
;
216 if (v
.front() == "attr") {
219 return FN_OBJECT_ATTR
;
223 return FN_OBJECT_ATTR_VAL
;
226 if (v
.front() == "bitwise_hash")
227 return FN_OBJECT_HASH
;
232 static int os_getattr(const char *path
, struct stat
*stbuf
)
234 fuse_context
*fc
= fuse_get_context();
235 FuseStore
*fs
= static_cast<FuseStore
*>(fc
->private_data
);
236 ldout(fs
->store
->cct
, 10) << __func__
<< " " << path
<< dendl
;
240 uint32_t hash_value
, hash_bits
;
241 int t
= parse_fn(fs
->store
->cct
, path
, &cid
, &oid
, &key
, &hash_value
,
246 std::lock_guard
<std::mutex
> l(fs
->lock
);
251 stbuf
->st_mode
= S_IFREG
| 0700;
253 auto ch
= fs
->store
->open_collection(cid
);
260 case FN_OBJECT_OMAP_HEADER
:
261 case FN_OBJECT_OMAP_VAL
:
264 if (cid
.is_pg(&pgid
)) {
268 int bits
= fs
->store
->collection_bits(ch
);
269 if (bits
>= 0 && !oid
.match(bits
, pgid
.ps())) {
270 // sorry, not part of this PG
282 if (!fs
->store
->exists(ch
, oid
))
289 if (!fs
->store
->collection_exists(cid
))
293 stbuf
->st_mode
= S_IFDIR
| 0700;
297 stbuf
->st_size
= fs
->store
->get_type().length() + 1;
301 if (!fs
->store
->exists(ch
, oid
))
309 if (fs
->store
->collection_bits(ch
) < 0)
320 int bits
= fs
->store
->collection_bits(ch
);
324 snprintf(buf
, sizeof(buf
), "%d\n", bits
);
325 stbuf
->st_size
= strlen(buf
);
331 if (!fs
->store
->exists(ch
, oid
))
333 int r
= fs
->store
->stat(ch
, oid
, stbuf
);
339 case FN_OBJECT_OMAP_HEADER
:
341 if (!fs
->store
->exists(ch
, oid
))
344 fs
->store
->omap_get_header(ch
, oid
, &bl
);
345 stbuf
->st_size
= bl
.length();
349 case FN_OBJECT_OMAP_VAL
:
351 if (!fs
->store
->exists(ch
, oid
))
355 map
<string
,bufferlist
> v
;
356 fs
->store
->omap_get_values(ch
, oid
, k
, &v
);
360 stbuf
->st_size
= v
[key
].length();
364 case FN_OBJECT_ATTR_VAL
:
366 if (!fs
->store
->exists(ch
, oid
))
369 int r
= fs
->store
->getattr(ch
, oid
, key
.c_str(), v
);
374 stbuf
->st_size
= v
.length();
385 static int os_readdir(const char *path
,
387 fuse_fill_dir_t filler
,
389 struct fuse_file_info
*fi
)
391 fuse_context
*fc
= fuse_get_context();
392 FuseStore
*fs
= static_cast<FuseStore
*>(fc
->private_data
);
393 ldout(fs
->store
->cct
, 10) << __func__
<< " " << path
<< " offset " << offset
398 uint32_t hash_value
, hash_bits
;
399 int t
= parse_fn(fs
->store
->cct
, path
, &cid
, &oid
, &key
, &hash_value
,
404 std::lock_guard
<std::mutex
> l(fs
->lock
);
406 auto ch
= fs
->store
->open_collection(cid
);
408 // we can't shift 32 bits or else off_t will go negative
409 const int hash_shift
= 31;
414 filler(buf
, "type", NULL
, 0);
416 fs
->store
->list_collections(cls
);
418 int r
= filler(buf
, stringify(c
).c_str(), NULL
, 0);
430 filler(buf
, "bitwise_hash_start", NULL
, 0);
431 if (fs
->store
->collection_bits(ch
) >= 0) {
432 filler(buf
, "bitwise_hash_end", NULL
, 0);
433 filler(buf
, "bitwise_hash_bits", NULL
, 0);
435 filler(buf
, "all", NULL
, 0);
436 filler(buf
, "by_bitwise_hash", NULL
, 0);
438 if (cid
.is_pg(&pgid
) &&
439 fs
->store
->exists(ch
, pgid
.make_pgmeta_oid())) {
440 filler(buf
, "pgmeta", NULL
, 0);
447 filler(buf
, "bitwise_hash", NULL
, 0);
448 filler(buf
, "data", NULL
, 0);
449 filler(buf
, "omap", NULL
, 0);
450 filler(buf
, "attr", NULL
, 0);
451 filler(buf
, "omap_header", NULL
, 0);
458 uint32_t bitwise_hash
= (offset
>> hash_shift
) & 0xffffffff;
459 uint32_t hashoff
= offset
- (bitwise_hash
<< hash_shift
);
461 ghobject_t next
= cid
.get_min_hobj();
464 next
.hobj
.set_hash(hobject_t::_reverse_bits(bitwise_hash
));
465 } else if (t
== FN_HASH_VAL
) {
466 next
.hobj
.set_hash(hobject_t::_reverse_bits(hash_value
));
469 if (t
== FN_HASH_VAL
) {
471 uint64_t rev_end
= (hash_value
| (0xffffffff >> hash_bits
)) + 1;
472 if (rev_end
>= 0x100000000)
473 last
= ghobject_t::get_max();
475 last
.hobj
.set_hash(hobject_t::_reverse_bits(rev_end
));
477 last
= ghobject_t::get_max();
479 ldout(fs
->store
->cct
, 10) << __func__
<< std::hex
480 << " offset " << offset
<< " hash "
481 << hobject_t::_reverse_bits(hash_value
)
484 << " first " << next
<< " last " << last
487 vector
<ghobject_t
> ls
;
488 int r
= fs
->store
->collection_list(
489 ch
, next
, last
, 1000, &ls
, &next
);
497 uint32_t cur_bitwise_hash
= p
.hobj
.get_bitwise_key_u32();
498 if (cur_bitwise_hash
!= bitwise_hash
) {
499 bitwise_hash
= cur_bitwise_hash
;
503 uint64_t cur_off
= ((uint64_t)bitwise_hash
<< hash_shift
) |
505 string s
= stringify(p
);
506 r
= filler(buf
, s
.c_str(), NULL
, cur_off
);
512 if (next
== ghobject_t::get_max() || next
== last
)
521 fs
->store
->omap_get_keys(ch
, oid
, &keys
);
522 unsigned skip
= offset
;
523 for (auto k
: keys
) {
529 int r
= filler(buf
, k
.c_str(), NULL
, offset
);
538 map
<string
,bufferptr
> aset
;
539 fs
->store
->getattrs(ch
, oid
, aset
);
540 unsigned skip
= offset
;
541 for (auto a
: aset
) {
547 int r
= filler(buf
, a
.first
.c_str(), NULL
, offset
);
557 static int os_open(const char *path
, struct fuse_file_info
*fi
)
559 fuse_context
*fc
= fuse_get_context();
560 FuseStore
*fs
= static_cast<FuseStore
*>(fc
->private_data
);
561 ldout(fs
->store
->cct
, 10) << __func__
<< " " << path
<< dendl
;
565 uint32_t hash_value
, hash_bits
;
566 int t
= parse_fn(fs
->store
->cct
, path
, &cid
, &oid
, &key
, &hash_value
,
571 std::lock_guard
<std::mutex
> l(fs
->lock
);
573 auto ch
= fs
->store
->open_collection(cid
);
578 pbl
= new bufferlist
;
579 pbl
->append(fs
->store
->get_type());
585 pbl
= new bufferlist
;
587 if (cid
.is_pg(&pgid
)) {
589 h
= hobject_t::_reverse_bits(pgid
.ps());
591 snprintf(buf
, sizeof(buf
), "%08lx\n", h
);
594 pbl
->append("00000000\n");
606 if (cid
.is_pg(&pgid
)) {
607 int hash_bits
= fs
->store
->collection_bits(ch
);
608 if (hash_bits
>= 0) {
609 uint64_t rev_start
= hobject_t::_reverse_bits(pgid
.ps());
610 uint64_t rev_end
= (rev_start
| (0xffffffff >> hash_bits
));
619 snprintf(buf
, sizeof(buf
), "%08lx\n", h
);
620 pbl
= new bufferlist
;
630 int r
= fs
->store
->collection_bits(ch
);
634 snprintf(buf
, sizeof(buf
), "%d\n", r
);
635 pbl
= new bufferlist
;
642 pbl
= new bufferlist
;
644 snprintf(buf
, sizeof(buf
), "%08x\n",
645 (unsigned)oid
.hobj
.get_bitwise_key_u32());
652 int r
= fs
->open_file(
654 [&](bufferlist
*pbl
) {
655 return fs
->store
->read(ch
, oid
, 0, 0, *pbl
);
663 case FN_OBJECT_ATTR_VAL
:
665 int r
= fs
->open_file(
667 [&](bufferlist
*pbl
) {
669 int r
= fs
->store
->getattr(ch
, oid
, key
.c_str(), bp
);
680 case FN_OBJECT_OMAP_VAL
:
682 int r
= fs
->open_file(
684 [&](bufferlist
*pbl
) {
687 map
<string
,bufferlist
> v
;
688 int r
= fs
->store
->omap_get_values(ch
, oid
, k
, &v
);
699 case FN_OBJECT_OMAP_HEADER
:
701 int r
= fs
->open_file(
703 [&](bufferlist
*pbl
) {
704 return fs
->store
->omap_get_header(ch
, oid
, pbl
);
713 FuseStore::OpenFile
*o
= new FuseStore::OpenFile
;
715 fi
->fh
= reinterpret_cast<uint64_t>(o
);
720 static int os_mkdir(const char *path
, mode_t mode
)
722 fuse_context
*fc
= fuse_get_context();
723 FuseStore
*fs
= static_cast<FuseStore
*>(fc
->private_data
);
724 ldout(fs
->store
->cct
, 10) << __func__
<< " " << path
<< dendl
;
728 uint32_t hash_value
, hash_bits
;
729 int f
= parse_fn(fs
->store
->cct
, path
, &cid
, &oid
, &key
, &hash_value
,
734 std::lock_guard
<std::mutex
> l(fs
->lock
);
736 ObjectStore::CollectionHandle ch
;
738 ObjectStore::Transaction t
;
742 ch
= fs
->store
->open_collection(cid
);
747 if (cid
.is_pg(&pgid
)) {
748 int bits
= fs
->store
->collection_bits(ch
);
749 if (bits
>= 0 && !oid
.match(bits
, pgid
.ps())) {
750 // sorry, not part of this PG
755 ch
= fs
->store
->open_collection(cid
);
761 // use the mode for the bit count. e.g., mkdir --mode=0003
762 // mnt/0.7_head will create 0.7 with bits = 3.
769 t
.create_collection(cid
, mode
);
770 ch
= fs
->store
->create_new_collection(cid
);
778 fs
->store
->queue_transaction(ch
, std::move(t
));
784 static int os_chmod(const char *path
, mode_t mode
)
786 fuse_context
*fc
= fuse_get_context();
787 FuseStore
*fs
= static_cast<FuseStore
*>(fc
->private_data
);
788 ldout(fs
->store
->cct
, 10) << __func__
<< " " << path
<< dendl
;
792 static int os_create(const char *path
, mode_t mode
, struct fuse_file_info
*fi
)
794 fuse_context
*fc
= fuse_get_context();
795 FuseStore
*fs
= static_cast<FuseStore
*>(fc
->private_data
);
796 ldout(fs
->store
->cct
, 10) << __func__
<< " " << path
<< dendl
;
800 uint32_t hash_value
, hash_bits
;
801 int f
= parse_fn(fs
->store
->cct
, path
, &cid
, &oid
, &key
, &hash_value
,
806 std::lock_guard
<std::mutex
> l(fs
->lock
);
808 ObjectStore::CollectionHandle ch
= fs
->store
->open_collection(cid
);
810 ObjectStore::Transaction t
;
815 pbl
= new bufferlist
;
816 fs
->store
->read(ch
, oid
, 0, 0, *pbl
);
820 case FN_OBJECT_ATTR_VAL
:
822 pbl
= new bufferlist
;
824 int r
= fs
->store
->getattr(ch
, oid
, key
.c_str(), bp
);
827 t
.setattr(cid
, oid
, key
.c_str(), empty
);
833 case FN_OBJECT_OMAP_VAL
:
835 pbl
= new bufferlist
;
838 map
<string
,bufferlist
> v
;
839 fs
->store
->omap_get_values(ch
, oid
, k
, &v
);
840 if (v
.count(key
) == 0) {
841 map
<string
,bufferlist
> aset
;
842 aset
[key
] = bufferlist();
843 t
.omap_setkeys(cid
, oid
, aset
);
852 fs
->store
->queue_transaction(ch
, std::move(t
));
856 FuseStore::OpenFile
*o
= new FuseStore::OpenFile
;
859 fi
->fh
= reinterpret_cast<uint64_t>(o
);
864 static int os_release(const char *path
, struct fuse_file_info
*fi
)
866 fuse_context
*fc
= fuse_get_context();
867 FuseStore
*fs
= static_cast<FuseStore
*>(fc
->private_data
);
868 ldout(fs
->store
->cct
, 10) << __func__
<< " " << path
<< dendl
;
869 std::lock_guard
<std::mutex
> l(fs
->lock
);
870 FuseStore::OpenFile
*o
= reinterpret_cast<FuseStore::OpenFile
*>(fi
->fh
);
872 ldout(fs
->store
->cct
, 10) << __func__
<< " closing last " << o
->path
<< dendl
;
873 fs
->open_files
.erase(o
->path
);
879 static int os_read(const char *path
, char *buf
, size_t size
, off_t offset
,
880 struct fuse_file_info
*fi
)
882 fuse_context
*fc
= fuse_get_context();
883 FuseStore
*fs
= static_cast<FuseStore
*>(fc
->private_data
);
884 ldout(fs
->store
->cct
, 10) << __func__
<< " " << path
<< " offset " << offset
885 << " size " << size
<< dendl
;
886 std::lock_guard
<std::mutex
> l(fs
->lock
);
887 FuseStore::OpenFile
*o
= reinterpret_cast<FuseStore::OpenFile
*>(fi
->fh
);
890 if (offset
>= o
->bl
.length())
892 if (offset
+ size
> o
->bl
.length())
893 size
= o
->bl
.length() - offset
;
895 r
.substr_of(o
->bl
, offset
, size
);
896 memcpy(buf
, r
.c_str(), r
.length());
900 static int os_write(const char *path
, const char *buf
, size_t size
,
901 off_t offset
, struct fuse_file_info
*fi
)
903 fuse_context
*fc
= fuse_get_context();
904 FuseStore
*fs
= static_cast<FuseStore
*>(fc
->private_data
);
905 ldout(fs
->store
->cct
, 10) << __func__
<< " " << path
<< " offset " << offset
906 << " size " << size
<< dendl
;
907 std::lock_guard
<std::mutex
> l(fs
->lock
);
908 FuseStore::OpenFile
*o
= reinterpret_cast<FuseStore::OpenFile
*>(fi
->fh
);
914 if (offset
> o
->bl
.length()) {
915 final
.substr_of(o
->bl
, 0, offset
);
917 final
.claim_append(o
->bl
);
918 size_t zlen
= offset
- final
.length();
919 final
.append_zero(zlen
);
922 final
.append(buf
, size
);
923 if (offset
+ size
< o
->bl
.length()) {
925 rest
.substr_of(o
->bl
, offset
+ size
, o
->bl
.length() - offset
- size
);
926 final
.claim_append(rest
);
933 int os_flush(const char *path
, struct fuse_file_info
*fi
)
935 fuse_context
*fc
= fuse_get_context();
936 FuseStore
*fs
= static_cast<FuseStore
*>(fc
->private_data
);
937 ldout(fs
->store
->cct
, 10) << __func__
<< " " << path
<< dendl
;
941 uint32_t hash_value
, hash_bits
;
942 int f
= parse_fn(fs
->store
->cct
, path
, &cid
, &oid
, &key
, &hash_value
,
947 std::lock_guard
<std::mutex
> l(fs
->lock
);
949 FuseStore::OpenFile
*o
= reinterpret_cast<FuseStore::OpenFile
*>(fi
->fh
);
955 ObjectStore::CollectionHandle ch
= fs
->store
->open_collection(cid
);
957 ObjectStore::Transaction t
;
961 t
.write(cid
, oid
, 0, o
->bl
.length(), o
->bl
);
964 case FN_OBJECT_ATTR_VAL
:
965 t
.setattr(cid
, oid
, key
.c_str(), o
->bl
);
968 case FN_OBJECT_OMAP_VAL
:
970 map
<string
,bufferlist
> aset
;
972 t
.omap_setkeys(cid
, oid
, aset
);
976 case FN_OBJECT_OMAP_HEADER
:
977 t
.omap_setheader(cid
, oid
, o
->bl
);
984 fs
->store
->queue_transaction(ch
, std::move(t
));
989 static int os_unlink(const char *path
)
991 fuse_context
*fc
= fuse_get_context();
992 FuseStore
*fs
= static_cast<FuseStore
*>(fc
->private_data
);
993 ldout(fs
->store
->cct
, 10) << __func__
<< " " << path
<< dendl
;
997 uint32_t hash_value
, hash_bits
;
998 int f
= parse_fn(fs
->store
->cct
, path
, &cid
, &oid
, &key
, &hash_value
,
1003 std::lock_guard
<std::mutex
> l(fs
->lock
);
1005 ObjectStore::CollectionHandle ch
= fs
->store
->open_collection(cid
);
1006 ObjectStore::Transaction t
;
1009 case FN_OBJECT_OMAP_VAL
:
1011 t
.omap_rmkey(cid
, oid
, key
);
1015 case FN_OBJECT_ATTR_VAL
:
1016 t
.rmattr(cid
, oid
, key
.c_str());
1019 case FN_OBJECT_OMAP_HEADER
:
1022 t
.omap_setheader(cid
, oid
, empty
);
1033 int r
= fs
->store
->collection_empty(ch
, &empty
);
1038 t
.remove_collection(cid
);
1042 case FN_OBJECT_DATA
:
1043 t
.truncate(cid
, oid
, 0);
1050 fs
->store
->queue_transaction(ch
, std::move(t
));
1055 static int os_truncate(const char *path
, off_t size
)
1057 fuse_context
*fc
= fuse_get_context();
1058 FuseStore
*fs
= static_cast<FuseStore
*>(fc
->private_data
);
1059 ldout(fs
->store
->cct
, 10) << __func__
<< " " << path
<< " size " << size
<< dendl
;
1063 uint32_t hash_value
, hash_bits
;
1064 int f
= parse_fn(fs
->store
->cct
, path
, &cid
, &oid
, &key
, &hash_value
,
1069 if (f
== FN_OBJECT_OMAP_VAL
||
1070 f
== FN_OBJECT_ATTR_VAL
||
1071 f
== FN_OBJECT_OMAP_HEADER
) {
1076 if (f
!= FN_OBJECT_DATA
)
1079 std::lock_guard
<std::mutex
> l(fs
->lock
);
1081 if (fs
->open_files
.count(path
)) {
1082 FuseStore::OpenFile
*o
= fs
->open_files
[path
];
1083 if (o
->bl
.length() > size
) {
1085 t
.substr_of(o
->bl
, 0, size
);
1090 ObjectStore::CollectionHandle ch
= fs
->store
->open_collection(cid
);
1091 ObjectStore::Transaction t
;
1092 t
.truncate(cid
, oid
, size
);
1093 fs
->store
->queue_transaction(ch
, std::move(t
));
1097 static int os_statfs(const char *path
, struct statvfs
*stbuf
)
1099 fuse_context
*fc
= fuse_get_context();
1100 FuseStore
*fs
= static_cast<FuseStore
*>(fc
->private_data
);
1101 ldout(fs
->store
->cct
, 10) << __func__
<< " " << path
<< dendl
;
1102 std::lock_guard
<std::mutex
> l(fs
->lock
);
1104 struct store_statfs_t s
;
1105 int r
= fs
->store
->statfs(&s
);
1108 stbuf
->f_bsize
= 4096; // LIES!
1109 stbuf
->f_blocks
= s
.total
/ 4096;
1110 stbuf
->f_bavail
= s
.available
/ 4096;
1111 stbuf
->f_bfree
= stbuf
->f_bavail
;
1113 ldout(fs
->store
->cct
, 10) << __func__
<< " " << path
<< ": "
1114 << stbuf
->f_bavail
<< "/" << stbuf
->f_blocks
<< dendl
;
1118 static struct fuse_operations fs_oper
= {
1119 getattr
: os_getattr
,
1131 truncate
: os_truncate
,
1138 release
: os_release
,
1145 readdir
: os_readdir
,
1154 int FuseStore::main()
1158 mount_point
.c_str(),
1163 auto fuse_debug
= store
->cct
->_conf
.get_val
<bool>("fuse_debug");
1166 return fuse_main(c
, (char**)v
, &fs_oper
, (void*)this);
1169 int FuseStore::start()
1171 dout(10) << __func__
<< dendl
;
1173 memset(&info
->args
, 0, sizeof(info
->args
));
1176 mount_point
.c_str(),
1181 auto fuse_debug
= store
->cct
->_conf
.get_val
<bool>("fuse_debug");
1184 fuse_args a
= FUSE_ARGS_INIT(c
, (char**)v
);
1186 if (fuse_parse_cmdline(&info
->args
, &info
->mountpoint
, NULL
, NULL
) == -1) {
1187 derr
<< __func__
<< " failed to parse args" << dendl
;
1191 info
->ch
= fuse_mount(info
->mountpoint
, &info
->args
);
1193 derr
<< __func__
<< " fuse_mount failed" << dendl
;
1197 info
->f
= fuse_new(info
->ch
, &info
->args
, &fs_oper
, sizeof(fs_oper
),
1200 fuse_unmount(info
->mountpoint
, info
->ch
);
1201 derr
<< __func__
<< " fuse_new failed" << dendl
;
1205 fuse_thread
.create("fusestore");
1206 dout(10) << __func__
<< " done" << dendl
;
1210 int FuseStore::loop()
1212 dout(10) << __func__
<< " enter" << dendl
;
1213 int r
= fuse_loop(info
->f
);
1215 derr
<< __func__
<< " got " << cpp_strerror(r
) << dendl
;
1216 dout(10) << __func__
<< " exit" << dendl
;
1220 int FuseStore::stop()
1222 dout(10) << __func__
<< " enter" << dendl
;
1223 fuse_unmount(info
->mountpoint
, info
->ch
);
1225 fuse_destroy(info
->f
);
1226 dout(10) << __func__
<< " exit" << dendl
;