brintos

brintos / linux-shallow public Read only

0
0
Text · 1.0 KiB · 5e116b8 Raw
43 lines · c
1/* SPDX-License-Identifier: GPL-2.0 */2#ifndef _BCACHEFS_DIRENT_FORMAT_H3#define _BCACHEFS_DIRENT_FORMAT_H4 5/*6 * Dirents (and xattrs) have to implement string lookups; since our b-tree7 * doesn't support arbitrary length strings for the key, we instead index by a8 * 64 bit hash (currently truncated sha1) of the string, stored in the offset9 * field of the key - using linear probing to resolve hash collisions. This also10 * provides us with the readdir cookie posix requires.11 *12 * Linear probing requires us to use whiteouts for deletions, in the event of a13 * collision:14 */15 16struct bch_dirent {17	struct bch_val		v;18 19	/* Target inode number: */20	union {21	__le64			d_inum;22	struct {		/* DT_SUBVOL */23	__le32			d_child_subvol;24	__le32			d_parent_subvol;25	};26	};27 28	/*29	 * Copy of mode bits 12-15 from the target inode - so userspace can get30	 * the filetype without having to do a stat()31	 */32	__u8			d_type;33 34	__u8			d_name[];35} __packed __aligned(8);36 37#define DT_SUBVOL	1638#define BCH_DT_MAX	1739 40#define BCH_NAME_MAX	51241 42#endif /* _BCACHEFS_DIRENT_FORMAT_H */43