{
return op & CEPH_OSD_OP_MODE_CACHE;
}
+static inline int ceph_osd_op_uses_extent(int op)
+{
+ switch(op) {
+ case CEPH_OSD_OP_READ:
+ case CEPH_OSD_OP_MAPEXT:
+ case CEPH_OSD_OP_MASKTRUNC:
+ case CEPH_OSD_OP_SPARSE_READ:
+ case CEPH_OSD_OP_SYNC_READ:
+ case CEPH_OSD_OP_WRITE:
+ case CEPH_OSD_OP_WRITEFULL:
+ case CEPH_OSD_OP_TRUNCATE:
+ case CEPH_OSD_OP_ZERO:
+ case CEPH_OSD_OP_APPEND:
+ case CEPH_OSD_OP_TRIMTRUNC:
+ return true;
+ default:
+ return false;
+ }
+}
/*
* note that the following tmap stuff is also defined in the ceph librados.h
}
// munge -1 truncate to 0 truncate
- if (op.extent.truncate_seq == 1 && op.extent.truncate_size == (-1ULL)) {
+ if (ceph_osd_op_uses_extent(op.op) &&
+ op.extent.truncate_seq == 1 &&
+ op.extent.truncate_size == (-1ULL)) {
op.extent.truncate_size = 0;
op.extent.truncate_seq = 0;
}