Re: [PATCH 2/3] xfs: kill ialloced in xfs_dialloc()

Gao Xiang
2020-12-02T00:00:57Z

On Tue, Dec 01, 2020 at 09:04:20AM -0800, Darrick J. Wong wrote:
> On Tue, Nov 24, 2020 at 11:51:29PM +0800, Gao Xiang wrote:

...

> > @@ -1799,8 +1797,8 @@ xfs_dialloc(
> > goto nextag_relse_buffer;
> >
> >
> > - error = xfs_ialloc_ag_alloc(tp, agbp, &ialloced);
> > - if (error) {
> > + error = xfs_ialloc_ag_alloc(tp, agbp);
> > + if (error < 0) {
> > xfs_trans_brelse(tp, agbp);
> >
> > if (error != -ENOSPC)
> > @@ -1811,7 +1809,7 @@ xfs_dialloc(
> > return 0;
> > }
> >
> > - if (ialloced) {
> > + if (!error) {
>
> I wonder if this should be "if (error == 0)" because the comment
> for _ialloc_ag_alloc says that 0 and 1 have specific meanings?

I'm fine with either way personally, it could make checkpatch.pl
happy by using "if (!error)" though... (always follow such rule
when I walked into the kernel community...)

Thanks,
Gao Xiang

>
> Otherwise looks fine to me.
>
> --D
>
> > /*
> > * We successfully allocated some inodes, return
> > * the current context to the caller so that it
> > --
> > 2.18.4
> >
>