From: huanwen ren Date: Thu, 30 Jun 2016 11:38:24 +0000 (+0800) Subject: client/filer: _write&&_fallocate in the redundant judgments fix X-Git-Tag: ses5-milestone5~496^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=49a74402624dc379de7577301be6376601f4e0fb;p=ceph.git client/filer: _write&&_fallocate in the redundant judgments fix The running time of redundant judgments influence function,especially _write(), at the same time,Filer::read/read_trunc/write/write_trunc/truncate/zero type should be void, fix it Signed-off-by: huanwen ren --- diff --git a/src/client/Client.cc b/src/client/Client.cc index c1ef9c89f246..2eb0f086d806 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -8585,13 +8585,10 @@ int Client::_write(Fh *f, int64_t offset, uint64_t size, const char *buf, unsafe_sync_write++; get_cap_ref(in, CEPH_CAP_FILE_BUFFER); // released by onsafe callback - r = filer->write_trunc(in->ino, &in->layout, in->snaprealm->get_snap_context(), + filer->write_trunc(in->ino, &in->layout, in->snaprealm->get_snap_context(), offset, size, bl, ceph::real_clock::now(cct), 0, in->truncate_size, in->truncate_seq, onfinish, new C_OnFinisher(onsafe, &objecter_finisher)); - if (r < 0) - goto done; - client_lock.Unlock(); flock.Lock(); @@ -11665,14 +11662,12 @@ int Client::_fallocate(Fh *fh, int mode, int64_t offset, int64_t length) get_cap_ref(in, CEPH_CAP_FILE_BUFFER); _invalidate_inode_cache(in, offset, length); - r = filer->zero(in->ino, &in->layout, + filer->zero(in->ino, &in->layout, in->snaprealm->get_snap_context(), offset, length, ceph::real_clock::now(cct), 0, true, onfinish, new C_OnFinisher(onsafe, &objecter_finisher)); - assert(r == 0); - in->mtime = ceph_clock_now(cct); mark_caps_dirty(in, CEPH_CAP_FILE_WR); diff --git a/src/osdc/Filer.h b/src/osdc/Filer.h index 96c11b80461a..88e0273c6523 100644 --- a/src/osdc/Filer.h +++ b/src/osdc/Filer.h @@ -117,7 +117,7 @@ class Filer { /*** async file interface. scatter/gather as needed. ***/ - int read(inodeno_t ino, + void read(inodeno_t ino, file_layout_t *layout, snapid_t snap, uint64_t offset, @@ -130,10 +130,9 @@ class Filer { vector extents; Striper::file_to_extents(cct, ino, layout, offset, len, 0, extents); objecter->sg_read(extents, snap, bl, flags, onfinish, op_flags); - return 0; } - int read_trunc(inodeno_t ino, + void read_trunc(inodeno_t ino, file_layout_t *layout, snapid_t snap, uint64_t offset, @@ -150,10 +149,9 @@ class Filer { extents); objecter->sg_read_trunc(extents, snap, bl, flags, truncate_size, truncate_seq, onfinish, op_flags); - return 0; } - int write(inodeno_t ino, + void write(inodeno_t ino, file_layout_t *layout, const SnapContext& snapc, uint64_t offset, @@ -168,10 +166,9 @@ class Filer { Striper::file_to_extents(cct, ino, layout, offset, len, 0, extents); objecter->sg_write(extents, snapc, bl, mtime, flags, onack, oncommit, op_flags); - return 0; } - int write_trunc(inodeno_t ino, + void write_trunc(inodeno_t ino, file_layout_t *layout, const SnapContext& snapc, uint64_t offset, @@ -189,10 +186,9 @@ class Filer { extents); objecter->sg_write_trunc(extents, snapc, bl, mtime, flags, truncate_size, truncate_seq, onack, oncommit, op_flags); - return 0; } - int truncate(inodeno_t ino, + void truncate(inodeno_t ino, file_layout_t *layout, const SnapContext& snapc, uint64_t offset, @@ -228,10 +224,9 @@ class Filer { gack.activate(); gcom.activate(); } - return 0; } - int zero(inodeno_t ino, + void zero(inodeno_t ino, file_layout_t *layout, const SnapContext& snapc, uint64_t offset, @@ -273,10 +268,9 @@ class Filer { gack.activate(); gcom.activate(); } - return 0; } - int zero(inodeno_t ino, + void zero(inodeno_t ino, file_layout_t *layout, const SnapContext& snapc, uint64_t offset, @@ -285,12 +279,11 @@ class Filer { int flags, Context *onack, Context *oncommit) { - - return zero(ino, layout, - snapc, offset, - len, mtime, - flags, false, - onack, oncommit); + zero(ino, layout, + snapc, offset, + len, mtime, + flags, false, + onack, oncommit); } // purge range of ino.### objects int purge_range(inodeno_t ino,