diff options
author | Christoph Hellwig <hch@infradead.org> | 2012-07-04 10:54:47 -0400 |
---|---|---|
committer | Ben Myers <bpm@sgi.com> | 2012-07-29 17:00:31 -0400 |
commit | 08358906ed78f6ab4d3ff8e4fd1b87b9a4aea645 (patch) | |
tree | 47884ad2cba2ede418c6f4716c778c9d6ec88e81 /fs/xfs | |
parent | f2ecc5e453134a13c3b2b0f2cac52ab2d5c540d7 (diff) |
xfs: remove the alloc_done argument to xfs_dialloc
We can simplify check the IO_agbp pointer for being non-NULL instead of
passing another argument through two layers of function calls.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Mark Tinguely <tinguely@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r-- | fs/xfs/xfs_ialloc.c | 3 | ||||
-rw-r--r-- | fs/xfs/xfs_ialloc.h | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_inode.c | 5 | ||||
-rw-r--r-- | fs/xfs/xfs_inode.h | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_utils.c | 17 |
5 files changed, 10 insertions, 19 deletions
diff --git a/fs/xfs/xfs_ialloc.c b/fs/xfs/xfs_ialloc.c index a124b9f88aae..2b70952c9d8c 100644 --- a/fs/xfs/xfs_ialloc.c +++ b/fs/xfs/xfs_ialloc.c | |||
@@ -895,7 +895,6 @@ xfs_dialloc( | |||
895 | umode_t mode, | 895 | umode_t mode, |
896 | int okalloc, | 896 | int okalloc, |
897 | struct xfs_buf **IO_agbp, | 897 | struct xfs_buf **IO_agbp, |
898 | boolean_t *alloc_done, | ||
899 | xfs_ino_t *inop) | 898 | xfs_ino_t *inop) |
900 | { | 899 | { |
901 | struct xfs_buf *agbp; | 900 | struct xfs_buf *agbp; |
@@ -955,7 +954,6 @@ xfs_dialloc( | |||
955 | * or in which we can allocate some inodes. Iterate through the | 954 | * or in which we can allocate some inodes. Iterate through the |
956 | * allocation groups upward, wrapping at the end. | 955 | * allocation groups upward, wrapping at the end. |
957 | */ | 956 | */ |
958 | *alloc_done = B_FALSE; | ||
959 | while (!agi->agi_freecount) { | 957 | while (!agi->agi_freecount) { |
960 | /* | 958 | /* |
961 | * Don't do anything if we're not supposed to allocate | 959 | * Don't do anything if we're not supposed to allocate |
@@ -982,7 +980,6 @@ xfs_dialloc( | |||
982 | * us again where we left off. | 980 | * us again where we left off. |
983 | */ | 981 | */ |
984 | ASSERT(be32_to_cpu(agi->agi_freecount) > 0); | 982 | ASSERT(be32_to_cpu(agi->agi_freecount) > 0); |
985 | *alloc_done = B_TRUE; | ||
986 | *IO_agbp = agbp; | 983 | *IO_agbp = agbp; |
987 | *inop = NULLFSINO; | 984 | *inop = NULLFSINO; |
988 | return 0; | 985 | return 0; |
diff --git a/fs/xfs/xfs_ialloc.h b/fs/xfs/xfs_ialloc.h index 65ac57c8063c..1fd6ea4e9c91 100644 --- a/fs/xfs/xfs_ialloc.h +++ b/fs/xfs/xfs_ialloc.h | |||
@@ -75,8 +75,6 @@ xfs_dialloc( | |||
75 | umode_t mode, /* mode bits for new inode */ | 75 | umode_t mode, /* mode bits for new inode */ |
76 | int okalloc, /* ok to allocate more space */ | 76 | int okalloc, /* ok to allocate more space */ |
77 | struct xfs_buf **agbp, /* buf for a.g. inode header */ | 77 | struct xfs_buf **agbp, /* buf for a.g. inode header */ |
78 | boolean_t *alloc_done, /* an allocation was done to replenish | ||
79 | the free inodes */ | ||
80 | xfs_ino_t *inop); /* inode number allocated */ | 78 | xfs_ino_t *inop); /* inode number allocated */ |
81 | 79 | ||
82 | /* | 80 | /* |
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index d48e406de078..5c10825f2f80 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
@@ -887,7 +887,6 @@ xfs_ialloc( | |||
887 | prid_t prid, | 887 | prid_t prid, |
888 | int okalloc, | 888 | int okalloc, |
889 | xfs_buf_t **ialloc_context, | 889 | xfs_buf_t **ialloc_context, |
890 | boolean_t *call_again, | ||
891 | xfs_inode_t **ipp) | 890 | xfs_inode_t **ipp) |
892 | { | 891 | { |
893 | xfs_ino_t ino; | 892 | xfs_ino_t ino; |
@@ -902,10 +901,10 @@ xfs_ialloc( | |||
902 | * the on-disk inode to be allocated. | 901 | * the on-disk inode to be allocated. |
903 | */ | 902 | */ |
904 | error = xfs_dialloc(tp, pip ? pip->i_ino : 0, mode, okalloc, | 903 | error = xfs_dialloc(tp, pip ? pip->i_ino : 0, mode, okalloc, |
905 | ialloc_context, call_again, &ino); | 904 | ialloc_context, &ino); |
906 | if (error) | 905 | if (error) |
907 | return error; | 906 | return error; |
908 | if (*call_again || ino == NULLFSINO) { | 907 | if (*ialloc_context || ino == NULLFSINO) { |
909 | *ipp = NULL; | 908 | *ipp = NULL; |
910 | return 0; | 909 | return 0; |
911 | } | 910 | } |
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h index c2e2da3abae2..04d2fe421b97 100644 --- a/fs/xfs/xfs_inode.h +++ b/fs/xfs/xfs_inode.h | |||
@@ -517,7 +517,7 @@ void xfs_inode_free(struct xfs_inode *ip); | |||
517 | */ | 517 | */ |
518 | int xfs_ialloc(struct xfs_trans *, xfs_inode_t *, umode_t, | 518 | int xfs_ialloc(struct xfs_trans *, xfs_inode_t *, umode_t, |
519 | xfs_nlink_t, xfs_dev_t, prid_t, int, | 519 | xfs_nlink_t, xfs_dev_t, prid_t, int, |
520 | struct xfs_buf **, boolean_t *, xfs_inode_t **); | 520 | struct xfs_buf **, xfs_inode_t **); |
521 | 521 | ||
522 | uint xfs_ip2xflags(struct xfs_inode *); | 522 | uint xfs_ip2xflags(struct xfs_inode *); |
523 | uint xfs_dic2xflags(struct xfs_dinode *); | 523 | uint xfs_dic2xflags(struct xfs_dinode *); |
diff --git a/fs/xfs/xfs_utils.c b/fs/xfs/xfs_utils.c index 4e5b9ad5cb97..0025c78ac03c 100644 --- a/fs/xfs/xfs_utils.c +++ b/fs/xfs/xfs_utils.c | |||
@@ -65,7 +65,6 @@ xfs_dir_ialloc( | |||
65 | xfs_trans_t *ntp; | 65 | xfs_trans_t *ntp; |
66 | xfs_inode_t *ip; | 66 | xfs_inode_t *ip; |
67 | xfs_buf_t *ialloc_context = NULL; | 67 | xfs_buf_t *ialloc_context = NULL; |
68 | boolean_t call_again = B_FALSE; | ||
69 | int code; | 68 | int code; |
70 | uint log_res; | 69 | uint log_res; |
71 | uint log_count; | 70 | uint log_count; |
@@ -91,7 +90,7 @@ xfs_dir_ialloc( | |||
91 | * the inode(s) that we've just allocated. | 90 | * the inode(s) that we've just allocated. |
92 | */ | 91 | */ |
93 | code = xfs_ialloc(tp, dp, mode, nlink, rdev, prid, okalloc, | 92 | code = xfs_ialloc(tp, dp, mode, nlink, rdev, prid, okalloc, |
94 | &ialloc_context, &call_again, &ip); | 93 | &ialloc_context, &ip); |
95 | 94 | ||
96 | /* | 95 | /* |
97 | * Return an error if we were unable to allocate a new inode. | 96 | * Return an error if we were unable to allocate a new inode. |
@@ -102,19 +101,18 @@ xfs_dir_ialloc( | |||
102 | *ipp = NULL; | 101 | *ipp = NULL; |
103 | return code; | 102 | return code; |
104 | } | 103 | } |
105 | if (!call_again && (ip == NULL)) { | 104 | if (!ialloc_context && !ip) { |
106 | *ipp = NULL; | 105 | *ipp = NULL; |
107 | return XFS_ERROR(ENOSPC); | 106 | return XFS_ERROR(ENOSPC); |
108 | } | 107 | } |
109 | 108 | ||
110 | /* | 109 | /* |
111 | * If call_again is set, then we were unable to get an | 110 | * If the AGI buffer is non-NULL, then we were unable to get an |
112 | * inode in one operation. We need to commit the current | 111 | * inode in one operation. We need to commit the current |
113 | * transaction and call xfs_ialloc() again. It is guaranteed | 112 | * transaction and call xfs_ialloc() again. It is guaranteed |
114 | * to succeed the second time. | 113 | * to succeed the second time. |
115 | */ | 114 | */ |
116 | if (call_again) { | 115 | if (ialloc_context) { |
117 | |||
118 | /* | 116 | /* |
119 | * Normally, xfs_trans_commit releases all the locks. | 117 | * Normally, xfs_trans_commit releases all the locks. |
120 | * We call bhold to hang on to the ialloc_context across | 118 | * We call bhold to hang on to the ialloc_context across |
@@ -195,7 +193,7 @@ xfs_dir_ialloc( | |||
195 | * this call should always succeed. | 193 | * this call should always succeed. |
196 | */ | 194 | */ |
197 | code = xfs_ialloc(tp, dp, mode, nlink, rdev, prid, | 195 | code = xfs_ialloc(tp, dp, mode, nlink, rdev, prid, |
198 | okalloc, &ialloc_context, &call_again, &ip); | 196 | okalloc, &ialloc_context, &ip); |
199 | 197 | ||
200 | /* | 198 | /* |
201 | * If we get an error at this point, return to the caller | 199 | * If we get an error at this point, return to the caller |
@@ -206,12 +204,11 @@ xfs_dir_ialloc( | |||
206 | *ipp = NULL; | 204 | *ipp = NULL; |
207 | return code; | 205 | return code; |
208 | } | 206 | } |
209 | ASSERT ((!call_again) && (ip != NULL)); | 207 | ASSERT(!ialloc_context && ip); |
210 | 208 | ||
211 | } else { | 209 | } else { |
212 | if (committed != NULL) { | 210 | if (committed != NULL) |
213 | *committed = 0; | 211 | *committed = 0; |
214 | } | ||
215 | } | 212 | } |
216 | 213 | ||
217 | *ipp = ip; | 214 | *ipp = ip; |