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>
This commit is contained in:
parent
f2ecc5e453
commit
08358906ed
|
@ -895,7 +895,6 @@ xfs_dialloc(
|
||||||
umode_t mode,
|
umode_t mode,
|
||||||
int okalloc,
|
int okalloc,
|
||||||
struct xfs_buf **IO_agbp,
|
struct xfs_buf **IO_agbp,
|
||||||
boolean_t *alloc_done,
|
|
||||||
xfs_ino_t *inop)
|
xfs_ino_t *inop)
|
||||||
{
|
{
|
||||||
struct xfs_buf *agbp;
|
struct xfs_buf *agbp;
|
||||||
|
@ -955,7 +954,6 @@ xfs_dialloc(
|
||||||
* or in which we can allocate some inodes. Iterate through the
|
* or in which we can allocate some inodes. Iterate through the
|
||||||
* allocation groups upward, wrapping at the end.
|
* allocation groups upward, wrapping at the end.
|
||||||
*/
|
*/
|
||||||
*alloc_done = B_FALSE;
|
|
||||||
while (!agi->agi_freecount) {
|
while (!agi->agi_freecount) {
|
||||||
/*
|
/*
|
||||||
* Don't do anything if we're not supposed to allocate
|
* Don't do anything if we're not supposed to allocate
|
||||||
|
@ -982,7 +980,6 @@ xfs_dialloc(
|
||||||
* us again where we left off.
|
* us again where we left off.
|
||||||
*/
|
*/
|
||||||
ASSERT(be32_to_cpu(agi->agi_freecount) > 0);
|
ASSERT(be32_to_cpu(agi->agi_freecount) > 0);
|
||||||
*alloc_done = B_TRUE;
|
|
||||||
*IO_agbp = agbp;
|
*IO_agbp = agbp;
|
||||||
*inop = NULLFSINO;
|
*inop = NULLFSINO;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -75,8 +75,6 @@ xfs_dialloc(
|
||||||
umode_t mode, /* mode bits for new inode */
|
umode_t mode, /* mode bits for new inode */
|
||||||
int okalloc, /* ok to allocate more space */
|
int okalloc, /* ok to allocate more space */
|
||||||
struct xfs_buf **agbp, /* buf for a.g. inode header */
|
struct xfs_buf **agbp, /* buf for a.g. inode header */
|
||||||
boolean_t *alloc_done, /* an allocation was done to replenish
|
|
||||||
the free inodes */
|
|
||||||
xfs_ino_t *inop); /* inode number allocated */
|
xfs_ino_t *inop); /* inode number allocated */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -887,7 +887,6 @@ xfs_ialloc(
|
||||||
prid_t prid,
|
prid_t prid,
|
||||||
int okalloc,
|
int okalloc,
|
||||||
xfs_buf_t **ialloc_context,
|
xfs_buf_t **ialloc_context,
|
||||||
boolean_t *call_again,
|
|
||||||
xfs_inode_t **ipp)
|
xfs_inode_t **ipp)
|
||||||
{
|
{
|
||||||
xfs_ino_t ino;
|
xfs_ino_t ino;
|
||||||
|
@ -902,10 +901,10 @@ xfs_ialloc(
|
||||||
* the on-disk inode to be allocated.
|
* the on-disk inode to be allocated.
|
||||||
*/
|
*/
|
||||||
error = xfs_dialloc(tp, pip ? pip->i_ino : 0, mode, okalloc,
|
error = xfs_dialloc(tp, pip ? pip->i_ino : 0, mode, okalloc,
|
||||||
ialloc_context, call_again, &ino);
|
ialloc_context, &ino);
|
||||||
if (error)
|
if (error)
|
||||||
return error;
|
return error;
|
||||||
if (*call_again || ino == NULLFSINO) {
|
if (*ialloc_context || ino == NULLFSINO) {
|
||||||
*ipp = NULL;
|
*ipp = NULL;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -517,7 +517,7 @@ void xfs_inode_free(struct xfs_inode *ip);
|
||||||
*/
|
*/
|
||||||
int xfs_ialloc(struct xfs_trans *, xfs_inode_t *, umode_t,
|
int xfs_ialloc(struct xfs_trans *, xfs_inode_t *, umode_t,
|
||||||
xfs_nlink_t, xfs_dev_t, prid_t, int,
|
xfs_nlink_t, xfs_dev_t, prid_t, int,
|
||||||
struct xfs_buf **, boolean_t *, xfs_inode_t **);
|
struct xfs_buf **, xfs_inode_t **);
|
||||||
|
|
||||||
uint xfs_ip2xflags(struct xfs_inode *);
|
uint xfs_ip2xflags(struct xfs_inode *);
|
||||||
uint xfs_dic2xflags(struct xfs_dinode *);
|
uint xfs_dic2xflags(struct xfs_dinode *);
|
||||||
|
|
|
@ -65,7 +65,6 @@ xfs_dir_ialloc(
|
||||||
xfs_trans_t *ntp;
|
xfs_trans_t *ntp;
|
||||||
xfs_inode_t *ip;
|
xfs_inode_t *ip;
|
||||||
xfs_buf_t *ialloc_context = NULL;
|
xfs_buf_t *ialloc_context = NULL;
|
||||||
boolean_t call_again = B_FALSE;
|
|
||||||
int code;
|
int code;
|
||||||
uint log_res;
|
uint log_res;
|
||||||
uint log_count;
|
uint log_count;
|
||||||
|
@ -91,7 +90,7 @@ xfs_dir_ialloc(
|
||||||
* the inode(s) that we've just allocated.
|
* the inode(s) that we've just allocated.
|
||||||
*/
|
*/
|
||||||
code = xfs_ialloc(tp, dp, mode, nlink, rdev, prid, okalloc,
|
code = xfs_ialloc(tp, dp, mode, nlink, rdev, prid, okalloc,
|
||||||
&ialloc_context, &call_again, &ip);
|
&ialloc_context, &ip);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return an error if we were unable to allocate a new inode.
|
* Return an error if we were unable to allocate a new inode.
|
||||||
|
@ -102,19 +101,18 @@ xfs_dir_ialloc(
|
||||||
*ipp = NULL;
|
*ipp = NULL;
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
if (!call_again && (ip == NULL)) {
|
if (!ialloc_context && !ip) {
|
||||||
*ipp = NULL;
|
*ipp = NULL;
|
||||||
return XFS_ERROR(ENOSPC);
|
return XFS_ERROR(ENOSPC);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If call_again is set, then we were unable to get an
|
* If the AGI buffer is non-NULL, then we were unable to get an
|
||||||
* inode in one operation. We need to commit the current
|
* inode in one operation. We need to commit the current
|
||||||
* transaction and call xfs_ialloc() again. It is guaranteed
|
* transaction and call xfs_ialloc() again. It is guaranteed
|
||||||
* to succeed the second time.
|
* to succeed the second time.
|
||||||
*/
|
*/
|
||||||
if (call_again) {
|
if (ialloc_context) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Normally, xfs_trans_commit releases all the locks.
|
* Normally, xfs_trans_commit releases all the locks.
|
||||||
* We call bhold to hang on to the ialloc_context across
|
* We call bhold to hang on to the ialloc_context across
|
||||||
|
@ -195,7 +193,7 @@ xfs_dir_ialloc(
|
||||||
* this call should always succeed.
|
* this call should always succeed.
|
||||||
*/
|
*/
|
||||||
code = xfs_ialloc(tp, dp, mode, nlink, rdev, prid,
|
code = xfs_ialloc(tp, dp, mode, nlink, rdev, prid,
|
||||||
okalloc, &ialloc_context, &call_again, &ip);
|
okalloc, &ialloc_context, &ip);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we get an error at this point, return to the caller
|
* If we get an error at this point, return to the caller
|
||||||
|
@ -206,12 +204,11 @@ xfs_dir_ialloc(
|
||||||
*ipp = NULL;
|
*ipp = NULL;
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
ASSERT ((!call_again) && (ip != NULL));
|
ASSERT(!ialloc_context && ip);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (committed != NULL) {
|
if (committed != NULL)
|
||||||
*committed = 0;
|
*committed = 0;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*ipp = ip;
|
*ipp = ip;
|
||||||
|
|
Loading…
Reference in New Issue