aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/namei.c
diff options
context:
space:
mode:
authorMark Fasheh <mark.fasheh@oracle.com>2006-10-06 21:34:35 -0400
committerMark Fasheh <mark.fasheh@oracle.com>2006-12-01 21:27:49 -0500
commitda5cbf2f9df922cfdafa39351691fa83517f1e25 (patch)
tree845dc288b72f0408870f50605bb3c96eec978dd8 /fs/ocfs2/namei.c
parent8d5596c687c49c1d8812c3456946dec15d069139 (diff)
ocfs2: don't use handle for locking in allocation functions
Instead we record our state on the allocation context structure which all callers already know about and lifetime correctly. This means the reservation functions don't need a handle passed in any more, and we can also take it off the alloc context. Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
Diffstat (limited to 'fs/ocfs2/namei.c')
-rw-r--r--fs/ocfs2/namei.c26
1 files changed, 6 insertions, 20 deletions
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c
index 5bd5f9948a2f..ca012446d8e7 100644
--- a/fs/ocfs2/namei.c
+++ b/fs/ocfs2/namei.c
@@ -334,13 +334,6 @@ static int ocfs2_mknod(struct inode *dir,
334 return status; 334 return status;
335 } 335 }
336 336
337 handle = ocfs2_alloc_handle(osb);
338 if (handle == NULL) {
339 status = -ENOMEM;
340 mlog_errno(status);
341 goto leave;
342 }
343
344 if (S_ISDIR(mode) && (dir->i_nlink >= OCFS2_LINK_MAX)) { 337 if (S_ISDIR(mode) && (dir->i_nlink >= OCFS2_LINK_MAX)) {
345 status = -EMLINK; 338 status = -EMLINK;
346 goto leave; 339 goto leave;
@@ -368,7 +361,7 @@ static int ocfs2_mknod(struct inode *dir,
368 } 361 }
369 362
370 /* reserve an inode spot */ 363 /* reserve an inode spot */
371 status = ocfs2_reserve_new_inode(osb, handle, &inode_ac); 364 status = ocfs2_reserve_new_inode(osb, &inode_ac);
372 if (status < 0) { 365 if (status < 0) {
373 if (status != -ENOSPC) 366 if (status != -ENOSPC)
374 mlog_errno(status); 367 mlog_errno(status);
@@ -378,7 +371,7 @@ static int ocfs2_mknod(struct inode *dir,
378 /* are we making a directory? If so, reserve a cluster for his 371 /* are we making a directory? If so, reserve a cluster for his
379 * 1st extent. */ 372 * 1st extent. */
380 if (S_ISDIR(mode)) { 373 if (S_ISDIR(mode)) {
381 status = ocfs2_reserve_clusters(osb, handle, 1, &data_ac); 374 status = ocfs2_reserve_clusters(osb, 1, &data_ac);
382 if (status < 0) { 375 if (status < 0) {
383 if (status != -ENOSPC) 376 if (status != -ENOSPC)
384 mlog_errno(status); 377 mlog_errno(status);
@@ -386,7 +379,7 @@ static int ocfs2_mknod(struct inode *dir,
386 } 379 }
387 } 380 }
388 381
389 handle = ocfs2_start_trans(osb, handle, OCFS2_MKNOD_CREDITS); 382 handle = ocfs2_start_trans(osb, NULL, OCFS2_MKNOD_CREDITS);
390 if (IS_ERR(handle)) { 383 if (IS_ERR(handle)) {
391 status = PTR_ERR(handle); 384 status = PTR_ERR(handle);
392 handle = NULL; 385 handle = NULL;
@@ -1649,14 +1642,7 @@ static int ocfs2_symlink(struct inode *dir,
1649 goto bail; 1642 goto bail;
1650 } 1643 }
1651 1644
1652 handle = ocfs2_alloc_handle(osb); 1645 status = ocfs2_reserve_new_inode(osb, &inode_ac);
1653 if (handle == NULL) {
1654 status = -ENOMEM;
1655 mlog_errno(status);
1656 goto bail;
1657 }
1658
1659 status = ocfs2_reserve_new_inode(osb, handle, &inode_ac);
1660 if (status < 0) { 1646 if (status < 0) {
1661 if (status != -ENOSPC) 1647 if (status != -ENOSPC)
1662 mlog_errno(status); 1648 mlog_errno(status);
@@ -1665,7 +1651,7 @@ static int ocfs2_symlink(struct inode *dir,
1665 1651
1666 /* don't reserve bitmap space for fast symlinks. */ 1652 /* don't reserve bitmap space for fast symlinks. */
1667 if (l > ocfs2_fast_symlink_chars(sb)) { 1653 if (l > ocfs2_fast_symlink_chars(sb)) {
1668 status = ocfs2_reserve_clusters(osb, handle, 1, &data_ac); 1654 status = ocfs2_reserve_clusters(osb, 1, &data_ac);
1669 if (status < 0) { 1655 if (status < 0) {
1670 if (status != -ENOSPC) 1656 if (status != -ENOSPC)
1671 mlog_errno(status); 1657 mlog_errno(status);
@@ -1673,7 +1659,7 @@ static int ocfs2_symlink(struct inode *dir,
1673 } 1659 }
1674 } 1660 }
1675 1661
1676 handle = ocfs2_start_trans(osb, handle, credits); 1662 handle = ocfs2_start_trans(osb, NULL, credits);
1677 if (IS_ERR(handle)) { 1663 if (IS_ERR(handle)) {
1678 status = PTR_ERR(handle); 1664 status = PTR_ERR(handle);
1679 handle = NULL; 1665 handle = NULL;