Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 128851
b: refs/heads/master
c: 7b12876
h: refs/heads/master
i:
  128849: 47b8c69
  128847: a391b04
v: v3
  • Loading branch information
Josef Bacik authored and Chris Mason committed Sep 25, 2008
1 parent 61231fd commit d5afe99
Show file tree
Hide file tree
Showing 8 changed files with 323 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 33268eaf0b3db5e2bd12c0ada81a8e8f87a46d68
refs/heads/master: 7b1287662304c3cb05cb38f5e3e2d69f386e8f10
2 changes: 1 addition & 1 deletion trunk/fs/btrfs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ btrfs-y := super.o ctree.o extent-tree.o print-tree.o root-tree.o dir-item.o \
hash.o file-item.o inode-item.o inode-map.o disk-io.o \
transaction.o bit-radix.o inode.o file.o tree-defrag.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
extent_io.o volumes.o async-thread.o ioctl.o locking.o orphan.o

btrfs-$(CONFIG_FS_POSIX_ACL) += acl.o
else
Expand Down
3 changes: 3 additions & 0 deletions trunk/fs/btrfs/btrfs_inode.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ struct btrfs_inode {
struct posix_acl *i_acl;
struct posix_acl *i_default_acl;

/* for keeping track of orphaned inodes */
struct list_head i_orphan;

/*
* transid of the trans_handle that last modified this inode
*/
Expand Down
2 changes: 1 addition & 1 deletion trunk/fs/btrfs/ctree.c
Original file line number Diff line number Diff line change
Expand Up @@ -2622,7 +2622,7 @@ int btrfs_insert_empty_items(struct btrfs_trans_handle *trans,
total_data += data_size[i];
}

total_size = total_data + (nr - 1) * sizeof(struct btrfs_item);
total_size = total_data + (nr * sizeof(struct btrfs_item));
ret = btrfs_search_slot(trans, root, cpu_key, path, total_size, 1);
if (ret == 0) {
return -EEXIST;
Expand Down
14 changes: 14 additions & 0 deletions trunk/fs/btrfs/ctree.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ struct btrfs_ordered_sum;
/* directory objectid inside the root tree */
#define BTRFS_ROOT_TREE_DIR_OBJECTID 6ULL

/* orhpan objectid for tracking unlinked/truncated files */
#define BTRFS_ORPHAN_OBJECTID -5ULL

/*
* All files have objectids higher than this.
*/
Expand Down Expand Up @@ -646,6 +649,9 @@ struct btrfs_root {

/* the dirty list is only used by non-reference counted roots */
struct list_head dirty_list;

spinlock_t orphan_lock;
struct list_head orphan_list;
};

/*
Expand All @@ -657,6 +663,7 @@ struct btrfs_root {
#define BTRFS_INODE_ITEM_KEY 1
#define BTRFS_INODE_REF_KEY 2
#define BTRFS_XATTR_ITEM_KEY 8
#define BTRFS_ORPHAN_ITEM_KEY 9
/* reserve 2-15 close to the inode for later flexibility */

/*
Expand Down Expand Up @@ -1560,6 +1567,13 @@ struct btrfs_dir_item *btrfs_lookup_xattr(struct btrfs_trans_handle *trans,
struct btrfs_path *path, u64 dir,
const char *name, u16 name_len,
int mod);

/* orphan.c */
int btrfs_insert_orphan_item(struct btrfs_trans_handle *trans,
struct btrfs_root *root, u64 offset);
int btrfs_del_orphan_item(struct btrfs_trans_handle *trans,
struct btrfs_root *root, u64 offset);

/* inode-map.c */
int btrfs_find_free_objectid(struct btrfs_trans_handle *trans,
struct btrfs_root *fs_root,
Expand Down
2 changes: 2 additions & 0 deletions trunk/fs/btrfs/disk-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,9 @@ static int __setup_root(u32 nodesize, u32 leafsize, u32 sectorsize,
root->in_sysfs = 0;

INIT_LIST_HEAD(&root->dirty_list);
INIT_LIST_HEAD(&root->orphan_list);
spin_lock_init(&root->node_lock);
spin_lock_init(&root->orphan_lock);
mutex_init(&root->objectid_mutex);
memset(&root->root_key, 0, sizeof(root->root_key));
memset(&root->root_item, 0, sizeof(root->root_item));
Expand Down
Loading

0 comments on commit d5afe99

Please sign in to comment.