// inode
assert(in);
f->inode = in;
- f->inode->get();
ldout(cct, 10) << "_create_fh " << in->ino << " mode " << cmode << dendl;
{
//ldout(cct, 3) << "op: client->close(open_files[ " << fh << " ]);" << dendl;
//ldout(cct, 3) << "op: open_files.erase( " << fh << " );" << dendl;
- Inode *in = f->inode;
+ Inode *in = f->inode.get();
ldout(cct, 5) << "_release_fh " << f << " mode " << f->mode << " on " << *in << dendl;
if (in->snapid == CEPH_NOSNAP) {
void Client::_put_fh(Fh *f)
{
int left = f->put();
- if (!left) {
- put_inode(f->inode);
+ if (!left)
delete f;
- }
}
int Client::_open(Inode *in, int flags, mode_t mode, Fh **fhp, int uid, int gid)
loff_t Client::_lseek(Fh *f, loff_t offset, int whence)
{
- Inode *in = f->inode;
+ Inode *in = f->inode.get();
int r;
switch (whence) {
int Client::_read(Fh *f, int64_t offset, uint64_t size, bufferlist *bl)
{
const md_config_t *conf = cct->_conf;
- Inode *in = f->inode;
+ Inode *in = f->inode.get();
//bool lazy = f->mode == CEPH_FILE_MODE_LAZY;
void Client::C_Readahead::finish(int r) {
lgeneric_subdout(client->cct, client, 20) << "client." << client->get_nodeid() << " " << "C_Readahead on " << f->inode << dendl;
- client->put_cap_ref(f->inode, CEPH_CAP_FILE_RD | CEPH_CAP_FILE_CACHE);
+ client->put_cap_ref(f->inode.get(), CEPH_CAP_FILE_RD | CEPH_CAP_FILE_CACHE);
f->readahead.dec_pending();
client->_put_fh(f);
}
int Client::_read_async(Fh *f, uint64_t off, uint64_t len, bufferlist *bl)
{
const md_config_t *conf = cct->_conf;
- Inode *in = f->inode;
+ Inode *in = f->inode.get();
ldout(cct, 10) << "_read_async " << *in << " " << off << "~" << len << dendl;
int Client::_read_sync(Fh *f, uint64_t off, uint64_t len, bufferlist *bl,
bool *checkeof)
{
- Inode *in = f->inode;
+ Inode *in = f->inode.get();
uint64_t pos = off;
int left = len;
int read = 0;
return -EFBIG;
//ldout(cct, 7) << "write fh " << fh << " size " << size << " offset " << offset << dendl;
- Inode *in = f->inode;
+ Inode *in = f->inode.get();
if (objecter->osdmap_pool_full(in->layout.fl_pg_pool)) {
return -ENOSPC;
int Client::_flush(Fh *f)
{
- Inode *in = f->inode;
+ Inode *in = f->inode.get();
int err = in->async_err;
if (err != 0) {
ldout(cct, 1) << __func__ << ": " << f << " on inode " << *in << " caught async_err = "
int Client::_fsync(Fh *f, bool syncdataonly)
{
ldout(cct, 3) << "_fsync(" << f << ", " << (syncdataonly ? "dataonly)":"data+metadata)") << dendl;
- return _fsync(f->inode, syncdataonly);
+ return _fsync(f->inode.get(), syncdataonly);
}
int Client::fstat(int fd, struct stat *stbuf)
if (!fh->fcntl_locks && !fh->flock_locks)
return;
- Inode *in = fh->inode;
+ Inode *in = fh->inode.get();
ldout(cct, 10) << "_release_filelocks " << fh << " ino " << in->ino << dendl;
list<pair<int, ceph_filelock> > to_release;
int Client::_getlk(Fh *fh, struct flock *fl, uint64_t owner)
{
- Inode *in = fh->inode;
+ Inode *in = fh->inode.get();
ldout(cct, 10) << "_getlk " << fh << " ino " << in->ino << dendl;
int ret = _do_filelock(in, fh, CEPH_LOCK_FCNTL, CEPH_MDS_OP_GETFILELOCK, 0, fl, owner);
return ret;
int Client::_setlk(Fh *fh, struct flock *fl, uint64_t owner, int sleep, void *fuse_req)
{
- Inode *in = fh->inode;
+ Inode *in = fh->inode.get();
ldout(cct, 10) << "_setlk " << fh << " ino " << in->ino << dendl;
int ret = _do_filelock(in, fh, CEPH_LOCK_FCNTL, CEPH_MDS_OP_SETFILELOCK, sleep, fl, owner, fuse_req);
ldout(cct, 10) << "_setlk " << fh << " ino " << in->ino << " result=" << ret << dendl;
int Client::_flock(Fh *fh, int cmd, uint64_t owner, void *fuse_req)
{
- Inode *in = fh->inode;
+ Inode *in = fh->inode.get();
ldout(cct, 10) << "_flock " << fh << " ino " << in->ino << dendl;
int sleep = !(cmd & LOCK_NB);
Fh *f = get_filehandle(fd);
if (!f)
return -EBADF;
- Inode *in = f->inode;
+ Inode *in = f->inode.get();
_fsync(f, true);
_release(in);
Fh *f = get_filehandle(fd);
if (!f)
return -EBADF;
- return Client::_getxattr(f->inode, name, value, size, getuid(), getgid());
+ return Client::_getxattr(f->inode.get(), name, value, size, getuid(), getgid());
}
int Client::listxattr(const char *path, char *list, size_t size)
Fh *f = get_filehandle(fd);
if (!f)
return -EBADF;
- return Client::_listxattr(f->inode, list, size, getuid(), getgid());
+ return Client::_listxattr(f->inode.get(), list, size, getuid(), getgid());
}
int Client::removexattr(const char *path, const char *name)
Fh *f = get_filehandle(fd);
if (!f)
return -EBADF;
- return Client::_removexattr(f->inode, name, getuid(), getgid());
+ return Client::_removexattr(f->inode.get(), name, getuid(), getgid());
}
int Client::setxattr(const char *path, const char *name, const void *value, size_t size, int flags)
Fh *f = get_filehandle(fd);
if (!f)
return -EBADF;
- return Client::_setxattr(f->inode, name, value, size, flags, getuid(), getgid());
+ return Client::_setxattr(f->inode.get(), name, value, size, flags, getuid(), getgid());
}
int Client::_getxattr(Inode *in, const char *name, void *value, size_t size,
return 0;
}
+int Client::ll_file_layout(Fh *fh, ceph_file_layout *layout)
+{
+ return ll_file_layout(fh->inode.get(), layout);
+}
+
/* Currently we cannot take advantage of redundancy in reads, since we
would have to go through all possible placement groups (a
potentially quite large number determined by a hash), and use CRUSH
if ((mode & FALLOC_FL_PUNCH_HOLE) && !(mode & FALLOC_FL_KEEP_SIZE))
return -EOPNOTSUPP;
- Inode *in = fh->inode;
+ Inode *in = fh->inode.get();
if (objecter->osdmap_pool_full(in->layout.fl_pg_pool)
&& !(mode & FALLOC_FL_PUNCH_HOLE)) {
Fh *f = get_filehandle(fd);
if (!f)
return -EBADF;
- Inode *in = f->inode;
+ Inode *in = f->inode.get();
*lp = in->layout;
Fh *f = get_filehandle(fd);
if (!f)
return -EBADF;
- Inode *in = f->inode;
+ Inode *in = f->inode.get();
vector<ObjectExtent> extents;
Striper::file_to_extents(cct, in->ino, &in->layout, off, 1, in->truncate_size, extents);
Fh *f = get_filehandle(fd);
if (!f)
return -EBADF;
- Inode *in = f->inode;
+ Inode *in = f->inode.get();
// which object?
vector<ObjectExtent> extents;
Fh *f = get_filehandle(fd);
if (!f)
return -EBADF;
- Inode *in = f->inode;
+ Inode *in = f->inode.get();
// map to a list of extents
Striper::file_to_extents(cct, in->ino, &in->layout, offset, length, in->truncate_size, result);