Motr  M0
inode.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013-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 #include <linux/slab.h> /* kmem_cache */
23 #include<linux/version.h>
24 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
25 #include <linux/cred.h>
26 #endif
27 
28 #include "layout/pdclust.h" /* m0_pdclust_build(), m0_pdl_to_layout(),
29  * m0_pdclust_instance_build() */
30 #include "layout/linear_enum.h" /* m0_linear_enum_build() */
31 #include "lib/misc.h" /* M0_SET0() */
32 #include "lib/memory.h" /* M0_ALLOC_PTR(), m0_free() */
34 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_M0T1FS
35 #include "lib/trace.h" /* M0_LOG and M0_ENTRY */
36 #include "motr/magic.h"
37 #include "rm/rm_service.h" /* m0_rm_svc_domain_get */
38 #include "lib/tlist.h" /* M0_TL_DESCR_DECLARE() */
39 
40 /* ISPTI -> Inode's Service to Pending Transaction Id list */
41 M0_TL_DESCR_DEFINE(ispti, "m0_reqh_service_txid pending an inode", ,
42  struct m0_reqh_service_txid,
43  stx_tlink, stx_link_magic,
45 
46 M0_TL_DEFINE(ispti, , struct m0_reqh_service_txid);
47 
48 static struct kmem_cache *m0t1fs_inode_cachep = NULL;
49 
50 static const struct m0_bob_type m0t1fs_inode_bob = {
51  .bt_name = "m0t1fs_inode",
52  .bt_magix_offset = offsetof(struct m0t1fs_inode, ci_magic),
53  .bt_magix = M0_T1FS_INODE_MAGIC,
54  .bt_check = NULL
55 };
56 
57 M0_BOB_DEFINE(M0_INTERNAL, &m0t1fs_inode_bob, m0t1fs_inode);
58 
60 
61 M0_INTERNAL const struct m0_fid *m0t1fs_inode_fid(const struct m0t1fs_inode *ci)
62 {
63  M0_PRE(ci != NULL);
64 
65  return &ci->ci_fid;
66 }
67 
68 M0_INTERNAL bool m0t1fs_inode_is_root(const struct inode *inode)
69 {
70  struct m0t1fs_inode *ci = M0T1FS_I(inode);
71 
73  &M0T1FS_SB(inode->i_sb)->csb_root_fid);
74 }
75 
76 M0_INTERNAL bool m0t1fs_inode_is_dot_motr(const struct inode *inode)
77 {
78  struct m0t1fs_inode *ci = M0T1FS_I(inode);
79 
81 }
82 
83 M0_INTERNAL bool m0t1fs_inode_is_dot_motr_fid(const struct inode *inode)
84 {
85  struct m0t1fs_inode *ci = M0T1FS_I(inode);
86 
88 }
89 
90 static void init_once(void *foo)
91 {
92  struct m0t1fs_inode *ci = foo;
93 
94  M0_ENTRY();
95 
96  inode_init_once(&ci->ci_inode);
97 
98  M0_LEAVE();
99 }
100 
101 M0_INTERNAL int m0t1fs_inode_cache_init(void)
102 {
103  int rc = 0;
104 
105  M0_ENTRY();
106 
107  m0t1fs_inode_cachep = kmem_cache_create("m0t1fs_inode_cache",
108  sizeof(struct m0t1fs_inode),
109  0, SLAB_HWCACHE_ALIGN,
110  init_once);
111  if (m0t1fs_inode_cachep == NULL)
112  rc = -ENOMEM;
113 
114  M0_LEAVE("rc: %d", rc);
115  return M0_RC(rc);
116 }
117 
118 M0_INTERNAL void m0t1fs_inode_cache_fini(void)
119 {
120  M0_ENTRY();
121 
122  if (m0t1fs_inode_cachep != NULL) {
123  kmem_cache_destroy(m0t1fs_inode_cachep);
125  }
126 
127  M0_LEAVE();
128 }
129 
130 M0_INTERNAL struct m0_rm_domain *m0t1fs_rm_domain_get(struct m0t1fs_sb *sb)
131 {
133  &sb->csb_reqh));
134 }
135 
136 M0_INTERNAL void m0t1fs_file_lock_init(struct m0t1fs_inode *ci,
137  struct m0t1fs_sb *csb)
138 {
139  struct m0_rm_domain *rdom;
140  struct m0_pools_common *pc = &csb->csb_pools_common;
141  const struct m0_fid *fid = &ci->ci_fid;
142 
143  M0_ENTRY();
144 
146  rdom = m0t1fs_rm_domain_get(csb);
147  M0_ASSERT(rdom != NULL);
151  m0_file_init(&ci->ci_flock, fid, rdom, M0_DI_DEFAULT_TYPE);
152  m0_rm_remote_init(&ci->ci_creditor, &ci->ci_flock.fi_res);
153  ci->ci_creditor.rem_session = m0_pools_common_active_rm_session(pc);
154  M0_ASSERT(ci->ci_creditor.rem_session != NULL);
155  ci->ci_creditor.rem_state = REM_SERVICE_LOCATED;
157  &ci->ci_flock, &ci->ci_creditor);
158 
159  M0_LEAVE();
160 }
161 
162 M0_INTERNAL void m0t1fs_file_lock_fini(struct m0t1fs_inode *ci)
163 {
164  int rc;
165  M0_ENTRY();
166 
167  m0_rm_owner_windup(&ci->ci_fowner);
168  rc = m0_rm_owner_timedwait(&ci->ci_fowner,
170  M0_TIME_NEVER);
171  M0_ASSERT(rc == 0);
172  m0_file_owner_fini(&ci->ci_fowner);
173  m0_rm_remote_fini(&ci->ci_creditor);
174  m0_file_fini(&ci->ci_flock);
175  M0_LEAVE();
176 }
177 
178 static void m0t1fs_inode_init(struct m0t1fs_inode *ci)
179 {
180  M0_ENTRY("ci: %p", ci);
181  M0_SET0(&ci->ci_fid);
182  M0_SET0(&ci->ci_flock);
183  M0_SET0(&ci->ci_creditor);
184  M0_SET0(&ci->ci_fowner);
185  ci->ci_layout_instance = NULL;
186  ci->ci_layout_changed = false;
187  m0_mutex_init(&ci->ci_layout_lock);
188  m0_mutex_init(&ci->ci_pending_tx_lock);
189  ispti_tlist_init(&ci->ci_pending_tx);
191  csb_inodes_tlink_init(ci);
192  M0_LEAVE();
193 }
194 
195 static void m0t1fs_inode_ispti_fini(struct m0t1fs_inode *ci)
196 {
197  struct m0_reqh_service_txid *iter = NULL;
198 
199  M0_ENTRY();
200 
201  m0_mutex_lock(&ci->ci_pending_tx_lock);
202  m0_tl_teardown(ispti, &ci->ci_pending_tx, iter)
203  m0_free0(&iter);
204 
205  ispti_tlist_fini(&ci->ci_pending_tx);
206  m0_mutex_unlock(&ci->ci_pending_tx_lock);
207 
208  M0_LEAVE();
209 }
210 
211 static void m0t1fs_inode_fini(struct m0t1fs_inode *ci)
212 {
213  struct m0t1fs_sb *csb;
214 
216  M0_ENTRY("ci: %p, is_root %s, layout_instance %p",
218  ci->ci_layout_instance);
219 
221  csb = M0T1FS_SB(ci->ci_inode.i_sb);
222  m0_mutex_lock(&csb->csb_inodes_lock);
223  csb_inodes_tlist_remove(ci);
224  m0_mutex_unlock(&csb->csb_inodes_lock);
225  m0t1fs_inode_bob_fini(ci);
226  /* Empty the list, then free the list lock */
228  m0_mutex_fini(&ci->ci_pending_tx_lock);
229  m0_mutex_fini(&ci->ci_layout_lock);
230  M0_LEAVE();
231 }
232 
236 M0_INTERNAL struct inode *m0t1fs_alloc_inode(struct super_block *sb)
237 {
238  struct m0t1fs_inode *ci;
240 
241  M0_ENTRY("sb: %p", sb);
242 
243  ci = kmem_cache_alloc(m0t1fs_inode_cachep, GFP_KERNEL);
244  if (ci == NULL) {
245  M0_LEAVE("inode: %p", NULL);
246  return NULL;
247  }
249  M0_LEAVE("inode: %p", &ci->ci_inode);
250  return &ci->ci_inode;
251 }
252 
256 M0_INTERNAL void m0t1fs_destroy_inode(struct inode *inode)
257 {
258  struct m0t1fs_inode *ci = M0T1FS_I(inode);
259  const struct m0_fid *fid = m0t1fs_inode_fid(ci);
261 
262  M0_ENTRY("inode: %p, fid: "FID_F, inode, FID_P(fid));
269  m0_mutex_lock(&ci->ci_layout_lock);
270  if (ci->ci_layout_instance != NULL)
271  m0_layout_instance_fini(ci->ci_layout_instance);
272  m0_mutex_unlock(&ci->ci_layout_lock);
274  }
276  kmem_cache_free(m0t1fs_inode_cachep, ci);
277  M0_LEAVE();
278 }
279 
280 M0_INTERNAL struct inode *m0t1fs_root_iget(struct super_block *sb,
281  const struct m0_fid *root_fid)
282 {
283  struct m0_fop_getattr_rep *rep = NULL;
284  struct m0t1fs_mdop mo;
285  struct inode *inode;
286  int rc;
287  struct m0_fop *rep_fop = NULL;
288  struct m0t1fs_sb *csb;
289  struct m0_fop_cob *body;
290 
291  M0_ENTRY("sb: %p", sb);
292 
293  csb = M0T1FS_SB(sb);
294  M0_SET0(&mo);
295  mo.mo_attr.ca_tfid = *root_fid;
296  csb->csb_root_fid = *root_fid;
297 
298  if (!csb->csb_oostore) {
300  if (rc != 0) {
301  M0_LOG(M0_ERROR, "m0t1fs_mds_cob_getattr() failed"
302  "with %d", rc);
304  return ERR_PTR(rc);
305  }
307  body = &rep->g_body;
308  } else {
309  body = &csb->csb_virt_body;
311  if (rc != 0)
312  return ERR_PTR(rc);
313  }
314 
315  inode = m0t1fs_iget(sb, root_fid, body);
316 
318 
319  M0_LEAVE("root_inode: %p", inode);
320  return inode;
321 }
322 
332 M0_INTERNAL int m0t1fs_inode_test(struct inode *inode, void *opaque)
333 {
334  struct m0t1fs_inode *ci;
335  struct m0_fid *fid = opaque;
336  int rc;
337 
338  M0_ENTRY();
339 
340  ci = M0T1FS_I(inode);
341 
342  M0_LOG(M0_DEBUG, "inode (%p) "FID_F" opaque "FID_F,
344 
346 
347  M0_LEAVE("rc: %d", rc);
348  return M0_RC(rc);
349 }
350 
351 static int m0t1fs_inode_set(struct inode *inode, void *opaque)
352 {
353  struct m0t1fs_inode *ci = M0T1FS_I(inode);
354  struct m0_fid *fid;
355  struct m0t1fs_sb *csb = M0T1FS_SB(inode->i_sb);
356 
357  M0_ENTRY();
358 
359  ci->ci_fid = *(fid = (struct m0_fid *)opaque);
360 
361  if (m0_fid_eq(fid, &csb->csb_root_fid))
362  ci->ci_flock.fi_fid = fid;
363  else
365  inode->i_ino = m0_fid_hash(fid);
366 
367  M0_LOG(M0_DEBUG, "inode (%p) "FID_F, inode, FID_P(fid));
368  return M0_RC(0);
369 }
370 
371 M0_INTERNAL void m0t1fs_inode_update_blksize(struct inode *inode,
372  struct m0_layout *layout)
373 {
374  struct m0_pdclust_attr *pa;
375  size_t buffsize;
376 
377  pa = &m0_layout_to_pdl(layout)->pl_attr;
378  buffsize = pa->pa_unit_size * pa->pa_N;
379 
380 #ifdef HAVE_INODE_BLKSIZE
381  inode->i_blksize = buffsize;
382 #else
383  inode->i_blkbits = 12;
384  while ((1 << inode->i_blkbits) < buffsize)
385  inode->i_blkbits++;
386 #endif
387 }
388 
389 M0_INTERNAL void m0t1fs_inode_update(struct inode *inode,
390  struct m0_fop_cob *body)
391 {
392  M0_ENTRY();
393 
394  if (body->b_valid & M0_COB_ATIME)
395  inode->i_atime.tv_sec = body->b_atime;
396  if (body->b_valid & M0_COB_MTIME)
397  inode->i_mtime.tv_sec = body->b_mtime;
398  if (body->b_valid & M0_COB_CTIME)
399  inode->i_ctime.tv_sec = body->b_ctime;
400  if (body->b_valid & M0_COB_UID)
401 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
402  inode->i_uid = make_kuid(current_user_ns(), body->b_uid);
403 #else
404  inode->i_uid = body->b_uid;
405 #endif
406  if (body->b_valid & M0_COB_GID)
407 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
408  inode->i_gid = make_kgid(current_user_ns(), body->b_gid);
409 #else
410  inode->i_gid = body->b_gid;
411 #endif
412  if (body->b_valid & M0_COB_BLOCKS)
413  inode->i_blocks = body->b_blocks;
414  if (body->b_valid & M0_COB_SIZE)
415  inode->i_size = body->b_size;
416  if (body->b_valid & M0_COB_NLINK)
417 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
418  set_nlink(inode, body->b_nlink);
419 #else
420  inode->i_nlink = body->b_nlink;
421 #endif
422  if (body->b_valid & M0_COB_MODE)
423  inode->i_mode = body->b_mode;
424 
425  M0_LEAVE();
426 }
427 
428 static int m0t1fs_inode_read(struct inode *inode,
429  struct m0_fop_cob *body)
430 {
431  struct m0t1fs_inode *ci = M0T1FS_I(inode);
432  struct m0t1fs_sb *csb = M0T1FS_SB(inode->i_sb);
433  int rc = 0;
434 
435  M0_ENTRY();
436 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,9,0)
437  inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
438 #else
439  inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
440 #endif
441 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
442  inode->i_uid = GLOBAL_ROOT_UID;
443  inode->i_gid = GLOBAL_ROOT_GID;
444 #else
445  inode->i_uid = 0;
446  inode->i_gid = 0;
447 #endif
448  inode->i_rdev = 0;
449 
451  if (S_ISREG(inode->i_mode)) {
454  inode->i_mapping->a_ops = &m0t1fs_aops;
455  } else if (S_ISDIR(inode->i_mode)) {
458  csb->csb_oostore) {
459  /* currently open-by-fid is only in OOSTORE mode */
462  } else {
465  }
466  } else {
467  rc = -ENOSYS;
468  }
471  ci->ci_layout_id = body->b_lid;
472  ci->ci_pver = body->b_pver;
473  if (m0_pool_version_find(&csb->csb_pools_common, &ci->ci_pver)
474  == NULL)
475  return M0_ERR(-EINVAL);
477  if (rc != 0)
478  M0_LOG(M0_WARN, "m0t1fs_inode_layout_init() failed,"
479  "rc=%d", rc);
480  m0_mutex_lock(&csb->csb_inodes_lock);
481  csb_inodes_tlist_add_tail(&csb->csb_inodes, ci);
482  m0_mutex_unlock(&csb->csb_inodes_lock);
483  }
484  if (rc == 0)
486  return M0_RC(rc);
487 }
488 
489 M0_INTERNAL struct inode *m0t1fs_iget(struct super_block *sb,
490  const struct m0_fid *fid,
491  struct m0_fop_cob *body)
492 {
493  struct inode *inode;
494  unsigned long hash;
495  int err = 0;
496  struct m0t1fs_sb *csb = M0T1FS_SB(sb);
497 
498  M0_ENTRY();
499 
500  hash = m0_fid_hash(fid);
501 
502  if (m0_pools_common_active_rm_session(&csb->csb_pools_common) == NULL) {
503  err = M0_ERR(-EAGAIN);
504  M0_LEAVE();
505  return ERR_PTR(err);
506  }
507  /*
508  * Search inode cache for an inode that has matching @fid.
509  * Use m0t1fs_inode_test() to compare fid_s. If not found, allocate a
510  * new inode. Set its fid to @fid using m0t1fs_inode_set(). Also
511  * set I_NEW flag in inode->i_state for newly allocated inode.
512  */
513  inode = iget5_locked(sb, hash, m0t1fs_inode_test, m0t1fs_inode_set,
514  (void *)fid);
515  if (IS_ERR(inode)) {
516  M0_LEAVE("inode: %p", ERR_CAST(inode));
517  return ERR_CAST(inode);
518  }
519  if ((inode->i_state & I_NEW) != 0) {
520  /* New inode, set its fields from @body */
521  err = m0t1fs_inode_read(inode, body);
522  } else if (!(inode->i_state & (I_FREEING | I_CLEAR))) {
523  /* Not a new inode, let's update its attributes from @body */
525  }
526  if (err != 0)
527  goto out_err;
528  if ((inode->i_state & I_NEW) != 0)
530  M0_LEAVE("inode: %p", inode);
531  return inode;
532 
533 out_err:
534  iget_failed(inode);
535  M0_LEAVE("ERR: %p", ERR_PTR(err));
536  return ERR_PTR(err);
537 }
538 
539 static int m0t1fs_build_layout_instance(struct m0t1fs_sb *csb,
540  const uint64_t layout_id,
541  const struct m0_fid *fid,
542  struct m0_layout_instance **linst)
543 {
544  struct m0_layout *layout;
545  int rc;
546 
547  M0_ENTRY();
548  M0_PRE(fid != NULL);
549  M0_PRE(linst != NULL);
550 
551  /*
552  * All the layouts should already be generated on startup and added
553  * to the list unless wrong layout_id is used.
554  */
555  layout = m0_layout_find(&csb->csb_reqh.rh_ldom, layout_id);
556  if (layout == NULL) {
557  rc = -EINVAL;
558  goto out;
559  }
560 
561  *linst = NULL;
562  rc = m0_layout_instance_build(layout, fid, linst);
563  m0_layout_put(layout);
564 
565 out:
566  M0_LEAVE("rc: %d", rc);
567  return M0_RC(rc);
568 }
569 
570 M0_INTERNAL int m0t1fs_inode_layout_init(struct m0t1fs_inode *ci)
571 {
572  struct m0t1fs_sb *csb;
573  struct m0_layout_instance *linst;
574  int rc;
575  uint64_t layout_id;
576 
577  M0_ENTRY();
578  M0_PRE(m0_fid_is_valid(&ci->ci_pver));
579  M0_LOG(M0_DEBUG, "fid:"FID_F"pver"FID_F"lid:%d",
581  FID_P(&ci->ci_pver),
582  (int)ci->ci_layout_id);
583 
584  csb = M0T1FS_SB(ci->ci_inode.i_sb);
585 
586  layout_id = m0_pool_version2layout_id(&ci->ci_pver, ci->ci_layout_id);
588  m0t1fs_inode_fid(ci), &linst);
589  if (rc == 0) {
590  if (ci->ci_layout_instance != NULL)
591  m0_layout_instance_fini(ci->ci_layout_instance);
592  ci->ci_layout_instance = linst;
593  m0t1fs_inode_update_blksize(&ci->ci_inode, linst->li_l);
594  }
595 
596  M0_LEAVE("rc: %d", rc);
597  return M0_RC(rc);
598 }
599 
600 M0_INTERNAL int m0t1fs_inode_layout_rebuild(struct m0t1fs_inode *ci,
601  struct m0_fop_cob *body)
602 {
603  M0_ENTRY();
604  M0_PRE(ci != NULL);
605  M0_PRE(body != NULL);
607 
608  if (ci->ci_layout_id != body->b_lid ||
609  m0_fid_cmp(&ci->ci_pver, &body->b_pver) ||
610  /*
611  * Layout instance belongs to a virtual pool version.
612  * There is a possibility that the instance has been
613  * deleted by confc update.
614  */
615  ci->ci_layout_instance == NULL) {
616  ci->ci_layout_id = body->b_lid;
617  ci->ci_pver = body->b_pver;
619  }
620  return M0_RC(0);
621 }
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 struct m0_layout * m0_layout_find(struct m0_layout_domain *dom, uint64_t lid)
Definition: layout.c:861
struct m0_fop_cob g_body
Definition: md_fops.h:214
uint32_t b_nlink
Definition: md_fops.h:81
uint32_t b_uid
Definition: md_fops.h:82
static int m0t1fs_build_layout_instance(struct m0t1fs_sb *csb, const uint64_t layout_id, const struct m0_fid *fid, struct m0_layout_instance **linst)
Definition: inode.c:539
#define M0_PRE(cond)
M0_INTERNAL void m0_mutex_unlock(struct m0_mutex *mutex)
Definition: mutex.c:66
M0_INTERNAL int m0t1fs_inode_layout_init(struct m0t1fs_inode *ci)
Definition: inode.c:570
M0_INTERNAL void m0t1fs_inode_update_blksize(struct inode *inode, struct m0_layout *layout)
Definition: inode.c:371
struct m0_layout * li_l
Definition: layout.h:590
M0_INTERNAL uint64_t m0_fid_hash(const struct m0_fid *fid)
Definition: fid.c:295
uint32_t b_valid
Definition: md_fops.h:76
#define NULL
Definition: misc.h:38
M0_INTERNAL struct m0_rm_domain * m0_rm_svc_domain_get(const struct m0_reqh_service *svc)
Definition: rm_service.c:307
uint64_t pa_unit_size
Definition: pdclust.h:118
static void init_once(void *foo)
Definition: inode.c:90
M0_INTERNAL int m0t1fs_inode_cache_init(void)
Definition: inode.c:101
M0_INTERNAL int m0t1fs_fill_cob_attr(struct m0_fop_cob *body)
Definition: super.c:1120
const m0_time_t M0_TIME_NEVER
Definition: time.c:108
M0_INTERNAL struct m0_pool_version * m0_pool_version_find(struct m0_pools_common *pc, const struct m0_fid *id)
Definition: pool.c:586
uint32_t pa_N
Definition: pdclust.h:104
static void m0t1fs_inode_fini(struct m0t1fs_inode *ci)
Definition: inode.c:211
#define M0_LOG(level,...)
Definition: trace.h:167
M0_LEAVE()
Definition: bob.c:32
M0_BOB_DEFINE(M0_INTERNAL, &m0t1fs_inode_bob, m0t1fs_inode)
M0_INTERNAL const struct m0_fid * m0t1fs_inode_fid(const struct m0t1fs_inode *ci)
Definition: inode.c:61
M0_INTERNAL void m0t1fs_destroy_inode(struct inode *inode)
Definition: inode.c:256
int m0t1fs_mds_cob_getattr(struct m0t1fs_sb *csb, const struct m0t1fs_mdop *mo, struct m0_fop **rep_fop)
Definition: dir.c:2154
const struct address_space_operations m0t1fs_aops
Definition: file.c:6887
void * m0_fop_data(const struct m0_fop *fop)
Definition: fop.c:220
M0_INTERNAL const struct m0_fid M0_DOT_MOTR_FID_FID
Definition: md_fid.c:53
static struct kmem_cache * m0t1fs_inode_cachep
Definition: inode.c:48
M0_INTERNAL void m0t1fs_file_lock_fini(struct m0t1fs_inode *ci)
Definition: inode.c:162
#define M0_BITS(...)
Definition: misc.h:236
M0_INTERNAL void m0_rm_remote_init(struct m0_rm_remote *rem, struct m0_rm_resource *res)
Definition: rm.c:1411
uint64_t b_size
Definition: md_fops.h:78
#define M0_SET0(obj)
Definition: misc.h:64
M0_INTERNAL void m0_mutex_lock(struct m0_mutex *mutex)
Definition: mutex.c:49
M0_INTERNAL int m0_fid_cmp(const struct m0_fid *fid0, const struct m0_fid *fid1)
Definition: fid.c:170
struct m0t1fs_sb * csb
Definition: dir.c:330
M0_INTERNAL bool m0_fid_is_set(const struct m0_fid *fid)
Definition: fid.c:106
struct m0_fop_getxattr_rep * rep
Definition: dir.c:455
struct m0_pdclust_attr pl_attr
Definition: pdclust.h:150
const char * bt_name
Definition: bob.h:73
M0_INTERNAL void m0t1fs_inode_cache_fini(void)
Definition: inode.c:118
M0_INTERNAL int m0_rm_owner_timedwait(struct m0_rm_owner *owner, uint64_t state, const m0_time_t abs_timeout)
Definition: rm.c:892
static struct m0_pools_common pc
Definition: iter_ut.c:59
struct inode * inode
Definition: dir.c:624
M0_INTERNAL int m0_layout_instance_build(struct m0_layout *l, const struct m0_fid *fid, struct m0_layout_instance **out)
Definition: layout.c:1113
M0_INTERNAL void m0t1fs_inode_bob_init(struct m0t1fs_inode *bob)
struct m0_fop_cob * body
Definition: dir.c:1436
struct m0_fid fid
Definition: di.c:46
return M0_RC(rc)
M0_INTERNAL bool m0t1fs_inode_is_dot_motr_fid(const struct inode *inode)
Definition: inode.c:83
#define M0_ENTRY(...)
Definition: trace.h:170
M0_INTERNAL bool m0t1fs_inode_bob_check(struct m0t1fs_inode *bob)
void m0_fop_put0_lock(struct m0_fop *fop)
Definition: fop.c:213
uint32_t b_ctime
Definition: md_fops.h:89
return M0_ERR(-EOPNOTSUPP)
Definition: trace.h:482
M0_INTERNAL uint64_t m0_pool_version2layout_id(const struct m0_fid *pv_fid, uint64_t lid)
Definition: pool.c:1900
#define m0_tl_teardown(name, head, obj)
Definition: tlist.h:708
#define m0_free0(pptr)
Definition: memory.h:77
#define M0_ASSERT(cond)
M0_INTERNAL const char * m0_bool_to_str(bool b)
Definition: misc.c:207
struct m0t1fs_mdop mo
Definition: dir.c:332
M0_THREAD_ENTER
Definition: dir.c:336
static void m0t1fs_inode_ispti_fini(struct m0t1fs_inode *ci)
Definition: inode.c:195
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
int layout_id
Definition: dir.c:331
M0_INTERNAL void m0_file_owner_init(struct m0_rm_owner *owner, const struct m0_uint128 *grp_id, struct m0_file *file, struct m0_rm_remote *creditor)
Definition: file.c:507
uint64_t b_lid
Definition: md_fops.h:90
M0_INTERNAL struct m0_pdclust_layout * m0_layout_to_pdl(const struct m0_layout *l)
Definition: pdclust.c:382
M0_INTERNAL void m0_mutex_init(struct m0_mutex *mutex)
Definition: mutex.c:35
struct m0_fid b_pver
Definition: md_fops.h:93
M0_INTERNAL const struct m0_fid M0_DOT_MOTR_FID
Definition: md_fid.c:46
const struct file_operations m0t1fs_fid_dir_file_operations
Definition: dir.c:2557
static void m0t1fs_inode_init(struct m0t1fs_inode *ci)
Definition: inode.c:178
M0_INTERNAL int m0t1fs_inode_layout_rebuild(struct m0t1fs_inode *ci, struct m0_fop_cob *body)
Definition: inode.c:600
M0_TL_DESCR_DEFINE(ispti, "m0_reqh_service_txid pending an inode",, struct m0_reqh_service_txid, stx_tlink, stx_link_magic, M0_T1FS_INODE_PTI_MAGIC1, M0_T1FS_INODE_PTI_MAGIC2)
static struct super_block super_block
Definition: fsync.c:84
uint32_t b_atime
Definition: md_fops.h:87
#define FID_P(f)
Definition: fid.h:77
M0_INTERNAL struct inode * m0t1fs_alloc_inode(struct super_block *sb)
Definition: inode.c:236
M0_INTERNAL bool m0_fid_eq(const struct m0_fid *fid0, const struct m0_fid *fid1)
Definition: fid.c:164
struct m0_reqh_service_type m0_rms_type
Definition: rm_service.c:69
M0_INTERNAL struct m0_reqh_service * m0_reqh_service_find(const struct m0_reqh_service_type *st, const struct m0_reqh *reqh)
Definition: reqh_service.c:538
static struct super_block sb
Definition: file.c:85
uint64_t b_blocks
Definition: md_fops.h:80
static int m0t1fs_inode_read(struct inode *inode, struct m0_fop_cob *body)
Definition: inode.c:428
Definition: fid.h:38
M0_INTERNAL void m0_rm_remote_fini(struct m0_rm_remote *rem)
Definition: rm.c:1431
M0_INTERNAL void m0t1fs_inode_update(struct inode *inode, struct m0_fop_cob *body)
Definition: inode.c:389
const struct inode_operations m0t1fs_dir_inode_operations
Definition: dir.c:2574
M0_INTERNAL bool m0t1fs_inode_is_root(const struct inode *inode)
Definition: inode.c:68
static const struct m0_bob_type m0t1fs_inode_bob
Definition: inode.c:50
Definition: rm.h:863
M0_INTERNAL void m0_rm_owner_windup(struct m0_rm_owner *owner)
Definition: rm.c:930
const struct inode_operations m0t1fs_fid_dir_inode_operations
Definition: dir.c:2592
M0_INTERNAL void m0_mutex_fini(struct m0_mutex *mutex)
Definition: mutex.c:42
void m0t1fs_fid_accept(struct m0t1fs_sb *csb, const struct m0_fid *fid)
Definition: dir.c:265
#define M0_UINT128(hi, lo)
Definition: types.h:40
M0_INTERNAL void m0_file_fini(struct m0_file *file)
Definition: file.c:498
M0_INTERNAL struct m0_rpc_session * m0_pools_common_active_rm_session(struct m0_pools_common *pc)
Definition: pool.c:1074
M0_INTERNAL void m0_layout_instance_fini(struct m0_layout_instance *li)
Definition: layout.c:1123
M0_INTERNAL bool m0t1fs_inode_is_dot_motr(const struct inode *inode)
Definition: inode.c:76
M0_INTERNAL void m0t1fs_file_lock_init(struct m0t1fs_inode *ci, struct m0t1fs_sb *csb)
Definition: inode.c:136
unlock_new_inode(inode)
M0_INTERNAL int m0t1fs_inode_test(struct inode *inode, void *opaque)
Definition: inode.c:332
M0_INTERNAL void m0_layout_put(struct m0_layout *l)
Definition: layout.c:893
#define out(...)
Definition: gen.c:41
M0_INTERNAL void m0_file_owner_fini(struct m0_rm_owner *owner)
Definition: file.c:516
M0_INTERNAL struct inode * m0t1fs_root_iget(struct super_block *sb, const struct m0_fid *root_fid)
Definition: inode.c:280
const struct m0_uint128 m0_rm_m0t1fs_group
Definition: inode.c:59
M0_INTERNAL bool m0_fid_is_valid(const struct m0_fid *fid)
Definition: fid.c:96
const struct inode_operations m0t1fs_reg_inode_operations
Definition: file.c:6771
const struct file_operations m0t1fs_dir_file_operations
Definition: dir.c:2539
int32_t rc
Definition: trigger_fop.h:47
uint32_t b_gid
Definition: md_fops.h:83
#define offsetof(typ, memb)
Definition: misc.h:29
const struct file_operations m0t1fs_reg_file_operations
Definition: file.c:5602
Definition: fop.h:79
#define FID_F
Definition: fid.h:75
Definition: trace.h:478
static int m0t1fs_inode_set(struct inode *inode, void *opaque)
Definition: inode.c:351
M0_INTERNAL struct m0_rm_domain * m0t1fs_rm_domain_get(struct m0t1fs_sb *sb)
Definition: inode.c:130
M0_INTERNAL void m0_file_init(struct m0_file *file, const struct m0_fid *fid, struct m0_rm_domain *dom, enum m0_di_types di_type)
Definition: file.c:477
struct m0_fop * rep_fop
Definition: dir.c:334
M0_TL_DEFINE(ispti,, struct m0_reqh_service_txid)