diff options
author | Tao Ma <tao.ma@oracle.com> | 2009-08-17 23:44:10 -0400 |
---|---|---|
committer | Joel Becker <joel.becker@oracle.com> | 2009-09-22 23:09:47 -0400 |
commit | 19bd341f6a6c6b314bcac55bbd906bfd3603fe9e (patch) | |
tree | 2eefd82e6ae2495b4d3288dc452763eea8d2fb37 | |
parent | c18b812d127a971901180188b918a7cd98ccd4d6 (diff) |
ocfs2: Use proper parameter for some inode operation.
In order to make the original function more suitable for reflink,
we modify the following inode operations. Both are tiny.
1. ocfs2_mknod_locked only use dentry for mlog, so move it to
the caller so that reflink can use it without dentry.
2. ocfs2_prepare_orphan_dir only want inode to get its ip_blkno.
So use ip_blkno instead.
Signed-off-by: Tao Ma <tao.ma@oracle.com>
-rw-r--r-- | fs/ocfs2/namei.c | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c index c07217ad8796..818df582ba06 100644 --- a/fs/ocfs2/namei.c +++ b/fs/ocfs2/namei.c | |||
@@ -69,7 +69,6 @@ | |||
69 | static int ocfs2_mknod_locked(struct ocfs2_super *osb, | 69 | static int ocfs2_mknod_locked(struct ocfs2_super *osb, |
70 | struct inode *dir, | 70 | struct inode *dir, |
71 | struct inode *inode, | 71 | struct inode *inode, |
72 | struct dentry *dentry, | ||
73 | dev_t dev, | 72 | dev_t dev, |
74 | struct buffer_head **new_fe_bh, | 73 | struct buffer_head **new_fe_bh, |
75 | struct buffer_head *parent_fe_bh, | 74 | struct buffer_head *parent_fe_bh, |
@@ -78,7 +77,7 @@ static int ocfs2_mknod_locked(struct ocfs2_super *osb, | |||
78 | 77 | ||
79 | static int ocfs2_prepare_orphan_dir(struct ocfs2_super *osb, | 78 | static int ocfs2_prepare_orphan_dir(struct ocfs2_super *osb, |
80 | struct inode **ret_orphan_dir, | 79 | struct inode **ret_orphan_dir, |
81 | struct inode *inode, | 80 | u64 blkno, |
82 | char *name, | 81 | char *name, |
83 | struct ocfs2_dir_lookup_result *lookup); | 82 | struct ocfs2_dir_lookup_result *lookup); |
84 | 83 | ||
@@ -358,8 +357,12 @@ static int ocfs2_mknod(struct inode *dir, | |||
358 | } | 357 | } |
359 | did_quota_inode = 1; | 358 | did_quota_inode = 1; |
360 | 359 | ||
360 | mlog_entry("(0x%p, 0x%p, %d, %lu, '%.*s')\n", dir, dentry, | ||
361 | inode->i_mode, (unsigned long)dev, dentry->d_name.len, | ||
362 | dentry->d_name.name); | ||
363 | |||
361 | /* do the real work now. */ | 364 | /* do the real work now. */ |
362 | status = ocfs2_mknod_locked(osb, dir, inode, dentry, dev, | 365 | status = ocfs2_mknod_locked(osb, dir, inode, dev, |
363 | &new_fe_bh, parent_fe_bh, handle, | 366 | &new_fe_bh, parent_fe_bh, handle, |
364 | inode_ac); | 367 | inode_ac); |
365 | if (status < 0) { | 368 | if (status < 0) { |
@@ -466,7 +469,6 @@ leave: | |||
466 | static int ocfs2_mknod_locked(struct ocfs2_super *osb, | 469 | static int ocfs2_mknod_locked(struct ocfs2_super *osb, |
467 | struct inode *dir, | 470 | struct inode *dir, |
468 | struct inode *inode, | 471 | struct inode *inode, |
469 | struct dentry *dentry, | ||
470 | dev_t dev, | 472 | dev_t dev, |
471 | struct buffer_head **new_fe_bh, | 473 | struct buffer_head **new_fe_bh, |
472 | struct buffer_head *parent_fe_bh, | 474 | struct buffer_head *parent_fe_bh, |
@@ -480,10 +482,6 @@ static int ocfs2_mknod_locked(struct ocfs2_super *osb, | |||
480 | u16 suballoc_bit; | 482 | u16 suballoc_bit; |
481 | u16 feat; | 483 | u16 feat; |
482 | 484 | ||
483 | mlog_entry("(0x%p, 0x%p, %d, %lu, '%.*s')\n", dir, dentry, | ||
484 | inode->i_mode, (unsigned long)dev, dentry->d_name.len, | ||
485 | dentry->d_name.name); | ||
486 | |||
487 | *new_fe_bh = NULL; | 485 | *new_fe_bh = NULL; |
488 | 486 | ||
489 | status = ocfs2_claim_new_inode(osb, handle, dir, parent_fe_bh, | 487 | status = ocfs2_claim_new_inode(osb, handle, dir, parent_fe_bh, |
@@ -852,7 +850,8 @@ static int ocfs2_unlink(struct inode *dir, | |||
852 | } | 850 | } |
853 | 851 | ||
854 | if (inode_is_unlinkable(inode)) { | 852 | if (inode_is_unlinkable(inode)) { |
855 | status = ocfs2_prepare_orphan_dir(osb, &orphan_dir, inode, | 853 | status = ocfs2_prepare_orphan_dir(osb, &orphan_dir, |
854 | OCFS2_I(inode)->ip_blkno, | ||
856 | orphan_name, &orphan_insert); | 855 | orphan_name, &orphan_insert); |
857 | if (status < 0) { | 856 | if (status < 0) { |
858 | mlog_errno(status); | 857 | mlog_errno(status); |
@@ -1243,9 +1242,8 @@ static int ocfs2_rename(struct inode *old_dir, | |||
1243 | 1242 | ||
1244 | if (S_ISDIR(new_inode->i_mode) || (new_inode->i_nlink == 1)) { | 1243 | if (S_ISDIR(new_inode->i_mode) || (new_inode->i_nlink == 1)) { |
1245 | status = ocfs2_prepare_orphan_dir(osb, &orphan_dir, | 1244 | status = ocfs2_prepare_orphan_dir(osb, &orphan_dir, |
1246 | new_inode, | 1245 | OCFS2_I(new_inode)->ip_blkno, |
1247 | orphan_name, | 1246 | orphan_name, &orphan_insert); |
1248 | &orphan_insert); | ||
1249 | if (status < 0) { | 1247 | if (status < 0) { |
1250 | mlog_errno(status); | 1248 | mlog_errno(status); |
1251 | goto bail; | 1249 | goto bail; |
@@ -1699,7 +1697,11 @@ static int ocfs2_symlink(struct inode *dir, | |||
1699 | } | 1697 | } |
1700 | did_quota_inode = 1; | 1698 | did_quota_inode = 1; |
1701 | 1699 | ||
1702 | status = ocfs2_mknod_locked(osb, dir, inode, dentry, | 1700 | mlog_entry("(0x%p, 0x%p, %d, '%.*s')\n", dir, dentry, |
1701 | inode->i_mode, dentry->d_name.len, | ||
1702 | dentry->d_name.name); | ||
1703 | |||
1704 | status = ocfs2_mknod_locked(osb, dir, inode, | ||
1703 | 0, &new_fe_bh, parent_fe_bh, handle, | 1705 | 0, &new_fe_bh, parent_fe_bh, handle, |
1704 | inode_ac); | 1706 | inode_ac); |
1705 | if (status < 0) { | 1707 | if (status < 0) { |
@@ -1849,7 +1851,7 @@ bail: | |||
1849 | 1851 | ||
1850 | static int ocfs2_prepare_orphan_dir(struct ocfs2_super *osb, | 1852 | static int ocfs2_prepare_orphan_dir(struct ocfs2_super *osb, |
1851 | struct inode **ret_orphan_dir, | 1853 | struct inode **ret_orphan_dir, |
1852 | struct inode *inode, | 1854 | u64 blkno, |
1853 | char *name, | 1855 | char *name, |
1854 | struct ocfs2_dir_lookup_result *lookup) | 1856 | struct ocfs2_dir_lookup_result *lookup) |
1855 | { | 1857 | { |
@@ -1857,7 +1859,7 @@ static int ocfs2_prepare_orphan_dir(struct ocfs2_super *osb, | |||
1857 | struct buffer_head *orphan_dir_bh = NULL; | 1859 | struct buffer_head *orphan_dir_bh = NULL; |
1858 | int status = 0; | 1860 | int status = 0; |
1859 | 1861 | ||
1860 | status = ocfs2_blkno_stringify(OCFS2_I(inode)->ip_blkno, name); | 1862 | status = ocfs2_blkno_stringify(blkno, name); |
1861 | if (status < 0) { | 1863 | if (status < 0) { |
1862 | mlog_errno(status); | 1864 | mlog_errno(status); |
1863 | return status; | 1865 | return status; |