* 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/
static int osd_trans_cb_add(struct thandle *th, struct dt_txn_commit_cb *dcb)
{
- struct osd_thandle *oh;
+ struct osd_thandle *oh = container_of0(th, struct osd_thandle,
+ ot_super);
- oh = container_of0(th, struct osd_thandle, ot_super);
- list_add(&dcb->dcb_linkage, &oh->ot_dcb_list);
+ LASSERT(dcb->dcb_magic == TRANS_COMMIT_CB_MAGIC);
+ LASSERT(&dcb->dcb_func != NULL);
+ if (dcb->dcb_flags & DCB_TRANS_STOP)
+ list_add(&dcb->dcb_linkage, &oh->ot_stop_dcb_list);
+ else
+ list_add(&dcb->dcb_linkage, &oh->ot_dcb_list);
return 0;
}
}
}
+static void osd_trans_stop_cb(struct osd_thandle *oth, int result)
+{
+ struct dt_txn_commit_cb *dcb;
+ struct dt_txn_commit_cb *tmp;
+
+ /* call per-transaction stop callbacks if any */
+ list_for_each_entry_safe(dcb, tmp, &oth->ot_stop_dcb_list,
+ dcb_linkage) {
+ LASSERTF(dcb->dcb_magic == TRANS_COMMIT_CB_MAGIC,
+ "commit callback entry: magic=%x name='%s'\n",
+ dcb->dcb_magic, dcb->dcb_name);
+ list_del_init(&dcb->dcb_linkage);
+ dcb->dcb_func(NULL, &oth->ot_super, dcb, result);
+ }
+}
+
/*
* Concurrency: shouldn't matter.
*/
CDEBUG(D_OTHER, "%s: transaction hook failed: rc = %d\n",
osd->od_svname, rc);
+ osd_trans_stop_cb(oh, rc);
+
LASSERT(oh->ot_tx);
txg = oh->ot_tx->tx_txg;
oh->ot_tx = tx;
INIT_LIST_HEAD(&oh->ot_dcb_list);
+ INIT_LIST_HEAD(&oh->ot_stop_dcb_list);
INIT_LIST_HEAD(&oh->ot_unlinked_list);
INIT_LIST_HEAD(&oh->ot_sa_list);
sema_init(&oh->ot_sa_lock, 1);
dmu_objset_space(os, &refdbytes, &availbytes, &usedobjs, &availobjs);
+ memset(osfs, 0, sizeof(*osfs));
+
+ /* We're a zfs filesystem. */
+ osfs->os_type = UBERBLOCK_MAGIC;
+
/*
* ZFS allows multiple block sizes. For statfs, Linux makes no
* proper distinction between bsize and frsize. For calculations
* Rather than report this via os_bavail (which makes users unhappy if
* they can't fill the filesystem 100%), reduce os_blocks as well.
*
- * Reserve 0.78% of total space, at least 4MB for small filesystems,
+ * Reserve 0.78% of total space, at least 16MB for small filesystems,
* for internal files to be created/unlinked when space is tight.
*/
CLASSERT(OSD_STATFS_RESERVED_SIZE > 0);
/* ZFS XXX: fill in backing dataset FSID/UUID
memcpy(osfs->os_fsid, .... );*/
- /* We're a zfs filesystem. */
- osfs->os_type = UBERBLOCK_MAGIC;
+ osfs->os_namelen = MAXNAMELEN;
+ osfs->os_maxbytes = OBD_OBJECT_EOF;
/* ZFS XXX: fill in appropriate OS_STATE_{DEGRADED,READONLY} flags
osfs->os_state = vf_to_stf(vfsp->vfs_flag);
if (sb->s_flags & MS_RDONLY)
- osfs->os_state = OS_STATE_READONLY;
+ osfs->os_state |= OS_STATE_READONLY;
*/
- osfs->os_namelen = MAXNAMELEN;
- osfs->os_maxbytes = OBD_OBJECT_EOF;
-
return 0;
}
if (rc)
GOTO(err, rc);
- rc = osd_convert_root_to_new_seq(env, o);
- if (rc)
- GOTO(err, rc);
-
/* Use our own ZAP for inode accounting by default, this can be changed
* via procfs to estimate the inode usage from the block usage */
o->od_quota_iused_est = 0;
"Number of Object Index containers to be created, "
"it's only valid for new filesystem.");
-MODULE_AUTHOR("Sun Microsystems, Inc. <http://www.lustre.org/>");
+MODULE_AUTHOR("OpenSFS, Inc. <http://www.lustre.org/>");
MODULE_DESCRIPTION("Lustre Object Storage Device ("LUSTRE_OSD_ZFS_NAME")");
MODULE_VERSION(LUSTRE_VERSION_STRING);
MODULE_LICENSE("GPL");