// layout
void Client::set_default_file_stripe_unit(int stripe_unit)
{
- file_stripe_unit = stripe_unit;
+ if (stripe_unit > 0)
+ file_stripe_unit = stripe_unit;
}
void Client::set_default_file_stripe_count(int count)
{
- file_stripe_count = count;
+ if (count > 0)
+ file_stripe_count = count;
}
void Client::set_default_object_size(int size)
{
- object_size = size;
+ if (size > 0)
+ object_size = size;
}
void Client::set_default_file_replication(int replication)
{
- file_replication = replication;
+ if (replication >= 0)
+ file_replication = replication;
}
void Client::set_default_preferred_pg(int pg)
{
+ if (pg >= 0)
preferred_pg = pg;
}
__le32 fl_pg_pool; /* namespace, crush ruleset, rep level */
} __attribute__ ((packed));
+#define CEPH_DEFAULT_OBJECT_SIZE 2<<22
+#define CEPH_DEFAULT_STRIPE_COUNT 1
// project update
inode_t *pi = cur->project_inode();
// FIXME: only set striping parameters, for now.
- pi->layout.fl_stripe_unit = req->head.args.setlayout.layout.fl_stripe_unit;
- pi->layout.fl_stripe_count = req->head.args.setlayout.layout.fl_stripe_count;
- pi->layout.fl_object_size = req->head.args.setlayout.layout.fl_object_size;
+ if (req->head.args.setlayout.layout.fl_object_size > 0)
+ pi->layout.fl_object_size = req->head.args.setlayout.layout.fl_object_size;
+ else pi->layout.fl_object_size = CEPH_DEFAULT_OBJECT_SIZE;
+ if (req->head.args.setlayout.layout.fl_stripe_unit > 0)
+ pi->layout.fl_stripe_unit = req->head.args.setlayout.layout.fl_stripe_unit;
+ else pi->layout.fl_stripe_unit = pi->layout.fl_object_size;
+ if (req->head.args.setlayout.layout.fl_stripe_count > 0)
+ pi->layout.fl_stripe_count=req->head.args.setlayout.layout.fl_stripe_count;
+ else pi->layout.fl_stripe_count = CEPH_DEFAULT_STRIPE_COUNT;
pi->version = cur->pre_dirty();
pi->ctime = g_clock.real_now();