From 95e0d7dbb9b28ab0dfad7c7316066b05e1f1d4cd Mon Sep 17 00:00:00 2001 From: Vyacheslav Dubeyko Date: Tue, 12 Nov 2013 15:11:09 -0800 Subject: hfsplus: implement attributes file creation functionality Implement functionality of creation AttributesFile metadata file on HFS+ volume in the case of absence of it. It makes trying to open AttributesFile's B-tree during mount of HFS+ volume. If HFS+ volume hasn't AttributesFile then a pointer on AttributesFile's B-tree keeps as NULL. Thereby, when it is discovered absence of AttributesFile on HFS+ volume in the begin of xattr creation operation then AttributesFile will be created. The creation of AttributesFile will have success in the case of availability (2 * clump) free blocks on HFS+ volume. Otherwise, creation operation is ended with error (-ENOSPC). Signed-off-by: Vyacheslav Dubeyko Cc: Al Viro Cc: Christoph Hellwig Acked-by: Hin-Tak Leung Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- fs/hfsplus/super.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'fs/hfsplus/super.c') diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c index 4c4d142cf890..80875aa640ef 100644 --- a/fs/hfsplus/super.c +++ b/fs/hfsplus/super.c @@ -474,12 +474,14 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent) pr_err("failed to load catalog file\n"); goto out_close_ext_tree; } + atomic_set(&sbi->attr_tree_state, HFSPLUS_EMPTY_ATTR_TREE); if (vhdr->attr_file.total_blocks != 0) { sbi->attr_tree = hfs_btree_open(sb, HFSPLUS_ATTR_CNID); if (!sbi->attr_tree) { pr_err("failed to load attributes file\n"); goto out_close_cat_tree; } + atomic_set(&sbi->attr_tree_state, HFSPLUS_VALID_ATTR_TREE); } sb->s_xattr = hfsplus_xattr_handlers; -- cgit 1.4.1