err = ceph_do_getattr(file->f_dentry->d_inode, CEPH_STAT_CAP_LAYOUT);
if (!err) {
- l.stripe_unit = ceph_file_layout_su(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.stripe_unit = ceph_file_layout_stripe_unit(&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.data_pool = le32_to_cpu(ci->i_layout.fl_pg_pool);
l.preferred_osd =
(s32)le32_to_cpu(ci->i_layout.fl_pg_preferred);
/* validate changed params against current layout */
err = ceph_do_getattr(file->f_dentry->d_inode, CEPH_STAT_CAP_LAYOUT);
if (!err) {
- nl.stripe_unit = ceph_file_layout_su(ci->i_layout);
- nl.stripe_count = ceph_file_layout_stripe_count(ci->i_layout);
- nl.object_size = ceph_file_layout_object_size(ci->i_layout);
+ nl.stripe_unit = ceph_file_layout_stripe_unit(&ci->i_layout);
+ nl.stripe_count = ceph_file_layout_stripe_count(&ci->i_layout);
+ nl.object_size = ceph_file_layout_object_size(&ci->i_layout);
nl.data_pool = le32_to_cpu(ci->i_layout.fl_pg_pool);
nl.preferred_osd =
(s32)le32_to_cpu(ci->i_layout.fl_pg_preferred);
ceph_calc_file_object_mapping(&ci->i_layout, dl.file_offset, &len,
&dl.object_no, &dl.object_offset, &olen);
dl.file_offset -= dl.object_offset;
- dl.object_size = ceph_file_layout_object_size(ci->i_layout);
- dl.block_size = ceph_file_layout_su(ci->i_layout);
+ dl.object_size = ceph_file_layout_object_size(&ci->i_layout);
+ dl.block_size = ceph_file_layout_stripe_unit(&ci->i_layout);
/* block_offset = object_offset % block_size */
tmp = dl.object_offset;
ret = snprintf(val, size,
"chunk_bytes=%lld\nstripe_count=%lld\nobject_size=%lld\n",
- (unsigned long long)ceph_file_layout_su(ci->i_layout),
- (unsigned long long)ceph_file_layout_stripe_count(ci->i_layout),
- (unsigned long long)ceph_file_layout_object_size(ci->i_layout));
+ (unsigned long long)ceph_file_layout_stripe_unit(&ci->i_layout),
+ (unsigned long long)ceph_file_layout_stripe_count(&ci->i_layout),
+ (unsigned long long)ceph_file_layout_object_size(&ci->i_layout));
- if (ceph_file_layout_pg_preferred(ci->i_layout) >= 0) {
+ if (ceph_file_layout_pg_preferred(&ci->i_layout) >= 0) {
val += ret;
size -= ret;
ret += snprintf(val, size, "preferred_osd=%lld\n",
(unsigned long long)ceph_file_layout_pg_preferred(
- ci->i_layout));
+ &ci->i_layout));
}
return ret;
*/
#define CEPH_MIN_STRIPE_UNIT 65536
-#define ceph_file_layout_su(l) ((__s32)le32_to_cpu((l).fl_stripe_unit))
+#define ceph_file_layout_stripe_unit(l) \
+ ((__s32) le32_to_cpu((l)->fl_stripe_unit))
#define ceph_file_layout_stripe_count(l) \
- ((__s32)le32_to_cpu((l).fl_stripe_count))
-#define ceph_file_layout_object_size(l) ((__s32)le32_to_cpu((l).fl_object_size))
-#define ceph_file_layout_cas_hash(l) ((__s32)le32_to_cpu((l).fl_cas_hash))
-#define ceph_file_layout_object_su(l) \
- ((__s32)le32_to_cpu((l).fl_object_stripe_unit))
+ ((__s32) le32_to_cpu((l)->fl_stripe_count))
+#define ceph_file_layout_object_size(l) \
+ ((__s32) le32_to_cpu((l)->fl_object_size))
+#define ceph_file_layout_cas_hash(l) \
+ ((__s32) le32_to_cpu((l)->fl_cas_hash))
+#define ceph_file_layout_object_stripe_unit(l) \
+ ((__s32) le32_to_cpu((l)->fl_object_stripe_unit))
#define ceph_file_layout_pg_preferred(l) \
- ((__s32)le32_to_cpu((l).fl_pg_preferred))
+ ((__s32) le32_to_cpu((l)->fl_pg_preferred))
#define ceph_file_layout_pg_pool(l) \
- ((__s32)le32_to_cpu((l).fl_pg_pool))
+ ((__s32) le32_to_cpu((l)->fl_pg_pool))
static inline unsigned ceph_file_layout_stripe_width(struct ceph_file_layout *l)
{
- return le32_to_cpu(l->fl_stripe_unit) *
- le32_to_cpu(l->fl_stripe_count);
+ return (unsigned) (ceph_file_layout_stripe_unit(l) *
+ ceph_file_layout_stripe_count(l));
}
/* "period" == bytes before i start on a new set of objects */
static inline unsigned ceph_file_layout_period(struct ceph_file_layout *l)
{
- return le32_to_cpu(l->fl_object_size) *
- le32_to_cpu(l->fl_stripe_count);
+ return (unsigned) (ceph_file_layout_object_size(l) *
+ ceph_file_layout_stripe_count(l));
}
-
int ceph_file_layout_is_valid(const struct ceph_file_layout *layout);
struct ceph_dir_layout {