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 <slava@dubeyko.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christoph Hellwig <hch@infradead.org>
Acked-by: Hin-Tak Leung <htl10@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Vyacheslav Dubeyko
2013-11-12 15:11:09 -08:00
committed by Linus Torvalds
parent 099e9245e0
commit 95e0d7dbb9
3 changed files with 151 additions and 2 deletions

View File

@@ -126,6 +126,14 @@ struct hfs_bnode {
#define HFS_BNODE_DIRTY 3
#define HFS_BNODE_DELETED 4
/*
* Attributes file states
*/
#define HFSPLUS_EMPTY_ATTR_TREE 0
#define HFSPLUS_CREATING_ATTR_TREE 1
#define HFSPLUS_VALID_ATTR_TREE 2
#define HFSPLUS_FAILED_ATTR_TREE 3
/*
* HFS+ superblock info (built from Volume Header on disk)
*/
@@ -141,6 +149,7 @@ struct hfsplus_sb_info {
struct hfs_btree *ext_tree;
struct hfs_btree *cat_tree;
struct hfs_btree *attr_tree;
atomic_t attr_tree_state;
struct inode *alloc_file;
struct inode *hidden_dir;
struct nls_table *nls;