From 128bfcfdbf88c2b5c691651750a9c674fd470a4f Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Mon, 20 Jun 2011 14:31:37 -0700 Subject: [PATCH] rgw: put_obj_data doesn't need mtime --- src/rgw/rgw_access.h | 6 +++--- src/rgw/rgw_cache.h | 6 +++--- src/rgw/rgw_fs.cc | 10 +--------- src/rgw/rgw_fs.h | 2 +- src/rgw/rgw_op.cc | 2 +- src/rgw/rgw_rados.cc | 12 ++---------- src/rgw/rgw_rados.h | 2 +- 7 files changed, 12 insertions(+), 28 deletions(-) diff --git a/src/rgw/rgw_access.h b/src/rgw/rgw_access.h index 47e3b53c3096b..c70e04c84527a 100644 --- a/src/rgw/rgw_access.h +++ b/src/rgw/rgw_access.h @@ -55,13 +55,13 @@ public: virtual int put_obj_meta(std::string& id, rgw_obj& obj, time_t *mtime, map& attrs, bool exclusive) = 0; virtual int put_obj_data(std::string& id, rgw_obj& obj, const char *data, - off_t ofs, size_t len, time_t *mtime) = 0; + off_t ofs, size_t len) = 0; int put_obj(std::string& id, rgw_obj& obj, const char *data, size_t len, time_t *mtime, map& attrs) { - int ret = put_obj_meta(id, obj, NULL, attrs, false); + int ret = put_obj_data(id, obj, data, -1, len); if (ret >= 0) { - ret = put_obj_data(id, obj, data, -1, len, mtime); + ret = put_obj_meta(id, obj, mtime, attrs, false); } return ret; } diff --git a/src/rgw/rgw_cache.h b/src/rgw/rgw_cache.h index 367205ad9a646..a8aa4f1ceeb0a 100644 --- a/src/rgw/rgw_cache.h +++ b/src/rgw/rgw_cache.h @@ -37,7 +37,7 @@ public: RGWCache() {} int put_obj_data(std::string& id, std::string& bucket, std::string& obj, const char *data, - off_t ofs, size_t len, time_t *mtime); + off_t ofs, size_t len); int get_obj(void **handle, std::string& bucket, std::string& oid, char **data, off_t ofs, off_t end); @@ -74,7 +74,7 @@ int RGWCache::get_obj(void **handle, std::string& bucket, std::string& oid, template int RGWCache::put_obj_data(std::string& id, std::string& bucket, std::string& obj, const char *data, - off_t ofs, size_t len, time_t *mtime) + off_t ofs, size_t len) { string name = normal_name(data_space, bucket, obj); if ((bucket[0] == '.') && ((ofs == 0) || (ofs == -1))) { @@ -84,7 +84,7 @@ int RGWCache::put_obj_data(std::string& id, std::string& bucket, std::string& bl.append(p); cache.put(name, bl); } - return T::put_obj_data(id, bucket, obj, data, ofs, len, mtime); + return T::put_obj_data(id, bucket, obj, data, ofs, len); } template diff --git a/src/rgw/rgw_fs.cc b/src/rgw/rgw_fs.cc index 52c0cd505259e..ee112e963c5bb 100644 --- a/src/rgw/rgw_fs.cc +++ b/src/rgw/rgw_fs.cc @@ -251,7 +251,7 @@ done_err: } int RGWFS::put_obj_data(std::string& id, rgw_obj& obj, const char *data, - off_t ofs, size_t size, time_t *mtime) + off_t ofs, size_t size) { std::string& bucket = obj.bucket; std::string& oid = obj.object; @@ -279,14 +279,6 @@ int RGWFS::put_obj_data(std::string& id, rgw_obj& obj, const char *data, if (r < 0) goto done_err; - if (mtime) { - struct stat st; - r = fstat(fd, &st); - if (r < 0) - goto done_err; - *mtime = st.st_mtime; - } - r = close(fd); if (r < 0) return -errno; diff --git a/src/rgw/rgw_fs.h b/src/rgw/rgw_fs.h index 5f8328e1522ca..6b595c76784d7 100644 --- a/src/rgw/rgw_fs.h +++ b/src/rgw/rgw_fs.h @@ -22,7 +22,7 @@ public: int put_obj_meta(std::string& id, rgw_obj& obj, time_t *mtime, map& attrs, bool exclusive); int put_obj_data(std::string& id, rgw_obj& obj, const char *data, - off_t ofs, size_t size, time_t *mtime); + off_t ofs, size_t size); int clone_range(rgw_obj& dst_obj, off_t dst_ofs, rgw_obj& src_obj, off_t src_ofs, size_t size) { return -ENOTSUP; } int copy_obj(std::string& id, rgw_obj& dest_obj, diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index 9f8bff0bc994f..d3588fb2aaa2e 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -508,7 +508,7 @@ void RGWPutObj::execute() // do a write_full. ret = rgwstore->put_obj_data(s->user.user_id, obj, data, - ((ofs == 0) ? -1 : ofs), len, NULL); + ((ofs == 0) ? -1 : ofs), len); free(data); if (ret < 0) goto done; diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 816187a84c9f7..fb7817dd3298d 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -340,12 +340,11 @@ int RGWRados::put_obj_meta(std::string& id, rgw_obj& obj, * offset: the offet to write to in the object * If this is -1, we will overwrite the whole object. * size: the amount of data to write (data must be this long) - * mtime: if non-NULL, writes the given mtime to the bucket storage * attrs: all the given attrs are written to bucket storage for the given object * Returns: 0 on success, -ERR# otherwise. */ int RGWRados::put_obj_data(std::string& id, rgw_obj& obj, - const char *data, off_t ofs, size_t len, time_t *mtime) + const char *data, off_t ofs, size_t len) { std::string& bucket = obj.bucket; std::string& oid = obj.object; @@ -371,12 +370,6 @@ int RGWRados::put_obj_data(std::string& id, rgw_obj& obj, if (r < 0) return r; - if (mtime) { - r = io_ctx.stat(oid, NULL, mtime); - if (r < 0) - return r; - } - return 0; } /** @@ -428,8 +421,7 @@ int RGWRados::copy_obj(std::string& id, rgw_obj& dest_obj, // In the first call to put_obj_data, we pass ofs == -1 so that it will do // a write_full, wiping out whatever was in the object before this - r = put_obj_data(id, dest_obj, data, - ((ofs == 0) ? -1 : ofs), ret, NULL); + r = put_obj_data(id, dest_obj, data, ((ofs == 0) ? -1 : ofs), ret); free(data); if (r < 0) goto done_err; diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h index 0e30e2553de94..4b369b65d7336 100644 --- a/src/rgw/rgw_rados.h +++ b/src/rgw/rgw_rados.h @@ -47,7 +47,7 @@ public: virtual int put_obj_meta(std::string& id, rgw_obj& obj, time_t *mtime, map& attrs, bool exclusive); virtual int put_obj_data(std::string& id, rgw_obj& obj, const char *data, - off_t ofs, size_t len, time_t *mtime); + off_t ofs, size_t len); virtual int clone_range(rgw_obj& dst_obj, off_t dst_ofs, rgw_obj& src_obj, off_t src_ofs, size_t size); /** Copy an object, with many extra options */ -- 2.39.5