// expose file layouts
-int Client::describe_layout(int fd, ceph_file_layout *lp)
+int Client::describe_layout(const char *relpath, ceph_file_layout *lp)
+{
+ Mutex::Locker lock(client_lock);
+
+ filepath path(relpath);
+ Inode *in;
+ int r = path_walk(path, &in);
+ if (r < 0)
+ return r;
+
+ *lp = in->layout;
+
+ ldout(cct, 3) << "describe_layout(" << relpath << ") = 0" << dendl;
+ return 0;
+}
+
+int Client::fdescribe_layout(int fd, ceph_file_layout *lp)
{
Mutex::Locker lock(client_lock);
*lp = in->layout;
- ldout(cct, 3) << "describe_layout(" << fd << ") = 0" << dendl;
+ ldout(cct, 3) << "fdescribe_layout(" << fd << ") = 0" << dendl;
return 0;
}
int lazyio_synchronize(int fd, loff_t offset, size_t count);
// expose file layout
- int describe_layout(int fd, ceph_file_layout* layout);
+ int describe_layout(const char *path, ceph_file_layout* layout);
+ int fdescribe_layout(int fd, ceph_file_layout* layout);
int get_file_stripe_address(int fd, loff_t offset, vector<entity_addr_t>& address);
int get_file_extent_osds(int fd, loff_t off, loff_t *len, vector<int>& osds);
int get_osd_addr(int osd, entity_addr_t& addr);
inode_t inode;
memset(&inode, 0, sizeof(inode));
inode.ino = st.st_ino;
- ret = client->describe_layout(fd, &inode.layout);
+ ret = client->fdescribe_layout(fd, &inode.layout);
if (ret < 0)
return ret;
if (!cmount->is_mounted())
return -ENOTCONN;
- r = cmount->get_client()->describe_layout(fh, &l);
+ r = cmount->get_client()->fdescribe_layout(fh, &l);
if (r < 0)
return r;
return l.fl_stripe_unit;
if (!cmount->is_mounted())
return -ENOTCONN;
- r = cmount->get_client()->describe_layout(fh, &l);
+ r = cmount->get_client()->fdescribe_layout(fh, &l);
if (r < 0)
return r;
return l.fl_pg_pool;
if (!cmount->is_mounted())
return -ENOTCONN;
- r = cmount->get_client()->describe_layout(fh, &l);
+ r = cmount->get_client()->fdescribe_layout(fh, &l);
if (r < 0)
return r;
string name = cmount->get_client()->get_pool_name(l.fl_pg_pool);
if (!cmount->is_mounted())
return -ENOTCONN;
- r = cmount->get_client()->describe_layout(fh, &l);
+ r = cmount->get_client()->fdescribe_layout(fh, &l);
if (r < 0)
return r;
int rep = cmount->get_client()->get_pool_replication(l.fl_pg_pool);