Skip to contentSkip to conversation

Progs: Add fallocate support v2

PATCH New Yan Zheng 1 participant 1 message Oct 30, 2008 Btrfs file system

lore
Share & tools
lore

Yan Zheng

author
#0 lore raw

PATCH 1/1 Progs: Add fallocate support v2

Hello,

This patch updates btrfs-progs for fallocate support.

Regards

---

btrfsck.c +2 -2
diff -urp btrfs-progs-unstable/btrfsck.c btrfs-progs/btrfsck.c
@@ -621,8 +621,8 @@ static int run_next_block(struct btrfs_r
 				continue;
 			fi = btrfs_item_ptr(buf, i,
 					    struct btrfs_file_extent_item);
-			if (btrfs_file_extent_type(buf, fi) !=
-			    BTRFS_FILE_EXTENT_REG)
+			if (btrfs_file_extent_type(buf, fi) ==
+			    BTRFS_FILE_EXTENT_INLINE)
 				continue;
 			if (btrfs_file_extent_disk_bytenr(buf, fi) == 0)
 				continue;
ctree.h +7 -2
diff -urp btrfs-progs-unstable/ctree.h btrfs-progs/ctree.h
@@ -427,6 +427,7 @@ struct btrfs_root_item {
 	__le64 bytenr;
 	__le64 byte_limit;
 	__le64 bytes_used;
+	__le64 last_snapshot;
 	__le32 flags;
 	__le32 refs;
 	struct btrfs_disk_key drop_progress;
@@ -434,8 +435,9 @@ struct btrfs_root_item {
 	u8 level;
 } __attribute__ ((__packed__));
 
-#define BTRFS_FILE_EXTENT_REG 0
-#define BTRFS_FILE_EXTENT_INLINE 1
+#define BTRFS_FILE_EXTENT_INLINE 0
+#define BTRFS_FILE_EXTENT_REG 1
+#define BTRFS_FILE_EXTENT_PREALLOC 2
 
 struct btrfs_file_extent_item {
 	/*
@@ -1251,6 +1253,9 @@ BTRFS_SETGET_STACK_FUNCS(root_refs, stru
 BTRFS_SETGET_STACK_FUNCS(root_flags, struct btrfs_root_item, flags, 32);
 BTRFS_SETGET_STACK_FUNCS(root_used, struct btrfs_root_item, bytes_used, 64);
 BTRFS_SETGET_STACK_FUNCS(root_limit, struct btrfs_root_item, byte_limit, 64);
+BTRFS_SETGET_STACK_FUNCS(root_last_snapshot, struct btrfs_root_item,
+			 last_snapshot, 64);
+
 
 /* struct btrfs_super_block */
 BTRFS_SETGET_STACK_FUNCS(super_bytenr, struct btrfs_super_block, bytenr, 64);
print-tree.c +36 -19

67 lines not on this page · raw message