Motr  M0
super.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011-2020 Seagate Technology LLC and/or its Affiliates
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  * For any questions about this software or licensing,
17  * please email opensource@seagate.com or cortx-questions@seagate.com.
18  *
19  */
20 
21 
22 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_M0T1FS
23 #include "lib/trace.h"
24 
25 #include <linux/kernel.h> /* kstrtoul */
26 #include <linux/mount.h>
27 #include <linux/parser.h> /* substring_t */
28 #include <linux/slab.h> /* kmalloc, kfree */
29 #include <linux/statfs.h> /* kstatfs */
30 
33 #include "motr/magic.h" /* M0_T1FS_POOLS_MAGIC */
34 #include "lib/finject.h" /* M0_FI_ENABLED */
35 #include "lib/misc.h" /* M0_SET0 */
36 #include "lib/memory.h" /* M0_ALLOC_PTR, m0_free */
37 #include "conf/confc.h" /* m0_confc */
38 #include "conf/helpers.h" /* m0_confc_root_open */
39 #include "conf/cache.h" /* m0_conf_cache_contains */
40 #include "rpc/rpclib.h" /* m0_rcp_client_connect */
41 #include "lib/uuid.h" /* m0_uuid_generate */
42 #include "net/lnet/lnet.h"
43 #include "rpc/rpc_internal.h"
45 #include "rm/rm_service.h" /* m0_rms_type */
46 #include "reqh/reqh_service.h" /* m0_reqh_service_ctx */
47 #include "reqh/reqh.h"
48 #include "addb2/global.h"
49 #include "addb2/sys.h"
50 #include "module/instance.h" /* m0_get */
51 #include "balloc/balloc.h" /* BALLOC_DEF_BLOCK_SHIFT */
52 #include "motr/ha.h" /* m0_motr_ha */
53 #include "conf/ha.h" /* m0_conf_ha_process_event_post */
54 
55 extern struct io_mem_stats iommstats;
56 extern struct m0_bitmap m0t1fs_client_ep_tmid;
57 extern struct m0_mutex m0t1fs_mutex;
58 
59 static char *local_addr = "0@lo:12345:45:";
60 M0_INTERNAL const struct m0_fid M0_ROOT_FID = {
61  .f_container = 1ULL,
62  .f_key = 1ULL
63 };
64 
65 #define M0T1FS_NAME_LEN 256
66 
67 module_param(local_addr, charp, S_IRUGO);
68 MODULE_PARM_DESC(local_addr, "End-point address of m0t1fs "
69  "e.g. 172.18.50.40@o2ib1:12345:34:\n"
70  "the tmid will be generated and filled by every mount");
71 
73 module_param(tm_recv_queue_min_len , int, S_IRUGO);
74 MODULE_PARM_DESC(tm_recv_queue_min_len, "TM receive queue minimum length");
75 
77 module_param(max_rpc_msg_size, int, S_IRUGO);
78 MODULE_PARM_DESC(max_rpc_msg_size, "Maximum RPC message size");
79 
80 static int addb2_net_disable = 0;
81 module_param(addb2_net_disable, int, S_IRUGO);
82 MODULE_PARM_DESC(addb2_net_disable, "Disable addb2 records network submit");
83 
84 M0_INTERNAL void io_bob_tlists_init(void);
85 static int m0t1fs_statfs(struct dentry *dentry, struct kstatfs *buf);
86 static void inodes_layout_ref_drop(struct m0t1fs_sb *csb);
87 static bool m0t1fs_conf_ready_async_cb(struct m0_clink *clink);
88 static void conf_ready_async_cb_locked(struct m0t1fs_sb *csb);
89 
90 static const struct super_operations m0t1fs_super_operations = {
91  .statfs = m0t1fs_statfs,
92  .alloc_inode = m0t1fs_alloc_inode,
93  .destroy_inode = m0t1fs_destroy_inode,
94  .drop_inode = generic_delete_inode, /* provided by linux kernel */
95  .sync_fs = m0t1fs_sync_fs
96 };
97 
98 M0_TL_DESCR_DEFINE(csb_inodes, "m0t1fs_inode anchored in m0t1fs_sb", M0_INTERNAL,
99  struct m0t1fs_inode,
100  ci_sb_linkage, ci_magic,
102 
103 M0_TL_DEFINE(csb_inodes, M0_INTERNAL, struct m0t1fs_inode);
104 
105 M0_INTERNAL void m0t1fs_fs_lock(struct m0t1fs_sb *csb)
106 {
107  M0_ENTRY();
108  m0_mutex_lock(&csb->csb_mutex);
109  M0_LEAVE();
110 }
111 
112 M0_INTERNAL void m0t1fs_fs_unlock(struct m0t1fs_sb *csb)
113 {
114  M0_ENTRY();
115  m0_mutex_unlock(&csb->csb_mutex);
116  M0_LEAVE();
117 }
118 
119 M0_INTERNAL bool m0t1fs_fs_is_locked(const struct m0t1fs_sb *csb)
120 {
121  return m0_mutex_is_locked(&csb->csb_mutex);
122 }
123 
129 M0_INTERNAL struct m0_rpc_session *
130 m0t1fs_filename_to_mds_session(const struct m0t1fs_sb *csb,
131  const unsigned char *filename,
132  unsigned int nlen,
133  bool use_hint,
134  uint32_t hash_hint)
135 {
136  struct m0_reqh_service_ctx *ctx;
137  const struct m0_pools_common *pc;
138  unsigned long hash;
139  M0_ENTRY();
140 
141  if (use_hint)
142  hash = hash_hint;
143  else {
144  /* If operations don't have filename, we map it to mds 0 */
145  if (filename != NULL && nlen != 0)
146  hash = m0_full_name_hash(filename, nlen);
147  else
148  hash = 0;
149  }
150  pc = &csb->csb_pools_common;
151  ctx = pc->pc_mds_map[hash % pc->pc_nr_svcs[M0_CST_MDS]];
152  M0_ASSERT(ctx != NULL);
153 
154  M0_LOG(M0_DEBUG, "%8s->index=%llu ctx=%p session=%p",
155  (const char*)filename,
156  hash % pc->pc_nr_svcs[M0_CST_MDS], ctx, &ctx->sc_rlink.rlk_sess);
157  M0_LEAVE();
158  return &ctx->sc_rlink.rlk_sess;
159 }
160 
165 M0_INTERNAL struct m0_rpc_session *
167  uint64_t container_id)
168 {
169  struct m0_reqh_service_ctx *ctx;
170 
171  M0_ENTRY();
172  M0_PRE(container_id < pver->pv_pc->pc_nr_devices);
173 
174  M0_LOG(M0_DEBUG, "container_id=%llu", container_id);
175 
176  ctx = pver->pv_pc->pc_dev2svc[container_id].pds_ctx;
177  M0_ASSERT(ctx != NULL);
178 
179  M0_LOG(M0_DEBUG, "id %llu -> ctx=%p session=%p", container_id, ctx,
180  &ctx->sc_rlink.rlk_sess);
181  M0_LEAVE();
182  return &ctx->sc_rlink.rlk_sess;
183 }
184 
185 static int _fs_stats_fetch(struct m0t1fs_sb *csb, struct m0_fs_stats *stats)
186 {
187  struct m0_spiel_core spc = {
188  .spc_profile = *m0_reqh2profile(&csb->csb_reqh),
189  .spc_rmachine = &csb->csb_rpc_machine,
190  .spc_confc = m0_reqh2confc(&csb->csb_reqh),
191  };
192 
193  M0_ENTRY();
194  M0_ASSERT(spc.spc_rmachine != NULL);
195  return M0_RC(m0_spiel__fs_stats_fetch(&spc, stats));
196 }
197 
198 static int m0t1fs_statfs(struct dentry *dentry, struct kstatfs *buf)
199 {
200  struct m0t1fs_sb *csb = M0T1FS_SB(dentry->d_sb);
201  struct m0_fs_stats stats = {};
202  int rc;
204  M0_ENTRY();
205 
207  if (rc != 0)
208  return M0_ERR(rc);
210  if (rc == 0) {
219  buf->f_bsize = 1 << BALLOC_DEF_BLOCK_SHIFT;
220 
221  /* space on disks */
222  buf->f_blocks = stats.fs_total_disk / buf->f_bsize;
223  buf->f_bfree = stats.fs_free_disk / buf->f_bsize;
224 
225  /* space in metadata segments (inodes) */
226  buf->f_files = stats.fs_total_seg / 512;
227  buf->f_ffree = stats.fs_free_seg / 512;
228 
229  buf->f_bavail = stats.fs_avail_disk / buf->f_bsize;
230  buf->f_namelen = M0T1FS_NAME_LEN;
231  buf->f_type = M0_T1FS_SUPER_MAGIC;
232  }
234  return M0_RC(rc);
235 }
236 
237 /* ----------------------------------------------------------------
238  * Mount options
239  * ---------------------------------------------------------------- */
240 
241 struct mount_opts {
242  char *mo_ha;
243  char *mo_profile;
245  char *mo_ep;
246  uint32_t mo_fid_start;
247 };
248 
258 };
259 
260 static const match_table_t m0t1fs_mntopt_tokens = {
261  { M0T1FS_MNTOPT_CONFD, "ha=%s" },
262  { M0T1FS_MNTOPT_PROFILE, "profile=%s" },
263  { M0T1FS_MNTOPT_PROCESS_FID,"pfid=%s" },
264  { M0T1FS_MNTOPT_FID_START, "fid_start=%s" },
265  { M0T1FS_MNTOPT_EP, "ep=%s" },
266  { M0T1FS_MNTOPT_OOSTORE, "oostore" },
267  { M0T1FS_MNTOPT_VERIFY, "verify" },
268  /* match_token() requires 2nd field of the last element to be NULL */
270 };
271 
272 static void mount_opts_fini(struct mount_opts *mops)
273 {
274  M0_ENTRY();
275 
276  /* Here we use kfree() instead of m0_free() because the memory
277  * was allocated using match_strdup(). */
278  kfree(mops->mo_ha);
279  kfree(mops->mo_profile);
280  kfree(mops->mo_process_fid);
281  kfree(mops->mo_ep);
282  M0_SET0(mops);
283 
284  M0_LEAVE();
285 }
286 
287 static int str_parse(char **dest, const substring_t *src)
288 {
289  *dest = match_strdup(src);
290  return *dest == NULL ? -ENOMEM : 0;
291 }
292 
293 static int num_parse(uint32_t *dest, const substring_t *src)
294 {
295  unsigned long n;
296  char *s;
297  int rc;
298 
299  s = match_strdup(src);
300  if (s == NULL)
301  return M0_ERR(-ENOMEM);
302 
303  rc = kstrtoul(s, 10, &n);
304  if (rc == 0) {
305  if (n > UINT32_MAX)
306  rc = -EINVAL;
307  else
308  *dest = (uint32_t)n;
309  }
310 
311  kfree(s);
312  return M0_RC(rc);
313 }
314 
315 static bool is_empty(const char *s)
316 {
317  return s == NULL || *s == '\0';
318 }
319 
320 static int mount_opts_validate(const struct mount_opts *mops)
321 {
322  if (is_empty(mops->mo_ha))
323  return M0_ERR_INFO(-EINVAL,
324  "Mandatory parameter is missing: ha");
325  if (is_empty(mops->mo_profile))
326  return M0_ERR_INFO(-EINVAL,
327  "Mandatory parameter is missing: profile");
328  if (is_empty(mops->mo_process_fid))
329  return M0_ERR_INFO(-EINVAL,
330  "Mandatory parameter is missing: pfid");
331  if (mops->mo_fid_start != 0 &&
333  return M0_ERR_INFO(-EINVAL,
334  "fid_start must be greater than %llu",
336  return M0_RC(0);
337 }
338 
339 static int mount_opts_parse(struct m0t1fs_sb *csb, char *options,
340  struct mount_opts *dest)
341 {
342  substring_t args[MAX_OPT_ARGS];
343  char *op;
344  int rc = 0;
345 
346  M0_ENTRY();
347 
348  if (options == NULL)
349  return M0_RC(-EINVAL);
350 
351  M0_LOG(M0_INFO, "Mount options: `%s'", options);
352 
353  M0_SET0(dest);
354  dest->mo_fid_start = M0_MDSERVICE_START_FID.f_key; /* default value */
355 
356  while ((op = strsep(&options, ",")) != NULL && *op != '\0') {
357  switch (match_token(op, m0t1fs_mntopt_tokens, args)) {
358  case M0T1FS_MNTOPT_CONFD:
359  rc = str_parse(&dest->mo_ha, args);
360  if (rc != 0)
361  goto out;
362  M0_LOG(M0_INFO, "HA: %s", dest->mo_ha);
363  break;
364 
366  rc = str_parse(&dest->mo_profile, args);
367  if (rc != 0)
368  goto out;
369  M0_LOG(M0_INFO, "profile: %s", dest->mo_profile);
370  break;
371 
373  rc = str_parse(&dest->mo_process_fid, args);
374  if (rc != 0)
375  goto out;
376  M0_LOG(M0_INFO, "pfid: %s", dest->mo_process_fid);
377  break;
378 
380  rc = num_parse(&dest->mo_fid_start, args);
381  if (rc != 0)
382  goto out;
383  M0_LOG(M0_INFO, "fid-start: %lu",
384  (unsigned long)dest->mo_fid_start);
385  break;
386 
387  case M0T1FS_MNTOPT_EP:
388  rc = str_parse(&dest->mo_ep, args);
389  if (rc != 0)
390  goto out;
391  M0_LOG(M0_INFO, "ep: %s", dest->mo_ep);
392  break;
393 
395  csb->csb_oostore = true;
396  M0_LOG(M0_DEBUG, "OOSTORE mode!!");
397  break;
399  csb->csb_verify = true;
400  M0_LOG(M0_DEBUG, "Parity verify mode!!");
401  break;
402  default:
403  return M0_ERR_INFO(-EINVAL, "Unsupported option: %s", op);
404  }
405  }
406 out:
407  /*
408  * If there is an error, the allocated memory will be freed by
409  * mount_opts_fini(), called by m0t1fs_fill_super().
410  */
411  return M0_RC(rc ?: mount_opts_validate(dest));
412 }
413 
414 
415 /* ----------------------------------------------------------------
416  * Superblock
417  * ---------------------------------------------------------------- */
418 
419 static void ast_thread(struct m0t1fs_sb *csb);
420 static void ast_thread_stop(struct m0t1fs_sb *csb);
421 static void m0t1fs_obf_dealloc(struct m0t1fs_sb *csb);
422 
423 M0_INTERNAL void m0t1fs_sb_init(struct m0t1fs_sb *csb)
424 {
425  M0_ENTRY("csb = %p", csb);
426  M0_PRE(csb != NULL);
427 
428  M0_SET0(csb);
429  m0_mutex_init(&csb->csb_mutex);
430  m0_sm_group_init(&csb->csb_iogroup);
431  csb->csb_active = true;
432  m0_chan_init(&csb->csb_iowait, &csb->csb_iogroup.s_lock);
433  m0_atomic64_set(&csb->csb_pending_io_nr, 0);
434  csb->csb_oostore = false;
435  csb->csb_verify = false;
436  csb->csb_reqs_nr = 0;
437  csb->csb_confc_state.cus_state = M0_CC_REVOKED;
438  m0_mutex_init(&csb->csb_confc_state.cus_lock);
439  m0_mutex_init(&csb->csb_inodes_lock);
440  csb_inodes_tlist_init(&csb->csb_inodes);
441  m0_chan_init(&csb->csb_conf_ready_chan, &csb->csb_confc_state.cus_lock);
442  M0_LEAVE();
443 }
444 
445 M0_INTERNAL void m0t1fs_sb_fini(struct m0t1fs_sb *csb)
446 {
447  M0_ENTRY();
448  M0_PRE(csb != NULL);
449  m0_chan_fini_lock(&csb->csb_conf_ready_chan);
450  csb_inodes_tlist_fini(&csb->csb_inodes);
451  m0_mutex_fini(&csb->csb_inodes_lock);
452  m0_mutex_fini(&csb->csb_confc_state.cus_lock);
453  m0_chan_fini_lock(&csb->csb_iowait);
454  m0_sm_group_fini(&csb->csb_iogroup);
455  m0_mutex_fini(&csb->csb_mutex);
456  csb->csb_next_key = 0;
457  csb->csb_confc_state.cus_state = M0_CC_REVOKED;
458  M0_LEAVE();
459 }
460 
461 /* ----------------------------------------------------------------
462  * HA service connectivity
463  * ---------------------------------------------------------------- */
464 
465 static void m0t1fs_ha_process_event(struct m0t1fs_sb *csb,
466  enum m0_conf_ha_process_event event)
467 {
468  m0_conf_ha_process_event_post(&csb->csb_motr_ha.mh_ha,
469  csb->csb_motr_ha.mh_link,
470  &csb->csb_process_fid, 0,
472 }
473 
478 int m0t1fs_ha_init(struct m0t1fs_sb *csb, const char *ha_addr)
479 {
481  int rc;
482 
483  M0_ENTRY();
484  motr_ha_cfg = (struct m0_motr_ha_cfg){
485  .mhc_dispatcher_cfg = {
486  .hdc_enable_note = true,
487  .hdc_enable_keepalive = true,
488  .hdc_enable_fvec = true,
489  },
490  .mhc_addr = ha_addr,
491  .mhc_rpc_machine = &csb->csb_rpc_machine,
492  .mhc_reqh = &csb->csb_reqh,
493  .mhc_process_fid = csb->csb_process_fid,
494  };
495  rc = m0_motr_ha_init(&csb->csb_motr_ha, &motr_ha_cfg);
496  M0_ASSERT(rc == 0);
497  rc = m0_motr_ha_start(&csb->csb_motr_ha);
498  M0_ASSERT(rc == 0);
499  m0_motr_ha_connect(&csb->csb_motr_ha);
501  return M0_RC(0);
502 }
503 
507 void m0t1fs_ha_fini(struct m0t1fs_sb *csb)
508 {
509  M0_ENTRY("csb: %p", csb);
511  m0_motr_ha_disconnect(&csb->csb_motr_ha);
512  m0_motr_ha_stop(&csb->csb_motr_ha);
513  m0_motr_ha_fini(&csb->csb_motr_ha);
514 
515  M0_LEAVE();
516 }
517 
518 /*
519  * ----------------------------------------------------------------
520  * Layout
521  * ----------------------------------------------------------------
522  */
523 
524 static int m0t1fs_sb_mdpool_layouts_init(struct m0t1fs_sb *csb)
525 {
526  M0_ENTRY();
527  return M0_RC(m0_reqh_mdpool_layout_build(&csb->csb_reqh));
528 }
529 
530 static void m0t1fs_sb_layouts_fini(struct m0t1fs_sb *csb)
531 {
532  M0_ENTRY();
533  m0_reqh_layouts_cleanup(&csb->csb_reqh);
534  M0_LEAVE();
535 }
536 
537 void m0t1fs_rm_service_quit(struct m0t1fs_sb *csb)
538 {
539  m0_reqh_service_quit(csb->csb_rm_service);
540 }
541 
542 int m0t1fs_rm_service_start(struct m0t1fs_sb *csb)
543 {
544  struct m0_reqh *reqh = &csb->csb_reqh;
545  struct m0_fid sfid;
546  int rc = 0;
547  struct m0_fid fake_pfid
549 
550  /*
551  * @todo Use fake process fid for init script based cluster setup.
552  * Init script based setup not adding m0t1fs process
553  * to configuration and also not passing m0t1fs process
554  * FID to mount.
555  */
556  if (!m0_fid_eq(&reqh->rh_fid, &fake_pfid)) {
558  &reqh->rh_fid, M0_CST_RMS,
559  &sfid);
560  if (rc)
561  return M0_RC(rc);
562  } else {
563  m0_uuid_generate((struct m0_uint128 *)&sfid);
565  }
566 
567  rc = m0_reqh_service_setup(&csb->csb_rm_service, &m0_rms_type,
568  reqh, NULL, &sfid);
569  return rc == 0 ? M0_RC(rc) :
570  M0_ERR_INFO(rc, "failed to start RM service: rc=%d", rc);
571 }
572 
573 int m0t1fs_net_init(struct m0t1fs_sb *csb, const char *ep)
574 {
575  struct m0_net_domain *ndom;
576  int rc;
577  char *laddr = NULL;
578 
579  M0_ENTRY();
580  if (ep == NULL) {
581  laddr = m0_alloc(M0_NET_LNET_NIDSTR_SIZE * 2);
582  if (laddr == NULL)
583  return M0_RC(-ENOMEM);
584 
587  if (csb->csb_tmid == ((size_t)-1)) {
589  m0_free(laddr);
590  return M0_RC(-EMFILE);
591  }
592  m0_bitmap_set(&m0t1fs_client_ep_tmid, csb->csb_tmid, true);
594 
595  snprintf(laddr, M0_NET_LNET_NIDSTR_SIZE * 2,
596  "%s%d", local_addr, (int)csb->csb_tmid);
597  M0_LOG(M0_DEBUG, "local ep is %s", laddr);
598  csb->csb_laddr = laddr;
599  }
600  csb->csb_xprt = m0_net_xprt_default_get();
601  ndom = &csb->csb_ndom;
602 
603  rc = m0_net_domain_init(ndom, csb->csb_xprt);
604  if (rc != 0) {
605  csb->csb_laddr = NULL;
606  if (ep == NULL) {
607  m0_free(laddr);
610  csb->csb_tmid, false);
612  }
613  }
614  M0_LEAVE("rc: %d", rc);
615  return M0_RC(rc);
616 }
617 
618 void m0t1fs_net_fini(struct m0t1fs_sb *csb)
619 {
620  M0_ENTRY();
621 
622  m0_net_domain_fini(&csb->csb_ndom);
623  m0_free(csb->csb_laddr);
625  m0_bitmap_set(&m0t1fs_client_ep_tmid, csb->csb_tmid, false);
627 
628  M0_LEAVE();
629 }
630 
631 int m0t1fs_rpc_init(struct m0t1fs_sb *csb, const char *ep)
632 {
633  struct m0_rpc_machine *rpc_machine = &csb->csb_rpc_machine;
634  struct m0_reqh *reqh = &csb->csb_reqh;
635  struct m0_net_domain *ndom = &csb->csb_ndom;
636  const char *laddr;
637  struct m0_net_buffer_pool *buffer_pool = &csb->csb_buffer_pool;
638  struct m0_net_transfer_mc *tm;
639  int rc;
640  uint32_t bufs_nr;
641  uint32_t tms_nr;
642 
643  M0_ENTRY();
644 
645  m0_be_ut_seg_init(&csb->csb_ut_seg,
646  &csb->csb_ut_be, 1ULL << 24);
647 
648  tms_nr = 1;
649  bufs_nr = m0_rpc_bufs_nr(tm_recv_queue_min_len, tms_nr);
650 
651  rc = m0_rpc_net_buffer_pool_setup(ndom, buffer_pool,
652  bufs_nr, tms_nr);
653  if (rc != 0)
654  goto be_fini;
655 
656  rc = M0_REQH_INIT(reqh,
657  .rhia_dtm = (void*)1,
658  .rhia_db = csb->csb_ut_seg.bus_seg,
659  .rhia_mdstore = (void*)1,
660  .rhia_pc = &csb->csb_pools_common,
661  .rhia_fid = &csb->csb_process_fid);
662  if (rc != 0)
663  goto pool_fini;
664  laddr = ep == NULL ? csb->csb_laddr : ep;
665  rc = m0_rpc_machine_init(rpc_machine, ndom, laddr, reqh,
666  buffer_pool, M0_BUFFER_ANY_COLOUR,
668  if (rc != 0)
669  goto reqh_fini;
671  tm = &rpc_machine->rm_tm;
672  M0_ASSERT(tm->ntm_recv_pool == buffer_pool);
673  return M0_RC(rc);
674 reqh_fini:
676 pool_fini:
677  m0_rpc_net_buffer_pool_cleanup(buffer_pool);
678 be_fini:
679  m0_be_ut_seg_fini(&csb->csb_ut_seg);
680  return M0_ERR(rc);
681 }
682 
683 struct m0t1fs_sb *reqh2sb(struct m0_reqh *reqh)
684 {
685  return container_of(reqh, struct m0t1fs_sb, csb_reqh);
686 }
687 
688 static struct m0t1fs_sb *rconfc2csb(struct m0_rconfc *rconfc)
689 {
690  return reqh2sb(container_of(rconfc, struct m0_reqh, rh_rconfc));
691 }
692 
693 M0_INTERNAL struct m0_rconfc *m0_csb2rconfc(struct m0t1fs_sb *csb)
694 {
695  return &csb->csb_reqh.rh_rconfc;
696 }
697 
698 M0_INTERNAL struct m0_confc *m0_csb2confc(struct m0t1fs_sb *csb)
699 {
700  return &m0_csb2rconfc(csb)->rc_confc;
701 }
702 
703 void m0t1fs_rpc_fini(struct m0t1fs_sb *csb)
704 {
705  M0_ENTRY();
706 
707  m0_rpc_machine_fini(&csb->csb_rpc_machine);
708  if (m0_reqh_state_get(&csb->csb_reqh) != M0_REQH_ST_STOPPED)
709  m0_reqh_services_terminate(&csb->csb_reqh);
710  m0_reqh_fini(&csb->csb_reqh);
711  m0_rpc_net_buffer_pool_cleanup(&csb->csb_buffer_pool);
712  m0_be_ut_seg_fini(&csb->csb_ut_seg);
713 
714  M0_LEAVE();
715 }
716 
717 /*
718  * XXX Under various scenarios it's possible that the following function blocks
719  * indefinitely. MOTR-2341 addresses the issue by taking into consideration all
720  * the possibilities.
721  */
722 M0_INTERNAL int m0t1fs_ref_get_lock(struct m0t1fs_sb *csb)
723 {
724  struct m0_clink clink;
725  int rc;
726 
727  M0_ENTRY("csb=%p", csb);
728  while (1) {
729  m0_mutex_lock(&csb->csb_confc_state.cus_lock);
730  if (M0_IN(csb->csb_confc_state.cus_state,
732  break;
734  m0_clink_add(&csb->csb_conf_ready_chan, &clink);
735 
736  m0_mutex_unlock(&csb->csb_confc_state.cus_lock);
737  /* Wait till configuration is updated. */
739 
742  }
743  M0_CNT_INC(csb->csb_reqs_nr);
744  rc = csb->csb_confc_state.cus_state == M0_CC_READY ? 0 : -ESTALE;
745  m0_mutex_unlock(&csb->csb_confc_state.cus_lock);
746  return M0_RC(rc);
747 }
748 
749 M0_INTERNAL void m0t1fs_ref_put_lock(struct m0t1fs_sb *csb)
750 {
751  m0_mutex_lock(&csb->csb_confc_state.cus_lock);
752  M0_CNT_DEC(csb->csb_reqs_nr);
753  if (csb->csb_reqs_nr == 0 &&
754  csb->csb_confc_state.cus_state == M0_CC_GETTING_READY)
756  m0_mutex_unlock(&csb->csb_confc_state.cus_lock);
757 }
758 
760 {
761  struct m0t1fs_sb *csb = container_of(clink, struct m0t1fs_sb,
762  csb_conf_exp);
763  struct m0_reqh_service_ctx *ctx;
764  uint32_t i;
765 
766  M0_ENTRY("super %p", csb);
767  if (csb->csb_reqh.rh_rconfc.rc_stopping)
768  return true;
769 
770  m0_mutex_lock(&csb->csb_confc_state.cus_lock);
771  /*
772  * Close the gate for new io and metadata requests.
773  */
774  csb->csb_confc_state.cus_state = M0_CC_REVOKED;
775  m0_mutex_unlock(&csb->csb_confc_state.cus_lock);
776 
777  /*
778  * Cancel sessions to IO services that were used during IO request
779  * handling. This is done in order to call rio_replied callback for
780  * the rpc items and interrupt io_requests.
781  * A cancelled session is reconnected. See MOTR-1642.
782  *
783  * Note: m0t1fs doesn't use CAS services, so they are not of interest.
784  */
785  for (i = 0; i < csb->csb_pools_common.pc_nr_devices; i++) {
786  ctx = csb->csb_pools_common.pc_dev2svc[i].pds_ctx;
787  if (ctx != NULL && ctx->sc_type == M0_CST_IOS
788  && ctx->sc_rlink.rlk_connected)
790  }
791 
792  M0_LEAVE();
793  return true;
794 }
795 
796 static void inodes_layout_ref_drop(struct m0t1fs_sb *csb)
797 {
798  struct m0t1fs_inode *ci;
799  struct m0_pool_version *pver;
800 
801  m0_mutex_lock(&csb->csb_inodes_lock);
802  m0_tl_for(csb_inodes, &csb->csb_inodes, ci) {
803  pver = m0_pool_version_find(&csb->csb_pools_common,
804  &ci->ci_pver);
805  if (pver != NULL && !pver->pv_is_stale)
806  continue;
807  m0_mutex_lock(&ci->ci_layout_lock);
808  if (ci->ci_layout_instance != NULL) {
809  m0_layout_instance_fini(ci->ci_layout_instance);
810  ci->ci_layout_instance = NULL;
811  }
812  m0_mutex_unlock(&ci->ci_layout_lock);
813  } m0_tl_endfor;
814  m0_mutex_unlock(&csb->csb_inodes_lock);
815 }
816 
818 {
819  struct m0t1fs_sb *csb = M0_AMB(csb, clink, csb_conf_ready_async);
820 
821  M0_ENTRY("super %p", csb);
822 
823  m0_mutex_lock(&csb->csb_confc_state.cus_lock);
824  if (csb->csb_reqs_nr == 0 &&
825  csb->csb_confc_state.cus_state == M0_CC_GETTING_READY)
827  m0_mutex_unlock(&csb->csb_confc_state.cus_lock);
828 
829  M0_LEAVE();
830  return true;
831 }
832 
833 static void conf_ready_async_cb_locked(struct m0t1fs_sb *csb)
834 {
835  struct m0_clink *pc_clink = &csb->csb_pools_common.pc_conf_ready_async;
836 
837  M0_PRE(m0_mutex_is_locked(&csb->csb_confc_state.cus_lock));
838 
839  m0_pool_versions_stale_mark(&csb->csb_pools_common,
840  &csb->csb_confc_state);
842  /*
843  * During m0t1fs_setup() pools_common stays uninitialized
844  * at this point.
845  */
846  if (csb->csb_pools_common.pc_confc != NULL)
848  csb->csb_confc_state.cus_state = M0_CC_READY;
849  m0_chan_broadcast(&csb->csb_conf_ready_chan);
850 }
851 
880 static bool m0t1fs_conf_ready_cb(struct m0_clink *clink)
881 {
882  struct m0t1fs_sb *csb = M0_AMB(csb, clink, csb_conf_ready);
883  m0_mutex_lock(&csb->csb_confc_state.cus_lock);
884  csb->csb_confc_state.cus_state = M0_CC_GETTING_READY;
885  m0_mutex_unlock(&csb->csb_confc_state.cus_lock);
886  return true;
887 }
888 
890 {
891  struct m0t1fs_sb *csb = rconfc2csb(rconfc);
892 
893  M0_ENTRY("rconfc %p", rconfc);
894  m0_mutex_lock(&csb->csb_confc_state.cus_lock);
895  csb->csb_confc_state.cus_state = M0_CC_FAILED;
896  m0_mutex_unlock(&csb->csb_confc_state.cus_lock);
897  m0_chan_broadcast_lock(&csb->csb_conf_ready_chan);
898  M0_LEAVE();
899 }
900 
901 static int m0t1fs_fid_sscanf(const char *s,
902  struct m0_fid *fid,
903  const char *descr)
904 {
905  int rc = m0_fid_sscanf(s, fid);
906 
907  if (rc != 0)
908  return M0_ERR_INFO(rc, "can't m0_fid_sscanf() %s %s", descr, s);
909  return M0_RC(0);
910 }
911 
912 int m0t1fs_setup(struct m0t1fs_sb *csb, const struct mount_opts *mops)
913 {
914  struct m0_addb2_sys *sys = m0_addb2_global_get();
915  struct m0_pools_common *pc = &csb->csb_pools_common;
916  struct m0_confc_args *confc_args;
917  struct m0_reqh *reqh = &csb->csb_reqh;
918  struct m0_conf_root *root;
919  struct m0_pool_version *pv;
920  int rc;
921 
922  M0_ENTRY();
923  M0_PRE(csb->csb_astthread.t_state == TS_RUNNING);
924 
925  rc = m0t1fs_fid_sscanf(mops->mo_process_fid, &csb->csb_process_fid,
926  "process fid");
927  if (rc != 0)
928  return M0_ERR(rc);
929 
930  rc = m0t1fs_fid_sscanf(mops->mo_profile, &csb->csb_profile_fid,
931  "profile");
932  if (rc != 0)
933  return M0_ERR(rc);
934 
935  rc = m0t1fs_net_init(csb, mops->mo_ep);
936  if (rc != 0)
937  return M0_ERR(rc);
938 
939  rc = m0t1fs_rpc_init(csb, mops->mo_ep);
940  if (rc != 0)
941  goto err_net_fini;
942 
943  csb->csb_next_key = mops->mo_fid_start;
944 
945  confc_args = &(struct m0_confc_args) {
946  .ca_profile = mops->mo_profile,
947  .ca_rmach = &csb->csb_rpc_machine,
948  .ca_group = m0_locality0_get()->lo_grp,
949  };
950 
951  rc = m0t1fs_ha_init(csb, mops->mo_ha);
952  if (rc != 0)
953  goto err_rpc_fini;
954 
955  rc = m0_reqh_conf_setup(reqh, confc_args);
956  if (rc != 0)
957  goto err_ha_fini;
958  m0_clink_init(&csb->csb_conf_exp, m0t1fs_conf_expired_cb);
959  m0_clink_init(&csb->csb_conf_ready, m0t1fs_conf_ready_cb);
960  m0_clink_init(&csb->csb_conf_ready_async, m0t1fs_conf_ready_async_cb);
961  /*
962  * Note: csb clinks shall be registered with conf update channels before
963  * pools_common's clinks. @see m0_reqh.
964  */
965  m0_clink_add_lock(&reqh->rh_conf_cache_exp, &csb->csb_conf_exp);
966  m0_clink_add_lock(&reqh->rh_conf_cache_ready, &csb->csb_conf_ready);
968  &csb->csb_conf_ready_async);
969 
971  if (rc != 0)
972  goto err_rconfc_stop;
974  if (rc != 0)
975  goto err_rconfc_stop;
976 
978  if (rc != 0)
979  goto err_conf_fs_close;
981  if (rc != 0)
982  goto err_conf_fs_close;
983 
984  rc = m0_pools_common_init(pc, &csb->csb_rpc_machine);
985  if (rc != 0)
986  goto err_conf_fs_close;
987  M0_ASSERT(ergo(csb->csb_oostore, pc->pc_md_redundancy > 0));
988 
989  rc = m0_pools_setup(pc, &csb->csb_profile_fid, NULL, NULL);
990  if (rc != 0)
991  goto err_pools_common_fini;
992 
994  if (rc != 0)
995  goto err_pools_destroy;
997 
999  if (rc != 0)
1000  goto err_pools_service_ctx_destroy;
1001 
1002  /* Find pool and pool version to use. */
1003  rc = m0_pool_version_get(&csb->csb_pools_common, NULL, &pv);
1004  if (!M0_IN(rc, (0, -ENOENT)))
1005  goto err_pool_versions_destroy;
1006 
1008  if (rc != 0)
1009  goto err_pool_versions_destroy;
1010 
1012  if (rc != 0)
1013  goto err_rm_service_quit;
1014 
1016  if (rc == 0) {
1022  return M0_RC(0);
1023  }
1024 
1025 err_rm_service_quit:
1027 err_pool_versions_destroy:
1029  m0_pool_versions_destroy(&csb->csb_pools_common);
1030 err_pools_service_ctx_destroy:
1031  m0_pools_service_ctx_destroy(&csb->csb_pools_common);
1032 err_pools_destroy:
1033  m0_pools_destroy(&csb->csb_pools_common);
1034 err_pools_common_fini:
1035  m0_pools_common_fini(&csb->csb_pools_common);
1036 err_conf_fs_close:
1038 err_rconfc_stop:
1041  m0_clink_del_lock(&csb->csb_conf_exp);
1042  m0_clink_del_lock(&csb->csb_conf_ready);
1043  m0_clink_del_lock(&csb->csb_conf_ready_async);
1044  m0_clink_fini(&csb->csb_conf_exp);
1045  m0_clink_fini(&csb->csb_conf_ready);
1046  m0_clink_fini(&csb->csb_conf_ready_async);
1047 err_ha_fini:
1049 err_rpc_fini:
1050  /*
1051  * Reqh services are terminated not in reverse order because
1052  * m0_reqh_services_terminate() terminates all services including
1053  * rpc_service. Rpc_service starts in m0t1fs_rpc_init() implicitly.
1054  */
1057 err_net_fini:
1059 
1060  return M0_ERR(rc);
1061 }
1062 
1063 static void m0t1fs_teardown(struct m0t1fs_sb *csb)
1064 {
1067  /* @todo Make a separate unconfigure api and do this in that */
1068  m0_pool_versions_destroy(&csb->csb_pools_common);
1069  m0_pools_service_ctx_destroy(&csb->csb_pools_common);
1070  m0_pools_destroy(&csb->csb_pools_common);
1071  m0_pools_common_fini(&csb->csb_pools_common);
1074  m0_clink_del_lock(&csb->csb_conf_exp);
1075  m0_clink_del_lock(&csb->csb_conf_ready);
1076  m0_clink_del_lock(&csb->csb_conf_ready_async);
1077  m0_clink_fini(&csb->csb_conf_exp);
1078  m0_clink_fini(&csb->csb_conf_ready);
1079  m0_clink_fini(&csb->csb_conf_ready_async);
1080  /*
1081  * Finalise explicitly to send HA service events STOPPING/STOPPED.
1082  * See MOTR-2427 for the reference.
1083  * @see m0_conf_ha_service_event, m0_conf_ha_service_event_post().
1084  */
1087  m0_reqh_services_terminate(&csb->csb_reqh);
1090 }
1091 
1092 static void m0t1fs_dput(struct dentry *dentry)
1093 {
1094 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
1095  clear_nlink(dentry->d_inode);
1096 #else
1097  dentry->d_inode->i_nlink = 0;
1098 #endif
1099  d_delete(dentry);
1100  dput(dentry);
1101 }
1102 
1103 static void m0t1fs_obf_dealloc(struct m0t1fs_sb *csb) {
1104  M0_ENTRY();
1105 
1106  M0_PRE(csb != NULL);
1107 
1108  if (csb->csb_fid_dentry != NULL) {
1109  m0t1fs_dput(csb->csb_fid_dentry);
1110  csb->csb_fid_dentry = NULL;
1111  }
1112  if (csb->csb_motr_dentry != NULL) {
1113  m0t1fs_dput(csb->csb_motr_dentry);
1114  csb->csb_motr_dentry = NULL;
1115  }
1116 
1117  M0_LEAVE();
1118 }
1119 
1120 M0_INTERNAL int m0t1fs_fill_cob_attr(struct m0_fop_cob *body)
1121 {
1122  struct m0t1fs_sb *csb = M0_AMB(csb, body, csb_virt_body);
1123 
1124  M0_PRE(body != NULL);
1125 
1126  body->b_atime = body->b_ctime = body->b_mtime =
1132  body->b_blocks = 16;
1133  body->b_size = 4096;
1134  body->b_blksize = 4096;
1135  body->b_nlink = 2;
1136  body->b_lid = M0_DEFAULT_LAYOUT_ID;
1137  body->b_mode = (S_IFDIR | S_IRUSR | S_IWUSR | S_IXUSR |/*rwx for owner*/
1138  S_IRGRP | S_IXGRP | /*r-x for group*/
1139  S_IROTH | S_IXOTH);
1140 
1141  return M0_RC(0);
1142 }
1143 
1144 static int m0t1fs_obf_alloc(struct super_block *sb)
1145 {
1146  struct inode *motr_inode;
1147  struct dentry *motr_dentry;
1148  struct inode *fid_inode;
1149  struct dentry *fid_dentry;
1150  struct m0t1fs_sb *csb = M0T1FS_SB(sb);
1151  struct m0_fop_cob *body = &csb->csb_virt_body;
1152  int rc;
1153 
1154  M0_ENTRY();
1155 
1157  if (rc != 0)
1158  return M0_ERR(rc);
1159 
1160  /* Init virtual .motr directory */
1161  motr_dentry = d_alloc_name(sb->s_root, M0_DOT_MOTR_NAME);
1162  if (motr_dentry == NULL)
1163  return M0_RC(-ENOMEM);
1164 
1166  motr_inode = m0t1fs_iget(sb, &M0_DOT_MOTR_FID, body);
1168  if (IS_ERR(motr_inode)) {
1169  dput(motr_dentry);
1170  M0_LOG(M0_ERROR, "m0t1fs_iget(M0_DOT_MOTR_FID) failed, rc=%d",
1171  (int)PTR_ERR(motr_inode));
1172  return M0_RC((int)PTR_ERR(motr_inode));
1173  }
1174 
1175  /* Init virtual .motr/fid directory */
1176  fid_dentry = d_alloc_name(motr_dentry, M0_DOT_MOTR_FID_NAME);
1177  if (fid_dentry == NULL) {
1178  iput(motr_inode);
1179  dput(motr_dentry);
1180  M0_LOG(M0_ERROR, "m0t1fs_iget(M0_DOT_MOTR_FID_NAME) "
1181  "failed, rc=%d", -ENOMEM);
1182  return M0_RC(-ENOMEM);
1183  }
1184 
1186  fid_inode = m0t1fs_iget(sb, &M0_DOT_MOTR_FID_FID, body);
1188  if (IS_ERR(fid_inode)) {
1189  dput(fid_dentry);
1190  iput(motr_inode);
1191  dput(motr_dentry);
1192  M0_LOG(M0_ERROR, "m0t1fs_iget(M0_DOT_MOTR_FID_FID) "
1193  "failed, rc=%d", (int)PTR_ERR(fid_inode));
1194  return M0_RC((int)PTR_ERR(fid_inode));
1195  }
1196 
1197  d_add(motr_dentry, motr_inode);
1198  csb->csb_motr_dentry = motr_dentry;
1199 
1200  d_add(fid_dentry, fid_inode);
1201  csb->csb_fid_dentry = fid_dentry;
1202 
1203  return M0_RC(0);
1204 }
1205 
1206 static void service_connect_wait(struct m0t1fs_sb *csb)
1207 {
1208  struct m0t1fs_mdop mo;
1209  struct m0_rpc_session *session;
1210  struct m0_reqh_service_ctx *ctx;
1211 
1212  M0_SET0(&mo);
1214  mo.mo_attr.ca_name.b_addr,
1215  mo.mo_attr.ca_name.b_nob,
1216  mo.mo_use_hint,
1217  mo.mo_hash_hint);
1220 }
1221 
1222 static int m0t1fs_root_alloc(struct super_block *sb)
1223 {
1224  struct inode *root_inode;
1225  int rc = 0;
1226  struct m0t1fs_sb *csb = M0T1FS_SB(sb);
1227  struct m0_fop_statfs_rep *rep = NULL;
1228  struct m0_fop *rep_fop = NULL;
1230 
1231  M0_ENTRY();
1232 
1233  if (!csb->csb_oostore) {
1236  if (rc != 0)
1237  goto out;
1238  rep = m0_fop_data(rep_fop);
1239  sb->s_magic = rep->f_type;
1240  csb->csb_namelen = rep->f_namelen;
1241 
1242  M0_LOG(M0_DEBUG, "Got mdservice root "FID_F,
1243  FID_P(&rep->f_root));
1244  } else
1245  csb->csb_namelen = M0T1FS_NAME_LEN;
1246 
1248  root_inode = m0t1fs_root_iget(sb, csb->csb_oostore ? &M0_ROOT_FID :
1249  &rep->f_root);
1251  if (IS_ERR(root_inode)) {
1252  rc = (int)PTR_ERR(root_inode);
1253  goto out;
1254  }
1255 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
1256  sb->s_root = d_make_root(root_inode);
1257 #else
1258  sb->s_root = d_alloc_root(root_inode);
1259 #endif
1260  if (sb->s_root == NULL) {
1261  iput(root_inode);
1262  rc = -ENOMEM;
1263  goto out;
1264  }
1265 
1266 out:
1268  return M0_RC(rc);
1269 }
1270 
1271 static int m0t1fs_fill_super(struct super_block *sb, void *data,
1272  int silent __attribute__((unused)))
1273 {
1274  struct m0t1fs_sb *csb;
1275  int rc;
1276  struct mount_opts mops = {0};
1277 
1278  M0_ENTRY();
1279 
1280  if (addb2_net_disable != 0)
1281  m0_get()->i_disable_addb2_storage = true;
1282 
1283  M0_ALLOC_PTR(csb);
1284  if (csb == NULL) {
1285  rc = M0_ERR(-ENOMEM);
1286  goto end;
1287  }
1289  csb->csb_sb = sb;
1290  rc = mount_opts_parse(csb, data, &mops);
1291  if (rc != 0)
1292  goto sb_fini;
1293 
1294 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
1295  rc = bdi_init(&csb->csb_backing_dev_info);
1296  if (rc != 0)
1297  goto sb_fini;
1298 #endif
1299 
1300  rc = M0_THREAD_INIT(&csb->csb_astthread, struct m0t1fs_sb *, NULL,
1301  &ast_thread, csb, "m0_ast_thread");
1302  if (rc != 0)
1303  goto sb_fini;
1304 
1305  rc = m0t1fs_setup(csb, &mops);
1306  if (rc != 0)
1307  goto thread_stop;
1308 
1309  sb->s_fs_info = csb;
1310  sb->s_blocksize = PAGE_SIZE;
1311  sb->s_blocksize_bits = PAGE_SHIFT;
1312  sb->s_maxbytes = MAX_LFS_FILESIZE;
1313  sb->s_op = &m0t1fs_super_operations;
1314 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
1315  /* for .sync_fs() callback to be called by kernel */
1316  sb->s_bdi = NULL;
1317  rc = bdi_register_dev(&csb->csb_backing_dev_info, sb->s_dev);
1318  if (rc != 0) {
1319  M0_LOG(M0_ERROR, "bdi_register_dev() failed, rc=%d", rc);
1320  goto m0t1fs_teardown;
1321  }
1322  sb->s_bdi = &csb->csb_backing_dev_info;
1323 #endif
1324 
1325 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,9,0)
1326  sb->s_xattr = m0t1fs_xattr_handlers;
1327 #endif
1328  rc = m0t1fs_root_alloc(sb);
1329  if (rc != 0) {
1330  M0_LOG(M0_ERROR, "m0t1fs_root_alloc() failed, rc=%d", rc);
1331  goto m0t1fs_teardown;
1332  }
1333 
1334  rc = m0t1fs_obf_alloc(sb);
1335  if (rc != 0) {
1336  M0_LOG(M0_ERROR, "m0t1fs_obf_alloc() failed, rc=%d", rc);
1337  goto m0t1fs_teardown;
1338  }
1339 
1341  M0_SET0(&iommstats);
1342 
1344  /*
1345  For m0t1fs client, M0_NC_DTM_RECOVERING state is transient,
1346  sending M0_CONF_HA_PROCESS_DTM_RECOVERED just after
1347  M0_CONF_HA_PROCESS_STARTED.
1348 
1349  m0t1fs_ha_process_event(csb, M0_CONF_HA_PROCESS_DTM_RECOVERED);
1350  */
1351  return M0_RC(0);
1352 
1354 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
1355  if (sb->s_bdi != NULL)
1356  bdi_unregister(sb->s_bdi);
1357 #endif
1359 thread_stop:
1361 sb_fini:
1363  m0_free(csb);
1364  mount_opts_fini(&mops);
1365 end:
1366  sb->s_fs_info = NULL;
1367  return M0_ERR(rc);
1368 }
1369 
1371 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
1372 M0_INTERNAL struct dentry *m0t1fs_mount(struct file_system_type *fstype,
1373  int flags, const char *devname,
1374  void *data)
1375 #else
1376 M0_INTERNAL int m0t1fs_get_sb(struct file_system_type *fstype, int flags,
1377  const char *devname, void *data,
1378  struct vfsmount *mnt)
1379 #endif
1380 {
1382  M0_ENTRY("flags: 0x%x, devname: %s, data: %s", flags, devname,
1383  (char *)data);
1384 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
1385  return mount_nodev(fstype, flags, data, m0t1fs_fill_super);
1386 #else
1387  return M0_RC(get_sb_nodev(fstype, flags, data, m0t1fs_fill_super, mnt));
1388 #endif
1389 }
1390 
1392 M0_INTERNAL void m0t1fs_kill_sb(struct super_block *sb)
1393 {
1394  struct m0t1fs_sb *csb = M0T1FS_SB(sb);
1395 
1397  M0_ENTRY("csb = %p", csb);
1398 
1399  if (csb != NULL)
1401 
1402 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
1403  if (sb->s_bdi != NULL)
1404  bdi_unregister(sb->s_bdi);
1405 #endif
1406 
1407  /*
1408  * Dealloc virtual .motr/fid dirs. This should be done _before_
1409  * kill_anon_super()
1410  */
1411  if (csb != NULL)
1413 
1414  kill_anon_super(sb);
1415 
1416  /*
1417  * If m0t1fs_fill_super() fails then deactivate_locked_super() calls
1418  * m0t1fs_fs_type->kill_sb(). In that case, csb == NULL.
1419  * But still not sure, such csb != NULL handling is a good idea.
1420  */
1421  if (csb != NULL) {
1425 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
1426  bdi_destroy(&csb->csb_backing_dev_info);
1427 #endif
1428  m0_free(csb);
1429  }
1430 
1431  M0_LOG(M0_INFO, "mem stats :\n a_ioreq_nr = %llu, d_ioreq_nr = %llu\n"
1432  "a_pargrp_iomap_nr = %llu, d_pargrp_iomap_nr = %llu\n"
1433  "a_target_ioreq_nr = %llu, d_target_ioreq_nr = %llu\n",
1434  iommstats.a_ioreq_nr, iommstats.d_ioreq_nr,
1435  iommstats.a_pargrp_iomap_nr, iommstats.d_pargrp_iomap_nr,
1436  iommstats.a_target_ioreq_nr, iommstats.d_target_ioreq_nr);
1437 
1438  M0_LOG(M0_INFO, "a_io_req_fop_nr = %llu, d_io_req_fop_nr = %llu\n"
1439  "a_data_buf_nr = %llu, d_data_buf_nr = %llu\n"
1440  "a_page_nr = %llu, d_page_nr = %llu\n",
1441  iommstats.a_io_req_fop_nr, iommstats.d_io_req_fop_nr,
1442  iommstats.a_data_buf_nr, iommstats.d_data_buf_nr,
1443  iommstats.a_page_nr, iommstats.d_page_nr);
1444 
1445  M0_LEAVE();
1446 }
1447 
1448 
1449 /* ----------------------------------------------------------------
1450  * Misc.
1451  * ---------------------------------------------------------------- */
1452 
1453 static void ast_thread(struct m0t1fs_sb *csb)
1454 {
1455  while (1) {
1456  m0_chan_wait(&csb->csb_iogroup.s_clink);
1457  m0_sm_group_lock(&csb->csb_iogroup);
1458  m0_sm_asts_run(&csb->csb_iogroup);
1459  m0_sm_group_unlock(&csb->csb_iogroup);
1460  if (!csb->csb_active &&
1461  m0_atomic64_get(&csb->csb_pending_io_nr) == 0) {
1462  m0_chan_signal_lock(&csb->csb_iowait);
1463  return;
1464  }
1465  }
1466 }
1467 
1468 static void ast_thread_stop(struct m0t1fs_sb *csb)
1469 {
1470  struct m0_clink w;
1471 
1472  m0_clink_init(&w, NULL);
1473  m0_clink_add_lock(&csb->csb_iowait, &w);
1474 
1475  csb->csb_active = false;
1476  m0_chan_signal_lock(&csb->csb_iogroup.s_chan);
1477  m0_chan_wait(&w);
1478  m0_thread_join(&csb->csb_astthread);
1479 
1480  m0_clink_del_lock(&w);
1481  m0_clink_fini(&w);
1482 }
1483 
1484 #undef M0_TRACE_SUBSYSTEM
M0_INTERNAL struct inode * m0t1fs_iget(struct super_block *sb, const struct m0_fid *fid, struct m0_fop_cob *body)
Definition: inode.c:489
M0_INTERNAL int m0_spiel__fs_stats_fetch(struct m0_spiel_core *spc, struct m0_fs_stats *stats)
Definition: cmd.c:2315
static int str_parse(char **dest, const substring_t *src)
Definition: super.c:287
uint32_t b_nlink
Definition: md_fops.h:81
M0_INTERNAL void m0_reqh_service_cancel_reconnect(struct m0_reqh_service_ctx *ctx)
Definition: reqh_service.c:852
void m0_be_ut_seg_fini(struct m0_be_ut_seg *ut_seg)
Definition: stubs.c:267
M0_INTERNAL void m0_chan_wait(struct m0_clink *link)
Definition: chan.c:336
M0_INTERNAL void m0_pools_common_fini(struct m0_pools_common *pc)
Definition: pool.c:1549
#define M0_PRE(cond)
void m0_rpc_machine_fini(struct m0_rpc_machine *machine)
Definition: rpc_machine.c:233
static char * local_addr
Definition: super.c:59
static bool m0t1fs_conf_ready_cb(struct m0_clink *clink)
Definition: super.c:880
M0_INTERNAL void m0_reqh_services_terminate(struct m0_reqh *reqh)
Definition: reqh.c:675
M0_INTERNAL void m0_mutex_unlock(struct m0_mutex *mutex)
Definition: mutex.c:66
void m0_net_domain_fini(struct m0_net_domain *dom)
Definition: domain.c:71
M0_INTERNAL void m0_chan_broadcast_lock(struct m0_chan *chan)
Definition: chan.c:178
M0_INTERNAL const struct m0_fid M0_ROOT_FID
Definition: super.c:60
void m0_addb2_sys_net_stop(struct m0_addb2_sys *sys)
Definition: sys.c:322
M0_INTERNAL int m0_motr_ha_start(struct m0_motr_ha *mha)
Definition: ha.c:549
int const char const void size_t int flags
Definition: dir.c:328
m0_conf_ha_process_event
Definition: ha.h:49
static bool is_empty(const char *s)
Definition: super.c:315
uint32_t b_valid
Definition: md_fops.h:76
#define NULL
Definition: misc.h:38
M0_INTERNAL void m0_clink_init(struct m0_clink *link, m0_chan_cb_t cb)
Definition: chan.c:201
M0_INTERNAL void m0_clink_del_lock(struct m0_clink *link)
Definition: chan.c:293
#define ergo(a, b)
Definition: misc.h:293
int m0_thread_join(struct m0_thread *q)
Definition: kthread.c:169
M0_INTERNAL int m0_conf_full_load(struct m0_conf_root *r)
Definition: helpers.c:165
M0_INTERNAL const char M0_DOT_MOTR_FID_NAME[]
Definition: md_fid.c:58
M0_INTERNAL int m0t1fs_fill_cob_attr(struct m0_fop_cob *body)
Definition: super.c:1120
#define M0_REQH_INIT(reqh,...)
Definition: reqh.h:262
M0_INTERNAL void m0_uuid_generate(struct m0_uint128 *u)
Definition: uuid.c:44
M0_INTERNAL struct m0_pool_version * m0_pool_version_find(struct m0_pools_common *pc, const struct m0_fid *id)
Definition: pool.c:586
struct m0_chan rh_conf_cache_ready_async
Definition: reqh.h:227
static void m0t1fs_dput(struct dentry *dentry)
Definition: super.c:1092
struct m0_conf_obj rt_obj
Definition: obj.h:372
struct m0_pool_version * pv
Definition: dir.c:629
static struct m0_motr_ha_cfg motr_ha_cfg
Definition: client_init.c:714
#define M0_LOG(level,...)
Definition: trace.h:167
M0_LEAVE()
M0_INTERNAL void m0_reqh_layouts_cleanup(struct m0_reqh *reqh)
Definition: reqh.c:169
static int addb2_net_disable
Definition: super.c:80
uint8_t ft_id
Definition: fid.h:101
const struct m0_conf_obj_type M0_CONF_SERVICE_TYPE
Definition: service.c:156
struct m0hsm_options options
Definition: m0hsm_api.c:56
int m0t1fs_ha_init(struct m0t1fs_sb *csb, const char *ha_addr)
Definition: super.c:478
struct m0_bitmap m0t1fs_client_ep_tmid
Definition: m0t1fs.c:42
static int mount_opts_validate(const struct mount_opts *mops)
Definition: super.c:320
M0_INTERNAL void m0t1fs_destroy_inode(struct inode *inode)
Definition: inode.c:256
M0_TL_DEFINE(csb_inodes, M0_INTERNAL, struct m0t1fs_inode)
struct m0_bufvec data
Definition: di.c:40
M0_INTERNAL struct m0_rconfc * m0_csb2rconfc(struct m0t1fs_sb *csb)
Definition: super.c:693
M0_INTERNAL struct m0_rpc_session * m0t1fs_filename_to_mds_session(const struct m0t1fs_sb *csb, const unsigned char *filename, unsigned int nlen, bool use_hint, uint32_t hash_hint)
Definition: super.c:130
char * mo_process_fid
Definition: super.c:244
void m0t1fs_rpc_fini(struct m0t1fs_sb *csb)
Definition: super.c:703
char * mo_ep
Definition: super.c:245
static void service_connect_wait(struct m0t1fs_sb *csb)
Definition: super.c:1206
M0_INTERNAL void m0_rconfc_stop_sync(struct m0_rconfc *rconfc)
Definition: rconfc.c:2995
struct m0_chan rh_conf_cache_ready
Definition: reqh.h:205
static void ast_thread(struct m0t1fs_sb *csb)
Definition: super.c:1453
void * m0_fop_data(const struct m0_fop *fop)
Definition: fop.c:220
enum m0_md_lustre_logrec_type __attribute__
Definition: balloc.c:2745
uint32_t mo_fid_start
Definition: super.c:246
M0_INTERNAL void m0_rconfc_fatal_cb_set(struct m0_rconfc *rconfc, m0_rconfc_cb_t cb)
Definition: rconfc.c:3067
M0_INTERNAL const struct m0_fid M0_DOT_MOTR_FID_FID
Definition: md_fid.c:53
void m0_be_ut_seg_init(struct m0_be_ut_seg *ut_seg, struct m0_be_ut_backend *ut_be, m0_bcount_t size)
Definition: stubs.c:256
#define M0_THREAD_INIT(thread, TYPE, init, func, arg, namefmt,...)
Definition: thread.h:139
static int m0t1fs_obf_alloc(struct super_block *sb)
Definition: super.c:1144
M0_INTERNAL struct m0 * m0_get(void)
Definition: instance.c:41
static char * ha_addr
Definition: m0hsm.c:43
static bool m0t1fs_conf_expired_cb(struct m0_clink *clink)
Definition: super.c:759
#define PAGE_SIZE
Definition: lnet_ut.c:277
uint64_t b_size
Definition: md_fops.h:78
MODULE_PARM_DESC(local_addr, "End-point address of m0t1fs " "e.g. 172.18.50.40@o2ib1:12345:34:\ "the tmid will be generated and filled by every mount")
#define container_of(ptr, type, member)
Definition: misc.h:33
static struct m0_rpc_session session
Definition: formation2.c:38
#define M0_SET0(obj)
Definition: misc.h:64
M0_INTERNAL void m0_mutex_lock(struct m0_mutex *mutex)
Definition: mutex.c:49
M0_INTERNAL void m0t1fs_sb_init(struct m0t1fs_sb *csb)
Definition: super.c:423
M0_INTERNAL struct dentry * m0t1fs_mount(struct file_system_type *fstype, int flags, const char *devname, void *data)
Definition: super.c:1372
Definition: ub.c:49
M0_INTERNAL int m0_pools_setup(struct m0_pools_common *pc, const struct m0_fid *profile, struct m0_sm_group *sm_grp, struct m0_dtm *dtm)
Definition: pool.c:1810
static int mount_opts_parse(struct m0t1fs_sb *csb, char *options, struct mount_opts *dest)
Definition: super.c:339
M0_INTERNAL void m0_reqh_service_connect_wait(struct m0_reqh_service_ctx *ctx)
Definition: reqh_service.c:822
M0_INTERNAL void m0_reqh_fini(struct m0_reqh *reqh)
Definition: reqh.c:320
struct m0t1fs_sb * csb
Definition: dir.c:330
M0_INTERNAL int m0_motr_ha_init(struct m0_motr_ha *mha, struct m0_motr_ha_cfg *mha_cfg)
Definition: ha.c:509
module_param(local_addr, charp, S_IRUGO)
struct m0_fop_getxattr_rep * rep
Definition: dir.c:455
M0_INTERNAL void m0_sm_group_fini(struct m0_sm_group *grp)
Definition: sm.c:65
#define UINT32_MAX
Definition: types.h:41
Definition: sock.c:887
static struct m0_pools_common pc
Definition: iter_ut.c:59
struct inode * inode
Definition: dir.c:624
struct m0_fop_cob * body
Definition: dir.c:1436
uint64_t pc_nr_svcs[M0_CST_NR]
Definition: pool.h:190
#define m0_tl_endfor
Definition: tlist.h:700
struct m0_fid fid
Definition: di.c:46
M0_INTERNAL void m0_motr_ha_disconnect(struct m0_motr_ha *mha)
Definition: ha.c:578
M0_INTERNAL int m0_confc_root_open(struct m0_confc *confc, struct m0_conf_root **root)
Definition: helpers.c:219
return M0_RC(rc)
op
Definition: libdemo.c:64
Definition: sock.c:754
#define M0_ENTRY(...)
Definition: trace.h:170
static void m0t1fs_teardown(struct m0t1fs_sb *csb)
Definition: super.c:1063
M0_INTERNAL void m0_sm_group_unlock(struct m0_sm_group *grp)
Definition: sm.c:96
M0_INTERNAL struct m0_fid * m0_reqh2profile(struct m0_reqh *reqh)
Definition: reqh.c:758
M0_INTERNAL void m0t1fs_sb_fini(struct m0t1fs_sb *csb)
Definition: super.c:445
static const match_table_t m0t1fs_mntopt_tokens
Definition: super.c:260
void m0_fop_put0_lock(struct m0_fop *fop)
Definition: fop.c:213
int i
Definition: dir.c:1033
M0_INTERNAL struct m0_confc * m0_csb2confc(struct m0t1fs_sb *csb)
Definition: super.c:698
uint32_t b_ctime
Definition: md_fops.h:89
M0_INTERNAL void m0t1fs_fs_unlock(struct m0t1fs_sb *csb)
Definition: super.c:112
#define M0_ERR_INFO(rc, fmt,...)
Definition: trace.h:215
struct m0_reqh_service_ctx ** pc_mds_map
Definition: pool.h:180
struct m0_conf_root * root
Definition: note.c:50
return M0_ERR(-EOPNOTSUPP)
M0_INTERNAL bool m0_pools_common_conf_ready_async_cb(struct m0_clink *clink)
Definition: pool.c:1358
M0_INTERNAL void m0_pool_versions_stale_mark(struct m0_pools_common *pc, struct m0_confc_update_state *s)
Definition: pool.c:811
Definition: trace.h:482
uint32_t pc_md_redundancy
Definition: pool.h:210
M0_INTERNAL const char M0_DOT_MOTR_NAME[]
Definition: md_fid.c:51
M0_INTERNAL int m0_pool_version_get(struct m0_pools_common *pc, const struct m0_fid *pool, struct m0_pool_version **pv)
Definition: pool.c:662
M0_INTERNAL struct m0_confc * m0_reqh2confc(struct m0_reqh *reqh)
Definition: reqh.c:753
#define M0_FID_TINIT(type, container, key)
Definition: fid.h:90
#define M0_AMB(obj, ptr, field)
Definition: misc.h:320
static void m0t1fs_sb_layouts_fini(struct m0t1fs_sb *csb)
Definition: super.c:530
const struct m0_fid_type cot_ftype
Definition: obj.h:314
M0_INTERNAL int m0_reqh_conf_setup(struct m0_reqh *reqh, struct m0_confc_args *args)
Definition: reqh.c:729
struct m0_net_transfer_mc rm_tm
Definition: rpc_machine.h:88
M0_INTERNAL void m0_chan_init(struct m0_chan *chan, struct m0_mutex *ch_guard)
Definition: chan.c:96
bool i_disable_addb2_storage
Definition: instance.h:133
#define M0_ASSERT(cond)
M0_INTERNAL void m0t1fs_fs_conf_unlock(struct m0t1fs_sb *csb)
Definition: dir.c:239
M0_INTERNAL void m0_reqh_service_quit(struct m0_reqh_service *svc)
Definition: reqh_service.c:588
struct m0t1fs_mdop mo
Definition: dir.c:332
M0_INTERNAL bool m0_mutex_is_locked(const struct m0_mutex *mutex)
Definition: mutex.c:95
M0_INTERNAL void m0_sm_group_init(struct m0_sm_group *grp)
Definition: sm.c:53
static int struct dentry * dentry
Definition: dir.c:589
M0_THREAD_ENTER
Definition: dir.c:336
M0_INTERNAL void m0_pools_common_service_ctx_connect_sync(struct m0_pools_common *pc)
Definition: pool.c:1608
m0_time_t m0_time_now(void)
Definition: time.c:134
struct m0_fid pver
Definition: idx_dix.c:74
M0_INTERNAL int m0_rpc_net_buffer_pool_setup(struct m0_net_domain *ndom, struct m0_net_buffer_pool *app_pool, uint32_t bufs_nr, uint32_t tm_nr)
Definition: rpc.c:229
static struct m0t1fs_sb * rconfc2csb(struct m0_rconfc *rconfc)
Definition: super.c:688
M0_INTERNAL int m0t1fs_ref_get_lock(struct m0t1fs_sb *csb)
Definition: super.c:722
uint32_t b_mode
Definition: md_fops.h:77
uint32_t b_mtime
Definition: md_fops.h:88
struct m0t1fs_inode * ci
Definition: dir.c:622
M0_INTERNAL uint32_t m0_rpc_bufs_nr(uint32_t len, uint32_t tms_nr)
Definition: rpc.c:271
static int m0t1fs_root_alloc(struct super_block *sb)
Definition: super.c:1222
static void ast_thread_stop(struct m0t1fs_sb *csb)
Definition: super.c:1468
M0_INTERNAL int m0_bitmap_ffz(const struct m0_bitmap *map)
Definition: bitmap.c:126
static void m0t1fs_rconfc_fatal_cb(struct m0_rconfc *rconfc)
Definition: super.c:889
m0t1fs_mntopts
Definition: super.c:249
uint64_t b_lid
Definition: md_fops.h:90
M0_INTERNAL int m0_rpc_machine_init(struct m0_rpc_machine *machine, struct m0_net_domain *net_dom, const char *ep_addr, struct m0_reqh *reqh, struct m0_net_buffer_pool *receive_pool, uint32_t colour, m0_bcount_t msg_size, uint32_t queue_len)
Definition: rpc_machine.c:123
struct m0_net_xprt * m0_net_xprt_default_get(void)
Definition: net.c:151
M0_INTERNAL void m0_pools_service_ctx_destroy(struct m0_pools_common *pc)
Definition: pool.c:1617
M0_INTERNAL int m0_reqh_mdpool_layout_build(struct m0_reqh *reqh)
Definition: reqh.c:145
void * m0_alloc(size_t size)
Definition: memory.c:126
M0_INTERNAL void m0_mutex_init(struct m0_mutex *mutex)
Definition: mutex.c:35
static int m0_rconfc_start_sync(struct m0_rconfc *rconfc)
Definition: rconfc.h:502
M0_INTERNAL int m0_conf_confc_ha_update(struct m0_confc *confc)
Definition: helpers.c:658
uint64_t f_container
Definition: fid.h:39
M0_INTERNAL const struct m0_fid M0_DOT_MOTR_FID
Definition: md_fid.c:46
M0_INTERNAL void m0_rconfc_lock(struct m0_rconfc *rconfc)
Definition: rconfc.c:2841
char * mo_profile
Definition: super.c:243
Definition: reqh.h:94
M0_INTERNAL void m0_bitmap_set(struct m0_bitmap *map, size_t idx, bool val)
Definition: bitmap.c:139
static void m0t1fs_ha_process_event(struct m0t1fs_sb *csb, enum m0_conf_ha_process_event event)
Definition: super.c:465
int m0t1fs_sync_fs(struct super_block *sb, int wait)
Definition: fsync.c:462
struct m0_sm_group * lo_grp
Definition: locality.h:67
static struct super_block super_block
Definition: fsync.c:84
uint32_t b_atime
Definition: md_fops.h:87
M0_INTERNAL void m0t1fs_kill_sb(struct super_block *sb)
Definition: super.c:1392
static int m0t1fs_sb_mdpool_layouts_init(struct m0t1fs_sb *csb)
Definition: super.c:524
M0_INTERNAL void m0_motr_ha_connect(struct m0_motr_ha *mha)
Definition: ha.c:567
static struct m0_clink clink[RDWR_REQUEST_MAX]
M0_INTERNAL int m0_reqh_service_setup(struct m0_reqh_service **out, struct m0_reqh_service_type *stype, struct m0_reqh *reqh, struct m0_reqh_context *rctx, const struct m0_fid *fid)
Definition: reqh_service.c:565
M0_INTERNAL int m0_fid_sscanf(const char *s, struct m0_fid *fid)
Definition: fid.c:227
static int num_parse(uint32_t *dest, const substring_t *src)
Definition: super.c:293
M0_INTERNAL int m0t1fs_fs_conf_lock(struct m0t1fs_sb *csb)
Definition: dir.c:227
M0_INTERNAL void m0t1fs_fs_lock(struct m0t1fs_sb *csb)
Definition: super.c:105
struct m0_tl pc_svc_ctxs
Definition: pool.h:172
static struct fdmi_ctx ctx
Definition: main.c:80
int m0_addb2_sys_net_start_with(struct m0_addb2_sys *sys, struct m0_tl *head)
Definition: sys.c:329
#define FID_P(f)
Definition: fid.h:77
uint64_t m0_time_seconds(const m0_time_t time)
Definition: time.c:83
static bool m0t1fs_conf_ready_async_cb(struct m0_clink *clink)
Definition: super.c:817
struct m0_mutex m0t1fs_mutex
Definition: m0t1fs.c:43
M0_INTERNAL bool m0t1fs_fs_is_locked(const struct m0t1fs_sb *csb)
Definition: super.c:119
M0_INTERNAL struct inode * m0t1fs_alloc_inode(struct super_block *sb)
Definition: inode.c:236
M0_INTERNAL void m0_chan_signal_lock(struct m0_chan *chan)
Definition: chan.c:165
struct io_mem_stats iommstats
Definition: file.c:322
M0_INTERNAL void m0_rconfc_fini(struct m0_rconfc *rconfc)
Definition: rconfc.c:3009
M0_INTERNAL int m0_reqh_state_get(struct m0_reqh *reqh)
Definition: reqh.c:398
const struct xattr_handler * m0t1fs_xattr_handlers[]
Definition: dir.c:2529
static int64_t m0_atomic64_get(const struct m0_atomic64 *a)
M0_INTERNAL bool m0_fid_eq(const struct m0_fid *fid0, const struct m0_fid *fid1)
Definition: fid.c:164
void m0_clink_add_lock(struct m0_chan *chan, struct m0_clink *link)
Definition: chan.c:255
char * mo_ha
Definition: super.c:242
M0_INTERNAL int m0_conf_process2service_get(struct m0_confc *confc, const struct m0_fid *process_fid, enum m0_conf_service_type stype, struct m0_fid *sfid)
Definition: helpers.c:518
struct m0_reqh_service_type m0_rms_type
Definition: rm_service.c:69
int m0t1fs_mds_statfs(struct m0t1fs_sb *csb, struct m0_fop **rep_fop)
Definition: dir.c:2119
M0_INTERNAL void m0_reqh_start(struct m0_reqh *reqh)
Definition: reqh.c:711
M0_INTERNAL void m0_rconfc_unlock(struct m0_rconfc *rconfc)
Definition: rconfc.c:2855
static struct super_block sb
Definition: file.c:85
uint64_t b_blocks
Definition: md_fops.h:80
uint64_t n
Definition: fops.h:107
struct m0_reqh reqh
Definition: rm_foms.c:48
int m0_net_domain_init(struct m0_net_domain *dom, const struct m0_net_xprt *xprt)
Definition: domain.c:36
char * ep
Definition: sw.h:132
M0_INTERNAL int m0_pools_common_init(struct m0_pools_common *pc, struct m0_rpc_machine *rmach)
Definition: pool.c:1425
M0_INTERNAL struct m0_locality * m0_locality0_get(void)
Definition: locality.c:169
#define M0_CNT_INC(cnt)
Definition: arith.h:226
Definition: fid.h:38
struct m0_ha_dispatcher_cfg mhc_dispatcher_cfg
Definition: ha.h:47
uint64_t b_blksize
Definition: md_fops.h:79
struct m0_confc rc_confc
Definition: rconfc.h:235
M0_INTERNAL const struct m0_fid M0_MDSERVICE_START_FID
Definition: md_fid.c:68
uint64_t f_key
Definition: fid.h:40
int m0t1fs_rm_service_start(struct m0t1fs_sb *csb)
Definition: super.c:542
static void inodes_layout_ref_drop(struct m0t1fs_sb *csb)
Definition: super.c:796
struct m0_chan rh_conf_cache_exp
Definition: reqh.h:194
static void conf_ready_async_cb_locked(struct m0t1fs_sb *csb)
Definition: super.c:833
#define M0_ALLOC_PTR(ptr)
Definition: memory.h:86
M0_INTERNAL void m0_clink_add(struct m0_chan *chan, struct m0_clink *link)
Definition: chan.c:228
Definition: beck.c:130
M0_INTERNAL void m0_conf_ha_process_event_post(struct m0_ha *ha, struct m0_ha_link *hl, const struct m0_fid *process_fid, uint64_t pid, enum m0_conf_ha_process_event event, enum m0_conf_ha_process_type type)
Definition: ha.c:45
M0_INTERNAL int m0_pools_service_ctx_create(struct m0_pools_common *pc)
Definition: pool.c:1535
int m0t1fs_rpc_init(struct m0t1fs_sb *csb, const char *ep)
Definition: super.c:631
static uint32_t tm_recv_queue_min_len
Definition: super.c:72
M0_INTERNAL struct m0_addb2_sys * m0_addb2_global_get(void)
Definition: global.c:99
struct m0t1fs_sb * reqh2sb(struct m0_reqh *reqh)
Definition: super.c:683
M0_TL_DESCR_DEFINE(csb_inodes, "m0t1fs_inode anchored in m0t1fs_sb", M0_INTERNAL, struct m0t1fs_inode, ci_sb_linkage, ci_magic, M0_T1FS_INODE_MAGIC, M0_T1FS_INODE_HEAD_MAGIC)
void m0t1fs_net_fini(struct m0t1fs_sb *csb)
Definition: super.c:618
M0_INTERNAL void m0_mutex_fini(struct m0_mutex *mutex)
Definition: mutex.c:42
M0_INTERNAL void m0_clink_fini(struct m0_clink *link)
Definition: chan.c:208
static int m0t1fs_fid_sscanf(const char *s, struct m0_fid *fid, const char *descr)
Definition: super.c:901
M0_INTERNAL void m0_sm_group_lock(struct m0_sm_group *grp)
Definition: sm.c:83
struct m0_fid rh_fid
Definition: reqh.h:177
M0_INTERNAL struct m0_rpc_session * m0t1fs_container_id_to_session(const struct m0_pool_version *pver, uint64_t container_id)
Definition: super.c:166
static struct m0_rconfc * rconfc(struct m0_client *m0c)
Definition: client_init.c:310
static int m0t1fs_statfs(struct dentry *dentry, struct kstatfs *buf)
Definition: super.c:198
M0_INTERNAL void m0_confc_close(struct m0_conf_obj *obj)
Definition: confc.c:921
#define M0_CNT_DEC(cnt)
Definition: arith.h:219
struct m0_rconfc rh_rconfc
Definition: reqh.h:166
static void reqh_fini(void)
Definition: ms_fom_ut.c:351
M0_INTERNAL void m0_layout_instance_fini(struct m0_layout_instance *li)
Definition: layout.c:1123
M0_INTERNAL void m0_motr_ha_stop(struct m0_motr_ha *mha)
Definition: ha.c:560
M0_INTERNAL void io_bob_tlists_init(void)
Definition: file.c:790
void m0t1fs_ha_fini(struct m0t1fs_sb *csb)
Definition: super.c:507
const struct m0_conf_obj_type M0_CONF_PROCESS_TYPE
Definition: process.c:161
Definition: nucleus.c:42
static void m0t1fs_obf_dealloc(struct m0t1fs_sb *csb)
Definition: super.c:1103
#define out(...)
Definition: gen.c:41
int m0t1fs_net_init(struct m0t1fs_sb *csb, const char *ep)
Definition: super.c:573
M0_INTERNAL int m0_pool_versions_setup(struct m0_pools_common *pc)
Definition: pool.c:1640
static const struct super_operations m0t1fs_super_operations
Definition: super.c:90
void m0_rpc_net_buffer_pool_cleanup(struct m0_net_buffer_pool *app_pool)
Definition: rpc.c:264
M0_INTERNAL void m0_pool_versions_destroy(struct m0_pools_common *pc)
Definition: pool.c:1876
M0_INTERNAL struct inode * m0t1fs_root_iget(struct super_block *sb, const struct m0_fid *root_fid)
Definition: inode.c:280
M0_INTERNAL void m0_sm_asts_run(struct m0_sm_group *grp)
Definition: sm.c:150
M0_INTERNAL void m0_motr_ha_fini(struct m0_motr_ha *mha)
Definition: ha.c:537
const char * ca_profile
Definition: helpers.h:34
#define m0_tl_for(name, head, obj)
Definition: tlist.h:695
M0_INTERNAL void m0_chan_fini_lock(struct m0_chan *chan)
Definition: chan.c:112
void m0_free(void *data)
Definition: memory.c:146
Definition: mutex.h:47
static struct m0_addb2_source * s
Definition: consumer.c:39
static int m0t1fs_fill_super(struct super_block *sb, void *data, int silent __attribute__((unused)))
Definition: super.c:1271
int m0t1fs_setup(struct m0t1fs_sb *csb, const struct mount_opts *mops)
Definition: super.c:912
struct m0_pdclust_src_addr src
Definition: fd.c:108
M0_INTERNAL void m0_chan_broadcast(struct m0_chan *chan)
Definition: chan.c:172
static struct m0_rpc_machine rpc_machine
Definition: service_ut.c:63
int32_t rc
Definition: trigger_fop.h:47
M0_INTERNAL void m0t1fs_ref_put_lock(struct m0t1fs_sb *csb)
Definition: super.c:749
M0_INTERNAL unsigned int m0_full_name_hash(const unsigned char *name, unsigned int len)
Definition: misc.c:266
#define M0T1FS_NAME_LEN
Definition: super.c:65
static uint32_t max_rpc_msg_size
Definition: super.c:76
void m0t1fs_rm_service_quit(struct m0t1fs_sb *csb)
Definition: super.c:537
Definition: fop.h:79
static int _fs_stats_fetch(struct m0t1fs_sb *csb, struct m0_fs_stats *stats)
Definition: super.c:185
#define FID_F
Definition: fid.h:75
static void m0_atomic64_set(struct m0_atomic64 *a, int64_t num)
struct m0_fop * rep_fop
Definition: dir.c:334
M0_INTERNAL void m0_fid_tassume(struct m0_fid *fid, const struct m0_fid_type *ft)
Definition: fid.c:146
M0_INTERNAL struct m0_reqh_service_ctx * m0_reqh_service_ctx_from_session(struct m0_rpc_session *session)
M0_INTERNAL void m0_pools_destroy(struct m0_pools_common *pc)
Definition: pool.c:1887
struct m0_net_buffer_pool * ntm_recv_pool
Definition: net.h:896
static void mount_opts_fini(struct mount_opts *mops)
Definition: super.c:272