diff options
author | Sage Weil <sage@inktank.com> | 2012-05-14 15:34:38 -0400 |
---|---|---|
committer | Alex Elder <elder@dreamhost.com> | 2012-05-16 15:28:27 -0400 |
commit | 702aeb1f88e707241d76e1e2a1a02dd81e6c2d77 (patch) | |
tree | 1d605a2109700d5ba4cc6c95f253e6ee3e10a120 /fs/ceph | |
parent | fd51653f78cf40a0516e521b6de22f329c5bad8d (diff) |
ceph: fully initialize new layout
When we are setting a new layout, fully initialize the structure:
- zero it out
- always set preferred_osd to -1
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Alex Elder <elder@inktank.com>
Diffstat (limited to 'fs/ceph')
-rw-r--r-- | fs/ceph/ioctl.c | 19 | ||||
-rw-r--r-- | fs/ceph/ioctl.h | 2 |
2 files changed, 15 insertions, 6 deletions
diff --git a/fs/ceph/ioctl.c b/fs/ceph/ioctl.c index 0e2f021109ee..c0b7314b90f9 100644 --- a/fs/ceph/ioctl.c +++ b/fs/ceph/ioctl.c | |||
@@ -80,22 +80,29 @@ static long ceph_ioctl_set_layout(struct file *file, void __user *arg) | |||
80 | 80 | ||
81 | /* validate changed params against current layout */ | 81 | /* validate changed params against current layout */ |
82 | err = ceph_do_getattr(file->f_dentry->d_inode, CEPH_STAT_CAP_LAYOUT); | 82 | err = ceph_do_getattr(file->f_dentry->d_inode, CEPH_STAT_CAP_LAYOUT); |
83 | if (!err) { | 83 | if (err) |
84 | nl.stripe_unit = ceph_file_layout_su(ci->i_layout); | ||
85 | nl.stripe_count = ceph_file_layout_stripe_count(ci->i_layout); | ||
86 | nl.object_size = ceph_file_layout_object_size(ci->i_layout); | ||
87 | nl.data_pool = le32_to_cpu(ci->i_layout.fl_pg_pool); | ||
88 | } else | ||
89 | return err; | 84 | return err; |
90 | 85 | ||
86 | memset(&nl, 0, sizeof(nl)); | ||
91 | if (l.stripe_count) | 87 | if (l.stripe_count) |
92 | nl.stripe_count = l.stripe_count; | 88 | nl.stripe_count = l.stripe_count; |
89 | else | ||
90 | nl.stripe_count = ceph_file_layout_stripe_count(ci->i_layout); | ||
93 | if (l.stripe_unit) | 91 | if (l.stripe_unit) |
94 | nl.stripe_unit = l.stripe_unit; | 92 | nl.stripe_unit = l.stripe_unit; |
93 | else | ||
94 | nl.stripe_unit = ceph_file_layout_su(ci->i_layout); | ||
95 | if (l.object_size) | 95 | if (l.object_size) |
96 | nl.object_size = l.object_size; | 96 | nl.object_size = l.object_size; |
97 | else | ||
98 | nl.object_size = ceph_file_layout_object_size(ci->i_layout); | ||
97 | if (l.data_pool) | 99 | if (l.data_pool) |
98 | nl.data_pool = l.data_pool; | 100 | nl.data_pool = l.data_pool; |
101 | else | ||
102 | nl.data_pool = ceph_file_layout_pg_pool(ci->i_layout); | ||
103 | |||
104 | /* this is obsolete, and always -1 */ | ||
105 | nl.preferred_osd = le64_to_cpu(-1); | ||
99 | 106 | ||
100 | err = __validate_layout(mdsc, &nl); | 107 | err = __validate_layout(mdsc, &nl); |
101 | if (err) | 108 | if (err) |
diff --git a/fs/ceph/ioctl.h b/fs/ceph/ioctl.h index be4a60487333..c77028afb1e1 100644 --- a/fs/ceph/ioctl.h +++ b/fs/ceph/ioctl.h | |||
@@ -34,6 +34,8 @@ | |||
34 | struct ceph_ioctl_layout { | 34 | struct ceph_ioctl_layout { |
35 | __u64 stripe_unit, stripe_count, object_size; | 35 | __u64 stripe_unit, stripe_count, object_size; |
36 | __u64 data_pool; | 36 | __u64 data_pool; |
37 | |||
38 | /* obsolete. new values ignored, always return -1 */ | ||
37 | __s64 preferred_osd; | 39 | __s64 preferred_osd; |
38 | }; | 40 | }; |
39 | 41 | ||