+ domsize_dom = mdd_lmm_dom_size(snd_buf->lb_buf);
+ domsize_vlt = mdd_lmm_dom_size(fst_buf->lb_buf);
+
+ /* Only migration is supported for DoM files, not 'swap_layouts' so
+ * target file must be volatile and orphan.
+ */
+ if (fst_o->mod_flags & (ORPHAN_OBJ | VOLATILE_OBJ)) {
+ dom_o = domsize_dom ? snd_o : NULL;
+ } else if (snd_o->mod_flags & (ORPHAN_OBJ | VOLATILE_OBJ)) {
+ swap(domsize_dom, domsize_vlt);
+ dom_o = domsize_dom ? fst_o : NULL;
+ } else if (domsize_dom > 0 || domsize_vlt > 0) {
+ /* 'lfs swap_layouts' case, neither file should have DoM */
+ rc = -EOPNOTSUPP;
+ CDEBUG(D_LAYOUT, "cannot swap layouts with DOM component, "
+ "use migration instead: rc = %d\n", rc);
+ GOTO(stop, rc);
+ }
+
+ if (domsize_vlt > 0 && domsize_dom == 0) {
+ rc = -EOPNOTSUPP;
+ CDEBUG(D_LAYOUT, "cannot swap layout for "DFID": OST to DOM "
+ "migration is not supported: rc = %d\n",
+ PFID(mdo2fid(snd_o)), rc);
+ GOTO(stop, rc);
+ } else if (domsize_vlt > 0 && domsize_dom != domsize_vlt) {