int diff, rc;
ENTRY;
- /* only precreate if group == 0 and o_id is specfied */
- if (group != 0 || oa->o_id == 0)
- RETURN(1);
-
diff = oa->o_id - filter_last_id(filter, oa);
CDEBUG(D_INFO, "filter_last_id() = "LPU64" -> diff = %d\n",
filter_last_id(filter, oa), diff);
- if (diff >= 0)
- RETURN(diff);
-
- if (!(oa->o_valid & OBD_MD_FLFLAGS) ||
- !(oa->o_flags & OBD_FL_DELORPHAN)) {
- CERROR("filter asked to delete %d objects, but DELORPHAN flag "
- "isn't set!\n", -diff);
+
+ /* delete orphans request */
+ if ((oa->o_valid & OBD_MD_FLFLAGS) &&
+ (oa->o_flags & OBD_FL_DELORPHAN)) {
+ LASSERT(diff <= 0);
+ if (diff == 0)
+ RETURN(0);
+ filter_destroy_precreated(exp, oa, filter);
+ rc = filter_update_last_objid(obd, group, 0);
+ if (rc)
+ CERROR("unable to write lastobjid, but orphans"
+ "were deleted\n");
RETURN(0);
+ } else {
+ /* only precreate if group == 0 and o_id is specfied */
+ if (!(oa->o_valid & OBD_FL_DELORPHAN) &&
+ (group != 0 || oa->o_id == 0))
+ RETURN(1);
+
+ LASSERT(diff >= 0);
+ RETURN(diff);
}
- /* delete orphan request */
- filter_destroy_precreated(exp, oa, filter);
- rc = filter_update_last_objid(obd, group, 0);
- if (rc)
- CERROR("unable to write lastobjid, but orphans were deleted\n");
- RETURN(rc);
}
/* We rely on the fact that only one thread will be creating files in a given
oa->o_flags == OBD_FL_DELORPHAN) {
/* delete from next_id on up */
oa->o_valid |= OBD_MD_FLID;
- oa->o_id = oscc->oscc_next_id;
- if (oa->o_id == 0)
- RETURN(0);
+ oa->o_id = oscc->oscc_next_id - 1;
+
rc = osc_real_create(oscc->oscc_exp, oa, ea, NULL);
spin_lock(&oscc->oscc_lock);
test_53() {
for i in /proc/fs/lustre/osc/OSC*mds1 ; do
- ostname=`echo $i | cut -d _ -f 3-4`
+ ostname=`echo $i | cut -d _ -f 3-4 | sed -e s/_mds1//`
ost_last=`cat /proc/fs/lustre/obdfilter/$ostname/last_id`
mds_last=`cat $i/prealloc_last_id`
echo "$ostname.last_id=$ost_last ; MDS.last_id=$mds_last"