MOSDOp: The functions are returned by const ref and parameters passed by ref

get_snapid(),get_snap_seq,get_pg,get_object_locator,get_version are returning
by reference and the corresponding setter is accepting the param by reference.
MOSDOp constructor is is accepting pg_t  by reference now.

Signed-off-by: Somnath Roy <somnath.roy@sandisk.com>
MOSDOpreply: The functions are returned by const ref and parameters passed by ref

get_oid,get_pg,get_replay_version,get_user_version are returning by reference and
corresponding setter is accepting param by reference.

Signed-off-by: Somnath Roy <somnath.roy@sandisk.com>
MOSDOpReply: Constructor initialization list is used to instantiate members

constructor initialization list is modified to initialize ops,oid,pgid with
copy constructor instead of assignment operator in the constructor body.

Signed-off-by: Somnath Roy <somnath.roy@sandisk.com>
OSD: pass param by ref to avoid copying overrhead

passing OpRequestRef, OSDMapRef by ref to avoid refcounting overhead
and in some cases passing structures by const ref.

Signed-off-by: Somnath Roy <somnath.roy@sandisk.com>
OSDMap: avoid passing pg_t by value

Passing pg_t param by cons ref for avoiding copies.

Signed-off-by: Somnath Roy <somnath.roy@sandisk.com>
PG: pass OpRequestRef by ref to avoid refcounting overhead

Signed-off-by: Somnath Roy <somnath.roy@sandisk.com>
ceph.in: handle DYLD_LIBRARY_PATH on OS X

On OS X, the environment variable to override
to .libs is DYLD_LIBRARY_PATH instead of
LD_LIBRARY_PATH.

Signed-off-by: John Spray <john.spray@redhat.com>
common/Thread: add missing #include for pid_t

On linux this worked by side effect from
pthread.h, but POSIX header for pid_t is
sys/types.h -- this is needed on OS X.

Signed-off-by: John Spray <john.spray@redhat.com>
os/FileStore: move ZFS_SUPER_MAGIC in linux ifdef

The __SWORD_TYPE for this line is linux-specific.

Signed-off-by: John Spray <john.spray@redhat.com>
client: handle missing O_RSYNC constant

Although this is part of POSIX, it's missing on
OS X.  #define it to zero in this case so that checks
for the flag will always be false.

Signed-off-by: John Spray <john.spray@redhat.com>
common: move #include syscall into ifndef DARWIN

Signed-off-by: John Spray <john.spray@redhat.com>
os/FileStore: put SUPER usage in ifdef __linux__

This is an update to take account of 9312c5e wherein
the FS_* enum was replaced by direct use of SUPER_MAGIC
macros.

Signed-off-by: John Spray <john.spray@redhat.com>
mds: avoid comparing MutationRef with 0

LLVM on OS X considers this == operator with an int
ambiguous: compare with an explicit MutationRef()
instead.

Signed-off-by: John Spray <john.spray@redhat.com>
Add Header cache to KeyValueStore

In the performance statistic recently, the header lookup becomes the main time
consuming for the read/write operations. Most of time it occur 50% to deal with
header lookup, decode/encode logics.

Now adding header cache using SharedLRU structure which will maintain the header
cache and caller will get the pointer to the real header. It also avoid too much
header copy operations overhead.

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
Remove exclusive lock on GenericObjectMap

Now most of GenericObjectMap interfaces use header as argument not the union of
coll_t and ghobject_t. So caller should be responsible for maintain the
exclusive header.

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
Support for READFORWARD in the caching tier

READFORWARD caching policy uses writeback for writes
and redirects reads to the back end starage tier.

Signed-off-by: Luis Pabón <lpabon@redhat.com>
osd: separate cleanup from PGBackend::on_change()

The generic portion of on_change() cleaned up temporary on-disk objects
and requires a Transaction.  The rest is clearing out in-memory state and
does not.  Separate the two.

Signed-off-by: Sage Weil <sage@inktank.com>
osd: clear PGBackend state on shutdown

This was leaking state on shutdown whenever there were in-flight repops
that were canceled.

Fixes: #7891
Signed-off-by: Sage Weil <sage@inktank.com>
osd: s/applying repop/canceling repop/

The 'applying' language dates back to when we would wait for acks from
replicas before applying writes locally.  We don't do any of that any more;
now, this loop just cancels the repops with remove_repop() and some other
cleanup.

Signed-off-by: Sage Weil <sage@inktank.com>
osd: cancel agent_timer events on shutdown

We need to cancel all agent timer events on shutdown.  This also needs to
happen early so that any in-progress events will execute before we start
flushing and cleaning up PGs.

Backport: firefly
Signed-off-by: Sage Weil <sage@inktank.com>