* Use is subject to license terms.
*/
/*
- * Copyright (c) 2011, 2012 Whamcloud, Inc.
+ * Copyright (c) 2012, 2013, Intel Corporation.
* Use is subject to license terms.
*/
/*
*/
while (len > 0) {
rc = -dmu_buf_hold_array_by_bonus(obj->oo_db, off, len, TRUE,
- osd_zerocopy_tag, &numbufs,
- &dbp);
- LASSERT(rc == 0);
+ osd_zerocopy_tag, &numbufs,
+ &dbp);
+ if (unlikely(rc))
+ GOTO(err, rc);
for (i = 0; i < numbufs; i++) {
int bufoff, tocpy, thispage;
}
RETURN(npages);
+
+err:
+ LASSERT(rc < 0);
+ osd_bufs_put(env, &obj->oo_dt, lnb - npages, npages);
+ RETURN(rc);
}
static int osd_bufs_get_write(const struct lu_env *env, struct osd_object *obj,
/* ignore quota for the whole request if any page is from
* client cache or written by root.
*
+ * XXX once we drop the 1.8 client support, the checking
+ * for whether page is from cache can be simplified as:
+ * !(lnb[i].flags & OBD_BRW_SYNC)
+ *
* XXX we could handle this on per-lnb basis as done by
* grant. */
if ((lnb[i].flags & OBD_BRW_NOQUOTA) ||
- !(lnb[i].flags & OBD_BRW_SYNC))
+ (lnb[i].flags & (OBD_BRW_FROM_GRANT | OBD_BRW_SYNC)) ==
+ OBD_BRW_FROM_GRANT)
ignore_quota = true;
if (size == 0) {
/* first valid lnb */
.dbo_declare_write_commit = osd_declare_write_commit,
.dbo_write_commit = osd_write_commit,
.dbo_read_prep = osd_read_prep,
- .do_declare_punch = osd_declare_punch,
- .do_punch = osd_punch,
+ .dbo_declare_punch = osd_declare_punch,
+ .dbo_punch = osd_punch,
};