* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2012, 2016, Intel Corporation.
+ * Copyright (c) 2012, 2017, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
#define DEBUG_SUBSYSTEM S_OSD
-#include <lustre_ver.h>
#include <libcfs/libcfs.h>
#include <obd_support.h>
#include <lustre_net.h>
#include <obd_class.h>
#include <lustre_disk.h>
#include <lustre_fid.h>
-#include <lustre/lustre_idl.h> /* LLOG_MIN_CHUNK_SIZE definition */
+#include <lustre_quota.h>
#include "osd_internal.h"
* as llog or last_rcvd files. We needn't enforce quota on those
* objects, so always set the lqi_space as 0. */
RETURN(osd_declare_quota(env, osd, obj->oo_attr.la_uid,
- obj->oo_attr.la_gid, 0, oh, true, NULL,
- false));
+ obj->oo_attr.la_gid, obj->oo_attr.la_projid,
+ 0, oh, NULL, OSD_QID_BLK));
}
static ssize_t osd_write(const struct lu_env *env, struct dt_object *dt,
* If we discover this is a vital for good performance we
* can get own replacement for dmu_buf_hold_array_by_bonus().
*/
- while (len > 0) {
+ while (len > 0 &&
+ (obj->oo_dn->dn_datablkshift != 0 ||
+ off < obj->oo_dn->dn_datablksz)) {
+ if (obj->oo_dn->dn_datablkshift == 0 &&
+ off + len > obj->oo_dn->dn_datablksz)
+ len = obj->oo_dn->dn_datablksz - off;
+
rc = -dmu_buf_hold_array_by_bonus(&obj->oo_dn->dn_bonus->db,
off, len, TRUE, osd_0copy_tag,
&numbufs, &dbp);
uint32_t size = 0;
uint32_t blksz = obj->oo_dn->dn_datablksz;
int i, rc, flags = 0;
- bool ignore_quota = false, synced = false;
+ bool synced = false;
long long space = 0;
struct page *last_page = NULL;
unsigned long discont_pages = 0;
+ enum osd_qid_declare_flags declare_flags = OSD_QID_BLK;
ENTRY;
LASSERT(dt_object_exists(dt));
if ((lnb[i].lnb_flags & OBD_BRW_NOQUOTA) ||
(lnb[i].lnb_flags & (OBD_BRW_FROM_GRANT | OBD_BRW_SYNC)) ==
OBD_BRW_FROM_GRANT)
- ignore_quota = true;
+ declare_flags |= OSD_QID_FORCE;
+
if (size == 0) {
/* first valid lnb */
offset = lnb[i].lnb_file_offset;
retry:
/* acquire quota space if needed */
rc = osd_declare_quota(env, osd, obj->oo_attr.la_uid,
- obj->oo_attr.la_gid, space, oh, true, &flags,
- ignore_quota);
+ obj->oo_attr.la_gid, obj->oo_attr.la_projid,
+ space, oh, &flags, declare_flags);
if (!synced && rc == -EDQUOT && (flags & QUOTA_FL_SYNC) != 0) {
dt_sync(env, th->th_dev);
lnb[0].lnb_flags |= OBD_BRW_OVER_USRQUOTA;
if (flags & QUOTA_FL_OVER_GRPQUOTA)
lnb[0].lnb_flags |= OBD_BRW_OVER_GRPQUOTA;
+#ifdef ZFS_PROJINHERIT
+ if (flags & QUOTA_FL_OVER_PRJQUOTA)
+ lnb[0].lnb_flags |= OBD_BRW_OVER_PRJQUOTA;
+#endif
RETURN(rc);
}
/* declare we'll free some blocks ... */
if (start < obj->oo_attr.la_size) {
read_unlock(&obj->oo_attr_lock);
+ dmu_tx_mark_netfree(oh->ot_tx);
dmu_tx_hold_free(oh->ot_tx, obj->oo_dn->dn_object, start, len);
} else {
read_unlock(&obj->oo_attr_lock);
}
RETURN(osd_declare_quota(env, osd, obj->oo_attr.la_uid,
- obj->oo_attr.la_gid, 0, oh, true, NULL,
- false));
+ obj->oo_attr.la_gid, obj->oo_attr.la_projid,
+ 0, oh, NULL, OSD_QID_BLK));
}
static int osd_ladvise(const struct lu_env *env, struct dt_object *dt,