Skip to contentSkip to conversation

Btrfs: added helper functions to iterate backrefs

PATCH New Li Zefan 1 participant 1 message Aug 19, 2011 Btrfs file system

lore
Share & tools
lore

Li Zefan

author
#0 lore raw

PATCH 1/2 Btrfs: added helper functions to iterate backrefs

From: Jan Schmidt <[email protected]>

These helper functions iterate back references and call a function for each backref. There is also a function to resolve an inode to a path in the file system.

---
 fs/btrfs/Makefile  |    3 +-
 fs/btrfs/backref.c |  764 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 fs/btrfs/backref.h |   62 +++++
 fs/btrfs/ioctl.h   |   11 +
 4 files changed, 839 insertions(+), 1 deletions(-)
 create mode 100644 fs/btrfs/backref.c
 create mode 100644 fs/btrfs/backref.h
fs/btrfs/Makefile +2 -1
index 40e6ac0..89b6ce3 100644
@@ -7,6 +7,7 @@ btrfs-y += super.o ctree.o extent-tree.o print-tree.o root-tree.o dir-item.o \
 	   extent_map.o sysfs.o struct-funcs.o xattr.o ordered-data.o \
 	   extent_io.o volumes.o async-thread.o ioctl.o locking.o orphan.o \
 	   export.o tree-log.o free-space-cache.o zlib.o lzo.o \
-	   compression.o delayed-ref.o relocation.o delayed-inode.o scrub.o
+	   compression.o delayed-ref.o relocation.o delayed-inode.o backref.o \
+	   scrub.o
 
 btrfs-$(CONFIG_BTRFS_FS_POSIX_ACL) += acl.o
fs/btrfs/backref.c new file +764 -0

764 lines not on this page · raw message

fs/btrfs/backref.h new file +62 -0

62 lines not on this page · raw message

fs/btrfs/ioctl.h +11 -0
index ad1ea78..1857e38 100644
@@ -193,6 +193,17 @@ struct btrfs_ioctl_space_args {
 	struct btrfs_ioctl_space_info spaces[0];
 };
 
+struct btrfs_data_container {
+	__u32	bytes_left;	/* out -- bytes not needed to deliver output */
+	__u32	bytes_missing;	/* out -- additional bytes needed for result */
+	__u32	elem_cnt;	/* out */
+	__u32	elem_missed;	/* out */
+	union {
+		char	*str[0];	/* out */
+		__u64	val[0];		/* out */
+	};
+};
+
 #define BTRFS_IOC_SNAP_CREATE _IOW(BTRFS_IOCTL_MAGIC, 1, \
 				   struct btrfs_ioctl_vol_args)
 #define BTRFS_IOC_DEFRAG _IOW(BTRFS_IOCTL_MAGIC, 2, \
Signature · 1 line
1.7.3.1