This will allow enlightened callers to handle EIO.
Signed-off-by: Samuel Just <sam.just@inktank.com>
r = ::stat(path->path(), buf);
if (r < 0)
r = -errno;
- assert(!m_filestore_fail_eio || r != -EIO);
return r;
}
return false;
}
-int FileStore::stat(coll_t cid, const hobject_t& oid, struct stat *st)
+int FileStore::stat(
+ coll_t cid, const hobject_t& oid, struct stat *st, bool allow_eio)
{
int r = lfn_stat(cid, oid, st);
+ assert(allow_eio || !m_filestore_fail_eio || r != -EIO);
if (r < 0) {
dout(10) << "stat " << cid << "/" << oid
<< " = " << r << dendl;
}
}
-int FileStore::read(coll_t cid, const hobject_t& oid,
- uint64_t offset, size_t len, bufferlist& bl)
+int FileStore::read(
+ coll_t cid,
+ const hobject_t& oid,
+ uint64_t offset,
+ size_t len,
+ bufferlist& bl,
+ bool allow_eio)
{
int got;
if (got < 0) {
dout(10) << "FileStore::read(" << cid << "/" << oid << ") pread error: " << cpp_strerror(got) << dendl;
lfn_close(fd);
- assert(!m_filestore_fail_eio || got != -EIO);
+ assert(allow_eio || !m_filestore_fail_eio || got != -EIO);
return got;
}
bptr.set_length(got); // properly size the buffer
return 0;
}
-int FileStore::omap_get_header(coll_t c, const hobject_t &hoid,
- bufferlist *bl)
+int FileStore::omap_get_header(
+ coll_t c,
+ const hobject_t &hoid,
+ bufferlist *bl,
+ bool allow_eio)
{
dout(15) << __func__ << " " << c << "/" << hoid << dendl;
IndexedPath path;
return r;
r = object_map->get_header(hoid, bl);
if (r < 0 && r != -ENOENT) {
- assert(!m_filestore_fail_eio || r != -EIO);
+ assert(allow_eio || !m_filestore_fail_eio || r != -EIO);
return r;
}
return 0;
return 0;
}
bool exists(coll_t cid, const hobject_t& oid);
- int stat(coll_t cid, const hobject_t& oid, struct stat *st);
- int read(coll_t cid, const hobject_t& oid, uint64_t offset, size_t len, bufferlist& bl);
+ int stat(
+ coll_t cid,
+ const hobject_t& oid,
+ struct stat *st,
+ bool allow_eio = false);
+ int read(
+ coll_t cid,
+ const hobject_t& oid,
+ uint64_t offset,
+ size_t len,
+ bufferlist& bl,
+ bool allow_eio = false);
int fiemap(coll_t cid, const hobject_t& oid, uint64_t offset, size_t len, bufferlist& bl);
int _touch(coll_t cid, const hobject_t& oid);
// omap (see ObjectStore.h for documentation)
int omap_get(coll_t c, const hobject_t &hoid, bufferlist *header,
map<string, bufferlist> *out);
- int omap_get_header(coll_t c, const hobject_t &hoid, bufferlist *out);
+ int omap_get_header(
+ coll_t c,
+ const hobject_t &hoid,
+ bufferlist *out,
+ bool allow_eio = false);
int omap_get_keys(coll_t c, const hobject_t &hoid, set<string> *keys);
int omap_get_values(coll_t c, const hobject_t &hoid, const set<string> &keys,
map<string, bufferlist> *out);
// objects
virtual bool exists(coll_t cid, const hobject_t& oid) = 0; // useful?
- virtual int stat(coll_t cid, const hobject_t& oid, struct stat *st) = 0; // struct stat?
- virtual int read(coll_t cid, const hobject_t& oid, uint64_t offset, size_t len, bufferlist& bl) = 0;
+ virtual int stat(
+ coll_t cid,
+ const hobject_t& oid,
+ struct stat *st,
+ bool allow_eio = false) = 0; // struct stat?
+
+ virtual int read(
+ coll_t cid,
+ const hobject_t& oid,
+ uint64_t offset,
+ size_t len,
+ bufferlist& bl,
+ bool allow_eio = false) = 0;
+
virtual int fiemap(coll_t cid, const hobject_t& oid, uint64_t offset, size_t len, bufferlist& bl) = 0;
virtual int getattr(coll_t cid, const hobject_t& oid, const char *name, bufferptr& value) = 0;
virtual int omap_get_header(
coll_t c, ///< [in] Collection containing hoid
const hobject_t &hoid, ///< [in] Object containing omap
- bufferlist *header ///< [out] omap header
+ bufferlist *header, ///< [out] omap header
+ bool allow_eio = false ///< [in] don't assert on eio
) = 0;
/// Get keys defined on hoid