1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
8 * This is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License version 2.1, as published by the Free Software
11 * Foundation. See file COPYING.
16 #include "common/ceph_argparse.h"
17 #include "common/debug.h"
18 #include "os/filestore/FileStore.h"
19 #include "global/global_init.h"
20 #include "include/assert.h"
22 #define dout_context g_ceph_context
23 #define dout_subsys ceph_subsys_filestore
25 #define dout_prefix *_dout
27 struct Foo : public Thread {
28 void *entry() override {
29 dout(0) << "foo started" << dendl;
31 dout(0) << "foo asserting 0" << dendl;
36 int main(int argc, const char **argv)
38 vector<const char*> args;
39 argv_to_vec(argc, argv, args);
42 auto cct = global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT,
43 CODE_ENVIRONMENT_UTILITY, 0);
44 common_init_finish(g_ceph_context);
47 if (args.size() < 2) return -1;
48 const char *filename = args[0];
49 int mb = atoi(args[1]);
51 cout << "#dev " << filename << std::endl;
52 cout << "#mb " << mb << std::endl;
54 ObjectStore *fs = new FileStore(cct.get(), filename, NULL);
55 if (fs->mount() < 0) {
56 cout << "mount failed" << std::endl;
60 ObjectStore::Sequencer osr(__func__);
61 ObjectStore::Transaction t;
64 bl.append(buf, sizeof(buf));
65 t.create_collection(coll_t(), 0);
67 for (int i=0; i<mb; i++) {
69 snprintf(f, sizeof(f), "foo%d\n", i);
70 sobject_t soid(f, CEPH_NOSNAP);
71 t.write(coll_t(), ghobject_t(hobject_t(soid)), 0, bl.length(), bl);
74 dout(0) << "starting thread" << dendl;
76 dout(0) << "starting op" << dendl;
77 fs->apply_transaction(&osr, std::move(t));