/* arbitrary limit on max # of monitors (cluster of 3 is typical) */
#define CEPH_MAX_MON 31 //最大的监控集群数量
(2)文件布局:描述一个文件(inode)的数据布局
struct ceph_file_layout {
/* file -> object mapping */文件到对象的映射
__le32 fl_stripe_unit; /* stripe unit, in bytes. must be multiple
of page size. */条带大小,必须是页的多倍
__le32 fl_stripe_count; /* over this many objects */
__le32 fl_object_size; /* until objects are this big, then move to
new objects */
__le32 fl_cas_hash; /* UNUSED. 0 = none; 1 = sha256 */
/* pg -> disk layout */PG到磁盘的布局
__le32 fl_object_stripe_unit; /* UNUSED. for per-object parity, if any */
int ceph_file_layout_is_valid(const struct ceph_file_layout *layout)
{
__u32 su = le32_to_cpu(layout->fl_stripe_unit);//大小端转换
__u32 sc = le32_to_cpu(layout->fl_stripe_count);
__u32 os = le32_to_cpu(layout->fl_object_size);
/* stripe unit, object size must be non-zero, 64k increment */条带单元和对象大小非零
if (!su || (su & (CEPH_MIN_STRIPE_UNIT-1)))
return 0;
if (!os || (os & (CEPH_MIN_STRIPE_UNIT-1)))
return 0;
/* object size must be a multiple of stripe unit */对象大小必须是条带的整数倍
if (os < su || os % su)
return 0;
/* stripe count must be non-zero */条带数量非零
if (!sc)
return 0;
return 1;
}
struct ceph_dir_layout {//目录的布局
__u8 dl_dir_hash; /* see ceph_hash.h for ids */
__u8 dl_unused1;
__u16 dl_unused2;
__u32 dl_unused3;
} __attribute__ ((packed));