Project

General

Profile

Actions

Bug #14100

open

the semantics of CEPH_OSD_OP_ZERO.

Added by jianpeng ma over 8 years ago. Updated almost 7 years ago.

Status:
New
Priority:
Normal
Assignee:
Category:
Dev Interfaces
Target version:
-
% Done:

0%

Source:
other
Tags:
Backport:
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Component(RADOS):
OSD, Objecter, librados
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

Now in ReplicatedPG::do_osd_ops, for CEPH_OSD_OP_ZERO, there are the following handle:

a)if object din't exist, the op became no-op.
b)if object existed

     if (offset + len >= ob.size)
          if (offset >= ob.size)
                 op became no-op
          else
               op became truncate and the ob.size became offset
     else
         zero(offset, len) like normal write opeartions

Those behaviors are ok for rbd. From the native semantics of zero, it write the data(off, len) w/ zero.Make later read data is zero.
For rbd, we know the object size. If non-exist or smaller, we will append zero data in the end.

rados has a api: rados_write_op_zero, it use zero as write which don't carry data from client to osd.
But for a normal object,
a)zero a non-exist object don't work
b)zero(offset >= ob.size) don't work(but write(offset >= ob.size can work)
c)zero(offset + len >= ob.size & offset < ob.size) don't work(zero become a truncate and ob.size=offset).Later read(offset, len) don't return any data.

In fact, for rbd, zero mean discard. But for rados, zero is a speical write.

Actions #1

Updated by Zheng Yan over 8 years ago

jianpeng ma wrote:

Now in ReplicatedPG::do_osd_ops, for CEPH_OSD_OP_ZERO, there are the following handle:

a)if object din't exist, the op became no-op.
b)if object existed
if (offset + len >= ob.size)
if (offset >= ob.size)
op became no-op
else
op became truncate and the ob.size became offset
else
zero(offset, len) like normal write opeartions

this is not like normal write. it's punching hole, fail back to writing zeros when underline FS does not support punching hole.

Actions #2

Updated by Sage Weil over 8 years ago

Perhaps a simple fix is to add a flag argument to the operation like FLAG_EXTEND_SIZE to cover the non-hole-punchy case?

I don't think we can/should change the previous rados behavior, but we can cover both..

Actions #3

Updated by Kefu Chai over 8 years ago

  • Description updated (diff)
Actions #4

Updated by Greg Farnum almost 7 years ago

  • Project changed from Ceph to RADOS
  • Category set to Dev Interfaces
  • Component(RADOS) OSD, Objecter, librados added
Actions

Also available in: Atom PDF