OPTION(newstore_nid_prealloc, OPT_INT, 1024)
OPTION(newstore_overlay_max_length, OPT_INT, 65536)
OPTION(newstore_overlay_max, OPT_INT, 32)
+OPTION(newstore_open_by_handle, OPT_BOOL, true)
OPTION(filestore_omap_backend, OPT_STR, "leveldb")
- DBObjectMap::clone lock ordering
- HashIndex::get_path_contents_by_hash
- HashIndex::list_by_hash
- * open-by-handle
* use work queue for wal fsyncs and kv record removals
* avoid mtime updates when doing open-by-handle
* abstract out fs specifics
int NewStore::_open_fid(fid_t fid)
{
+ if (fid.handle.length() && g_conf->newstore_open_by_handle) {
+ int fd = fs->open_handle(path_fd, fid.handle, O_RDWR);
+ if (fd >= 0) {
+ dout(30) << __func__ << " " << fid << " = " << fd
+ << " (open by handle)" << dendl;
+ return fd;
+ }
+ int err = -errno;
+ dout(30) << __func__ << " " << fid << " = " << cpp_strerror(err)
+ << " (with open by handle, falling back to file name)" << dendl;
+ }
+
char fn[32];
snprintf(fn, sizeof(fn), "%u/%u", fid.fset, fid.fno);
int fd = ::openat(frag_fd, fn, O_RDWR);
return r;
}
-#if 0
- // store a handle, too
- void *hp;
- size_t hlen;
- int r = fd_to_handle(fd, &hp, &hlen);
- if (r >= 0) {
- fid->handle = string((char *)hp, hlen);
+ if (g_conf->newstore_open_by_handle) {
+ int r = fs->get_handle(fd, &fid->handle);
+ if (r < 0) {
+ dout(30) << __func__ << " get_handle got " << cpp_strerror(r) << dendl;
+ } else {
+ dout(30) << __func__ << " got handle: ";
+ bufferlist bl;
+ bl.append(fid->handle);
+ bl.hexdump(*_dout);
+ *_dout << dendl;
+ }
}
-#endif
dout(30) << __func__ << " " << *fid << " = " << fd << dendl;
return fd;