diff options
author | Mark Fasheh <mfasheh@suse.com> | 2010-08-14 00:15:19 +0200 |
---|---|---|
committer | Tao Ma <tao.ma@oracle.com> | 2010-09-08 08:26:00 +0200 |
commit | 97b8f4a9dfd932997677136e11980eb2fafea91d (patch) | |
tree | 63f1a6555c61f4ce421c7b9d7358a34a6e919c6a /lib | |
parent | ocfs2: split out ocfs2_prepare_orphan_dir() into locking and prep functions (diff) | |
download | linux-97b8f4a9dfd932997677136e11980eb2fafea91d.tar.xz linux-97b8f4a9dfd932997677136e11980eb2fafea91d.zip |
ocfs2: Fix orphan add in ocfs2_create_inode_in_orphan
ocfs2_create_inode_in_orphan() is used by reflink to create the newly
reflinked inode simultaneously in the orphan dir. This allows us to easily
handle partially-reflinked files during recovery cleanup.
We have a problem though - the orphan dir stringifies inode # to determine
a unique name under which the orphan entry dirent can be created. Since
ocfs2_create_inode_in_orphan() needs the space allocated in the orphan dir
before it can allocate the inode, we currently call into the orphan code:
/*
* We give the orphan dir the root blkno to fake an orphan name,
* and allocate enough space for our insertion.
*/
status = ocfs2_prepare_orphan_dir(osb, &orphan_dir,
osb->root_blkno,
orphan_name, &orphan_insert);
Using osb->root_blkno might work fine on unindexed directories, but the
orphan dir can have an index. When it has that index, the above code fails
to allocate the proper index entry. Later, when we try to remove the file
from the orphan dir (using the actual inode #), the reflink operation will
fail.
To fix this, I created a function ocfs2_alloc_orphaned_file() which uses the
newly split out orphan and inode alloc code to figure out what the inode
block number will be (once allocated) and then prepare the orphan dir from
that data.
Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Signed-off-by: Tao Ma <tao.ma@oracle.com>
Diffstat (limited to 'lib')
0 files changed, 0 insertions, 0 deletions