Lines Matching refs:dentry

19 static int ovl_encode_maybe_copy_up(struct dentry *dentry)  in ovl_encode_maybe_copy_up()  argument
23 if (ovl_dentry_upper(dentry)) in ovl_encode_maybe_copy_up()
26 err = ovl_want_write(dentry); in ovl_encode_maybe_copy_up()
28 err = ovl_copy_up(dentry); in ovl_encode_maybe_copy_up()
29 ovl_drop_write(dentry); in ovl_encode_maybe_copy_up()
34 dentry, err); in ovl_encode_maybe_copy_up()
77 static int ovl_connectable_layer(struct dentry *dentry) in ovl_connectable_layer() argument
79 struct ovl_entry *oe = OVL_E(dentry); in ovl_connectable_layer()
82 if (dentry == dentry->d_sb->s_root) in ovl_connectable_layer()
89 if (ovl_dentry_upper(dentry) && in ovl_connectable_layer()
90 !ovl_test_flag(OVL_INDEX, d_inode(dentry))) in ovl_connectable_layer()
105 static int ovl_connect_layer(struct dentry *dentry) in ovl_connect_layer() argument
107 struct dentry *next, *parent = NULL; in ovl_connect_layer()
111 if (WARN_ON(dentry == dentry->d_sb->s_root) || in ovl_connect_layer()
112 WARN_ON(!ovl_dentry_lower(dentry))) in ovl_connect_layer()
115 origin_layer = OVL_E(dentry)->lowerstack[0].layer->idx; in ovl_connect_layer()
116 if (ovl_dentry_test_flag(OVL_E_CONNECTED, dentry)) in ovl_connect_layer()
120 next = dget(dentry); in ovl_connect_layer()
150 ovl_dentry_set_flag(OVL_E_CONNECTED, dentry); in ovl_connect_layer()
183 static int ovl_check_encode_origin(struct dentry *dentry) in ovl_check_encode_origin() argument
185 struct ovl_fs *ofs = dentry->d_sb->s_fs_info; in ovl_check_encode_origin()
188 if (!ovl_dentry_lower(dentry)) in ovl_check_encode_origin()
197 if (ovl_dentry_upper(dentry) && in ovl_check_encode_origin()
198 !ovl_test_flag(OVL_INDEX, d_inode(dentry))) in ovl_check_encode_origin()
207 if (d_is_dir(dentry) && ovl_upper_mnt(ofs)) in ovl_check_encode_origin()
208 return ovl_connect_layer(dentry); in ovl_check_encode_origin()
214 static int ovl_dentry_to_fid(struct ovl_fs *ofs, struct dentry *dentry, in ovl_dentry_to_fid() argument
225 err = enc_lower = ovl_check_encode_origin(dentry); in ovl_dentry_to_fid()
230 fh = ovl_encode_real_fh(ofs, enc_lower ? ovl_dentry_lower(dentry) : in ovl_dentry_to_fid()
231 ovl_dentry_upper(dentry), !enc_lower); in ovl_dentry_to_fid()
246 dentry, err); in ovl_dentry_to_fid()
254 struct dentry *dentry; in ovl_encode_fh() local
261 dentry = d_find_any_alias(inode); in ovl_encode_fh()
262 if (WARN_ON(!dentry)) in ovl_encode_fh()
265 bytes = ovl_dentry_to_fid(ofs, dentry, fid, buflen); in ovl_encode_fh()
266 dput(dentry); in ovl_encode_fh()
280 static struct dentry *ovl_obtain_alias(struct super_block *sb, in ovl_obtain_alias()
281 struct dentry *upper_alias, in ovl_obtain_alias()
283 struct dentry *index) in ovl_obtain_alias()
285 struct dentry *lower = lowerpath ? lowerpath->dentry : NULL; in ovl_obtain_alias()
286 struct dentry *upper = upper_alias ?: index; in ovl_obtain_alias()
287 struct dentry *dentry; in ovl_obtain_alias() local
310 dentry = d_find_any_alias(inode); in ovl_obtain_alias()
311 if (dentry) in ovl_obtain_alias()
314 dentry = d_alloc_anon(inode->i_sb); in ovl_obtain_alias()
315 if (unlikely(!dentry)) in ovl_obtain_alias()
322 oe->lowerstack->dentry = dget(lower); in ovl_obtain_alias()
325 dentry->d_fsdata = oe; in ovl_obtain_alias()
327 ovl_dentry_set_upper_alias(dentry); in ovl_obtain_alias()
329 ovl_dentry_update_reval(dentry, upper, in ovl_obtain_alias()
332 return d_instantiate_anon(dentry, inode); in ovl_obtain_alias()
335 dput(dentry); in ovl_obtain_alias()
336 dentry = ERR_PTR(-ENOMEM); in ovl_obtain_alias()
339 return dentry; in ovl_obtain_alias()
343 static struct dentry *ovl_dentry_real_at(struct dentry *dentry, int idx) in ovl_dentry_real_at() argument
345 struct ovl_entry *oe = dentry->d_fsdata; in ovl_dentry_real_at()
349 return ovl_dentry_upper(dentry); in ovl_dentry_real_at()
353 return oe->lowerstack[i].dentry; in ovl_dentry_real_at()
365 static struct dentry *ovl_lookup_real_one(struct dentry *connected, in ovl_lookup_real_one()
366 struct dentry *real, in ovl_lookup_real_one()
370 struct dentry *this, *parent = NULL; in ovl_lookup_real_one()
421 static struct dentry *ovl_lookup_real(struct super_block *sb,
422 struct dentry *real,
428 static struct dentry *ovl_lookup_real_inode(struct super_block *sb, in ovl_lookup_real_inode()
429 struct dentry *real, in ovl_lookup_real_inode()
433 struct dentry *index = NULL; in ovl_lookup_real_inode()
434 struct dentry *this = NULL; in ovl_lookup_real_inode()
461 struct dentry *upper = ovl_index_upper(ofs, index); in ovl_lookup_real_inode()
493 static struct dentry *ovl_lookup_real_ancestor(struct super_block *sb, in ovl_lookup_real_ancestor()
494 struct dentry *real, in ovl_lookup_real_ancestor()
497 struct dentry *next, *parent = NULL; in ovl_lookup_real_ancestor()
498 struct dentry *ancestor = ERR_PTR(-EIO); in ovl_lookup_real_ancestor()
546 static struct dentry *ovl_lookup_real(struct super_block *sb, in ovl_lookup_real()
547 struct dentry *real, in ovl_lookup_real()
550 struct dentry *connected; in ovl_lookup_real()
558 struct dentry *next, *this; in ovl_lookup_real()
559 struct dentry *parent = NULL; in ovl_lookup_real()
560 struct dentry *real_connected = ovl_dentry_real_at(connected, in ovl_lookup_real()
648 static struct dentry *ovl_get_dentry(struct super_block *sb, in ovl_get_dentry()
649 struct dentry *upper, in ovl_get_dentry()
651 struct dentry *index) in ovl_get_dentry()
655 struct dentry *real = upper ?: (index ?: lowerpath->dentry); in ovl_get_dentry()
675 static struct dentry *ovl_upper_fh_to_d(struct super_block *sb, in ovl_upper_fh_to_d()
679 struct dentry *dentry; in ovl_upper_fh_to_d() local
680 struct dentry *upper; in ovl_upper_fh_to_d()
689 dentry = ovl_get_dentry(sb, upper, NULL, NULL); in ovl_upper_fh_to_d()
692 return dentry; in ovl_upper_fh_to_d()
695 static struct dentry *ovl_lower_fh_to_d(struct super_block *sb, in ovl_lower_fh_to_d()
701 struct dentry *dentry = NULL; in ovl_lower_fh_to_d() local
702 struct dentry *index = NULL; in ovl_lower_fh_to_d()
711 if (!d_is_dir(origin.dentry) || in ovl_lower_fh_to_d()
712 !(origin.dentry->d_flags & DCACHE_DISCONNECTED)) { in ovl_lower_fh_to_d()
713 inode = ovl_lookup_inode(sb, origin.dentry, false); in ovl_lower_fh_to_d()
718 dentry = d_find_any_alias(inode); in ovl_lower_fh_to_d()
720 if (dentry) in ovl_lower_fh_to_d()
737 struct dentry *upper = ovl_index_upper(ofs, index); in ovl_lower_fh_to_d()
743 dentry = ovl_get_dentry(sb, upper, NULL, NULL); in ovl_lower_fh_to_d()
749 if (d_is_dir(origin.dentry)) { in ovl_lower_fh_to_d()
750 dput(origin.dentry); in ovl_lower_fh_to_d()
751 origin.dentry = NULL; in ovl_lower_fh_to_d()
757 err = ovl_verify_origin(ofs, index, origin.dentry, false); in ovl_lower_fh_to_d()
763 dentry = ovl_get_dentry(sb, NULL, &origin, index); in ovl_lower_fh_to_d()
766 dput(origin.dentry); in ovl_lower_fh_to_d()
768 return dentry; in ovl_lower_fh_to_d()
771 dentry = ERR_PTR(err); in ovl_lower_fh_to_d()
798 static struct dentry *ovl_fh_to_dentry(struct super_block *sb, struct fid *fid, in ovl_fh_to_dentry()
801 struct dentry *dentry = NULL; in ovl_fh_to_dentry() local
817 dentry = (flags & OVL_FH_FLAG_PATH_UPPER) ? in ovl_fh_to_dentry()
820 err = PTR_ERR(dentry); in ovl_fh_to_dentry()
821 if (IS_ERR(dentry) && err != -ESTALE) in ovl_fh_to_dentry()
829 return dentry; in ovl_fh_to_dentry()
834 dentry = ERR_PTR(err); in ovl_fh_to_dentry()
838 static struct dentry *ovl_fh_to_parent(struct super_block *sb, struct fid *fid, in ovl_fh_to_parent()
845 static int ovl_get_name(struct dentry *parent, char *name, in ovl_get_name()
846 struct dentry *child) in ovl_get_name()
856 static struct dentry *ovl_get_parent(struct dentry *dentry) in ovl_get_parent() argument