diff options
author | Mark Fasheh <mfasheh@suse.com> | 2009-12-07 16:15:40 -0500 |
---|---|---|
committer | Joel Becker <joel.becker@oracle.com> | 2010-05-05 21:17:30 -0400 |
commit | 4fe370afaae49c57619bb0bedb75de7e7c168308 (patch) | |
tree | 7b2752fc9616578e9e3baa659e6c724b301d26c5 | |
parent | d02f00cc057809d96c044cc72d5b9809d59f7d49 (diff) |
ocfs2: use allocation reservations during file write
Add a per-inode reservations structure and pass it through to the
reservations code.
Signed-off-by: Mark Fasheh <mfasheh@suse.com>
-rw-r--r-- | fs/ocfs2/alloc.c | 2 | ||||
-rw-r--r-- | fs/ocfs2/aops.c | 3 | ||||
-rw-r--r-- | fs/ocfs2/file.c | 3 | ||||
-rw-r--r-- | fs/ocfs2/inode.c | 4 | ||||
-rw-r--r-- | fs/ocfs2/inode.h | 2 | ||||
-rw-r--r-- | fs/ocfs2/super.c | 2 |
6 files changed, 16 insertions, 0 deletions
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c index 89e994dad026..a74ea700ffdc 100644 --- a/fs/ocfs2/alloc.c +++ b/fs/ocfs2/alloc.c | |||
@@ -7211,6 +7211,8 @@ int ocfs2_convert_inline_data_to_extents(struct inode *inode, | |||
7211 | goto out_commit; | 7211 | goto out_commit; |
7212 | did_quota = 1; | 7212 | did_quota = 1; |
7213 | 7213 | ||
7214 | data_ac->ac_resv = &OCFS2_I(inode)->ip_la_data_resv; | ||
7215 | |||
7214 | ret = ocfs2_claim_clusters(osb, handle, data_ac, 1, &bit_off, | 7216 | ret = ocfs2_claim_clusters(osb, handle, data_ac, 1, &bit_off, |
7215 | &num); | 7217 | &num); |
7216 | if (ret) { | 7218 | if (ret) { |
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c index 21441ddb5506..3623ca20cc18 100644 --- a/fs/ocfs2/aops.c +++ b/fs/ocfs2/aops.c | |||
@@ -1735,6 +1735,9 @@ int ocfs2_write_begin_nolock(struct address_space *mapping, | |||
1735 | goto out; | 1735 | goto out; |
1736 | } | 1736 | } |
1737 | 1737 | ||
1738 | if (data_ac) | ||
1739 | data_ac->ac_resv = &OCFS2_I(inode)->ip_la_data_resv; | ||
1740 | |||
1738 | credits = ocfs2_calc_extend_credits(inode->i_sb, | 1741 | credits = ocfs2_calc_extend_credits(inode->i_sb, |
1739 | &di->id2.i_list, | 1742 | &di->id2.i_list, |
1740 | clusters_to_alloc); | 1743 | clusters_to_alloc); |
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index e6e8281628a6..19d16f2ef81e 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
@@ -483,6 +483,9 @@ static int ocfs2_truncate_file(struct inode *inode, | |||
483 | 483 | ||
484 | down_write(&OCFS2_I(inode)->ip_alloc_sem); | 484 | down_write(&OCFS2_I(inode)->ip_alloc_sem); |
485 | 485 | ||
486 | ocfs2_resv_discard(&osb->osb_la_resmap, | ||
487 | &OCFS2_I(inode)->ip_la_data_resv); | ||
488 | |||
486 | /* | 489 | /* |
487 | * The inode lock forced other nodes to sync and drop their | 490 | * The inode lock forced other nodes to sync and drop their |
488 | * pages, which (correctly) happens even if we have a truncate | 491 | * pages, which (correctly) happens even if we have a truncate |
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c index 7cc0b4665d5e..62b4743fb6f1 100644 --- a/fs/ocfs2/inode.c +++ b/fs/ocfs2/inode.c | |||
@@ -1096,6 +1096,10 @@ void ocfs2_clear_inode(struct inode *inode) | |||
1096 | ocfs2_mark_lockres_freeing(&oi->ip_inode_lockres); | 1096 | ocfs2_mark_lockres_freeing(&oi->ip_inode_lockres); |
1097 | ocfs2_mark_lockres_freeing(&oi->ip_open_lockres); | 1097 | ocfs2_mark_lockres_freeing(&oi->ip_open_lockres); |
1098 | 1098 | ||
1099 | ocfs2_resv_discard(&OCFS2_SB(inode->i_sb)->osb_la_resmap, | ||
1100 | &oi->ip_la_data_resv); | ||
1101 | ocfs2_resv_init_once(&oi->ip_la_data_resv); | ||
1102 | |||
1099 | /* We very well may get a clear_inode before all an inodes | 1103 | /* We very well may get a clear_inode before all an inodes |
1100 | * metadata has hit disk. Of course, we can't drop any cluster | 1104 | * metadata has hit disk. Of course, we can't drop any cluster |
1101 | * locks until the journal has finished with it. The only | 1105 | * locks until the journal has finished with it. The only |
diff --git a/fs/ocfs2/inode.h b/fs/ocfs2/inode.h index ba4fe07b293c..e45edca02594 100644 --- a/fs/ocfs2/inode.h +++ b/fs/ocfs2/inode.h | |||
@@ -70,6 +70,8 @@ struct ocfs2_inode_info | |||
70 | /* Only valid if the inode is the dir. */ | 70 | /* Only valid if the inode is the dir. */ |
71 | u32 ip_last_used_slot; | 71 | u32 ip_last_used_slot; |
72 | u64 ip_last_used_group; | 72 | u64 ip_last_used_group; |
73 | |||
74 | struct ocfs2_alloc_reservation ip_la_data_resv; | ||
73 | }; | 75 | }; |
74 | 76 | ||
75 | /* | 77 | /* |
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index cfe672e72b27..2a9f4c455f28 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c | |||
@@ -1707,6 +1707,8 @@ static void ocfs2_inode_init_once(void *data) | |||
1707 | oi->ip_blkno = 0ULL; | 1707 | oi->ip_blkno = 0ULL; |
1708 | oi->ip_clusters = 0; | 1708 | oi->ip_clusters = 0; |
1709 | 1709 | ||
1710 | ocfs2_resv_init_once(&oi->ip_la_data_resv); | ||
1711 | |||
1710 | ocfs2_lock_res_init_once(&oi->ip_rw_lockres); | 1712 | ocfs2_lock_res_init_once(&oi->ip_rw_lockres); |
1711 | ocfs2_lock_res_init_once(&oi->ip_inode_lockres); | 1713 | ocfs2_lock_res_init_once(&oi->ip_inode_lockres); |
1712 | ocfs2_lock_res_init_once(&oi->ip_open_lockres); | 1714 | ocfs2_lock_res_init_once(&oi->ip_open_lockres); |