Commit 33d4909c authored by Sage Weil's avatar Sage Weil

ceph: allow preferred osd to be get/set via layout ioctl

There is certainly no reason not to report this.

The only real downside to allowing the user to set it is that you don't
get default values by zeroing the layout struct (the default is -1).
Signed-off-by: default avatarSage Weil <sage@newdream.net>
parent 1d1de916
...@@ -24,6 +24,8 @@ static long ceph_ioctl_get_layout(struct file *file, void __user *arg) ...@@ -24,6 +24,8 @@ static long ceph_ioctl_get_layout(struct file *file, void __user *arg)
l.stripe_count = ceph_file_layout_stripe_count(ci->i_layout); l.stripe_count = ceph_file_layout_stripe_count(ci->i_layout);
l.object_size = ceph_file_layout_object_size(ci->i_layout); l.object_size = ceph_file_layout_object_size(ci->i_layout);
l.data_pool = le32_to_cpu(ci->i_layout.fl_pg_pool); l.data_pool = le32_to_cpu(ci->i_layout.fl_pg_pool);
l.preferred_osd =
(s32)le32_to_cpu(ci->i_layout.fl_pg_preferred);
if (copy_to_user(arg, &l, sizeof(l))) if (copy_to_user(arg, &l, sizeof(l)))
return -EFAULT; return -EFAULT;
} }
...@@ -79,7 +81,8 @@ static long ceph_ioctl_set_layout(struct file *file, void __user *arg) ...@@ -79,7 +81,8 @@ static long ceph_ioctl_set_layout(struct file *file, void __user *arg)
req->r_args.setlayout.layout.fl_object_size = req->r_args.setlayout.layout.fl_object_size =
cpu_to_le32(l.object_size); cpu_to_le32(l.object_size);
req->r_args.setlayout.layout.fl_pg_pool = cpu_to_le32(l.data_pool); req->r_args.setlayout.layout.fl_pg_pool = cpu_to_le32(l.data_pool);
req->r_args.setlayout.layout.fl_pg_preferred = cpu_to_le32((s32)-1); req->r_args.setlayout.layout.fl_pg_preferred =
cpu_to_le32(l.preferred_osd);
err = ceph_mdsc_do_request(mdsc, parent_inode, req); err = ceph_mdsc_do_request(mdsc, parent_inode, req);
ceph_mdsc_put_request(req); ceph_mdsc_put_request(req);
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
struct ceph_ioctl_layout { struct ceph_ioctl_layout {
__u64 stripe_unit, stripe_count, object_size; __u64 stripe_unit, stripe_count, object_size;
__u64 data_pool; __u64 data_pool;
__s64 preferred_osd;
}; };
#define CEPH_IOC_GET_LAYOUT _IOR(CEPH_IOCTL_MAGIC, 1, \ #define CEPH_IOC_GET_LAYOUT _IOR(CEPH_IOCTL_MAGIC, 1, \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment