Skip to content

Commit 33d4909

Browse files
committed
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: Sage Weil <sage@newdream.net>
1 parent 1d1de91 commit 33d4909

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

‎fs/ceph/ioctl.c‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ static long ceph_ioctl_get_layout(struct file *file, void __user *arg)
2424
l.stripe_count = ceph_file_layout_stripe_count(ci->i_layout);
2525
l.object_size = ceph_file_layout_object_size(ci->i_layout);
2626
l.data_pool = le32_to_cpu(ci->i_layout.fl_pg_pool);
27+
l.preferred_osd =
28+
(s32)le32_to_cpu(ci->i_layout.fl_pg_preferred);
2729
if (copy_to_user(arg, &l, sizeof(l)))
2830
return -EFAULT;
2931
}
@@ -79,7 +81,8 @@ static long ceph_ioctl_set_layout(struct file *file, void __user *arg)
7981
req->r_args.setlayout.layout.fl_object_size =
8082
cpu_to_le32(l.object_size);
8183
req->r_args.setlayout.layout.fl_pg_pool = cpu_to_le32(l.data_pool);
82-
req->r_args.setlayout.layout.fl_pg_preferred = cpu_to_le32((s32)-1);
84+
req->r_args.setlayout.layout.fl_pg_preferred =
85+
cpu_to_le32(l.preferred_osd);
8386

8487
err = ceph_mdsc_do_request(mdsc, parent_inode, req);
8588
ceph_mdsc_put_request(req);

‎fs/ceph/ioctl.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
struct ceph_ioctl_layout {
1111
__u64 stripe_unit, stripe_count, object_size;
1212
__u64 data_pool;
13+
__s64 preferred_osd;
1314
};
1415

1516
#define CEPH_IOC_GET_LAYOUT _IOR(CEPH_IOCTL_MAGIC, 1, \

0 commit comments

Comments
 (0)