diff options
author | Mark Fasheh <mark.fasheh@oracle.com> | 2007-06-22 18:45:27 -0400 |
---|---|---|
committer | Mark Fasheh <mark.fasheh@oracle.com> | 2007-07-10 20:31:54 -0400 |
commit | 2b604351bc99b4e4504758cbac369b660b71de0b (patch) | |
tree | 293fa51f1ae9d19db0d09c721cc8433303cc8974 /fs/ocfs2/suballoc.c | |
parent | bce997682fe3121516f5a20cf7bad2e6029ba018 (diff) |
ocfs2: simplify deallocation locking
Deallocation of suballocator blocks, most notably extent blocks, might
involve multiple suballocator inodes.
The locking for this can get extremely complicated, especially when the
suballocator inodes to delete from aren't known until deep within an
unrelated codepath.
Implement a simple scheme for recording the blocks to be unlinked so that
the actual deallocation can be done in a context which won't deadlock.
Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
Diffstat (limited to 'fs/ocfs2/suballoc.c')
-rw-r--r-- | fs/ocfs2/suballoc.c | 27 |
1 files changed, 6 insertions, 21 deletions
diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c index e3437626d183..6788f2f1a667 100644 --- a/fs/ocfs2/suballoc.c +++ b/fs/ocfs2/suballoc.c | |||
@@ -98,14 +98,6 @@ static int ocfs2_relink_block_group(handle_t *handle, | |||
98 | u16 chain); | 98 | u16 chain); |
99 | static inline int ocfs2_block_group_reasonably_empty(struct ocfs2_group_desc *bg, | 99 | static inline int ocfs2_block_group_reasonably_empty(struct ocfs2_group_desc *bg, |
100 | u32 wanted); | 100 | u32 wanted); |
101 | static int ocfs2_free_suballoc_bits(handle_t *handle, | ||
102 | struct inode *alloc_inode, | ||
103 | struct buffer_head *alloc_bh, | ||
104 | unsigned int start_bit, | ||
105 | u64 bg_blkno, | ||
106 | unsigned int count); | ||
107 | static inline u64 ocfs2_which_suballoc_group(u64 block, | ||
108 | unsigned int bit); | ||
109 | static inline u32 ocfs2_desc_bitmap_to_cluster_off(struct inode *inode, | 101 | static inline u32 ocfs2_desc_bitmap_to_cluster_off(struct inode *inode, |
110 | u64 bg_blkno, | 102 | u64 bg_blkno, |
111 | u16 bg_bit_off); | 103 | u16 bg_bit_off); |
@@ -1626,12 +1618,12 @@ bail: | |||
1626 | /* | 1618 | /* |
1627 | * expects the suballoc inode to already be locked. | 1619 | * expects the suballoc inode to already be locked. |
1628 | */ | 1620 | */ |
1629 | static int ocfs2_free_suballoc_bits(handle_t *handle, | 1621 | int ocfs2_free_suballoc_bits(handle_t *handle, |
1630 | struct inode *alloc_inode, | 1622 | struct inode *alloc_inode, |
1631 | struct buffer_head *alloc_bh, | 1623 | struct buffer_head *alloc_bh, |
1632 | unsigned int start_bit, | 1624 | unsigned int start_bit, |
1633 | u64 bg_blkno, | 1625 | u64 bg_blkno, |
1634 | unsigned int count) | 1626 | unsigned int count) |
1635 | { | 1627 | { |
1636 | int status = 0; | 1628 | int status = 0; |
1637 | u32 tmp_used; | 1629 | u32 tmp_used; |
@@ -1703,13 +1695,6 @@ bail: | |||
1703 | return status; | 1695 | return status; |
1704 | } | 1696 | } |
1705 | 1697 | ||
1706 | static inline u64 ocfs2_which_suballoc_group(u64 block, unsigned int bit) | ||
1707 | { | ||
1708 | u64 group = block - (u64) bit; | ||
1709 | |||
1710 | return group; | ||
1711 | } | ||
1712 | |||
1713 | int ocfs2_free_dinode(handle_t *handle, | 1698 | int ocfs2_free_dinode(handle_t *handle, |
1714 | struct inode *inode_alloc_inode, | 1699 | struct inode *inode_alloc_inode, |
1715 | struct buffer_head *inode_alloc_bh, | 1700 | struct buffer_head *inode_alloc_bh, |