* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2012, 2014, Intel Corporation.
+ * Copyright (c) 2012, 2015, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
LASSERT(osd_invariant(obj));
- down_read(&obj->oo_sem);
+ down_read_nested(&obj->oo_sem, role);
}
static void osd_object_write_lock(const struct lu_env *env,
LASSERT(osd_invariant(obj));
- down_write(&obj->oo_sem);
+ down_write_nested(&obj->oo_sem, role);
}
static void osd_object_read_unlock(const struct lu_env *env,
if (rc)
return ERR_PTR(rc);
+ /*
+ * XXX: This heuristic is non-optimal. It would be better to
+ * increase the blocksize up to osd->od_max_blksz during the write.
+ * This is exactly how the ZPL behaves and it ensures that the right
+ * blocksize is selected based on the file size rather than the
+ * making broad assumptions based on the osd type.
+ */
if (!lu_device_is_md(osd2lu_dev(osd))) {
- /* uses 4K as default block size because clients write data
- * with page size that is 4K at minimum */
rc = -dmu_object_set_blocksize(osd->od_os, db->db_object,
- 4096, 0, oh->ot_tx);
+ osd->od_max_blksz, 0, oh->ot_tx);
if (unlikely(rc)) {
CERROR("%s: can't change blocksize: %d\n",
osd->od_svname, rc);
ENTRY;
+ if (!dt_object_exists(dt))
+ RETURN(-ENOENT);
+
LASSERT(osd_invariant(obj));
- LASSERT(dt_object_exists(dt));
LASSERT(obj->oo_sa_hdl != NULL);
oh = container_of0(handle, struct osd_thandle, ot_super);
write_unlock(&obj->oo_attr_lock);
rc = osd_object_sa_update(obj, SA_ZPL_LINKS(osd), &nlink, 8, oh);
- return rc;
+ RETURN(rc);
}
static int osd_object_sync(const struct lu_env *env, struct dt_object *dt,