--- initial
+++ final
@@ -1,163 +1,163 @@
 int                                     /* error status */
 xfs_bulkstat(xfs_mount_t *mp,           /* mount point for filesystem */
              xfs_ino_t *lastinop,       /* last inode returned */
              int *ubcountp,             /* size of buffer/count returned */
              bulkstat_one_pf formatter, /* func that'd fill a single buf */
              size_t statstruct_size,    /* sizeof struct filling */
              char __user *ubuffer,      /* buffer with inode stats */
              int *done)                 /* 1 if there are more stats to get */
 {
   xfs_buf_t *agbp;               /* agi header buffer */
   xfs_agino_t agino;             /* inode # in allocation group */
   xfs_agnumber_t agno;           /* allocation group number */
   xfs_btree_cur_t *cur;          /* btree cursor for ialloc btree */
   xfs_inobt_rec_incore_t *irbuf; /* start of irec buffer */
   int nirbuf;                    /* size of irbuf */
   int ubcount;                   /* size of user's buffer */
   struct xfs_bulkstat_agichunk ac;
   int error = 0;
   /*
    * Get the last inode value, see if there's nothing to do.
    */
   agno = XFS_INO_TO_AGNO(mp, *lastinop);
   agino = XFS_INO_TO_AGINO(mp, *lastinop);
   if (agno >= mp->m_sb.sb_agcount || *lastinop != XFS_AGINO_TO_INO(mp, agno, agino)) {
     *done = 1;
     *ubcountp = 0;
     return 0;
   }
   ubcount = *ubcountp; /* statstruct's */
   ac.ac_ubuffer = &ubuffer;
   ac.ac_ubleft = ubcount * statstruct_size; /* bytes */
   ;
   ac.ac_ubelem = 0;
   *ubcountp = 0;
   *done = 0;
   irbuf = kmem_zalloc_large(PAGE_SIZE * 4, KM_SLEEP);
   if (!irbuf) return -ENOMEM;
   nirbuf = (PAGE_SIZE * 4) / sizeof(*irbuf);
   /*
    * Loop over the allocation groups, starting from the last
    * inode returned; 0 means start of the allocation group.
    */
   while (agno < mp->m_sb.sb_agcount) {
     struct xfs_inobt_rec_incore *irbp = irbuf;
     struct xfs_inobt_rec_incore *irbufend = irbuf + nirbuf;
     bool end_of_ag = false;
     int icount = 0;
     int stat;
     error = xfs_ialloc_read_agi(mp, NULL, agno, &agbp);
     if (error) break;
     /*
      * Allocate and initialize a btree cursor for ialloc btree.
      */
     cur = xfs_inobt_init_cursor(mp, NULL, agbp, agno, XFS_BTNUM_INO);
     if (agino > 0) {
       /*
        * In the middle of an allocation group, we need to get
        * the remainder of the chunk we're in.
        */
       struct xfs_inobt_rec_incore r;
       error = xfs_bulkstat_grab_ichunk(cur, agino, &icount, &r);
       if (error) goto del_cursor;
       if (icount) {
         irbp->ir_startino = r.ir_startino;
         irbp->ir_holemask = r.ir_holemask;
         irbp->ir_count = r.ir_count;
         irbp->ir_freecount = r.ir_freecount;
         irbp->ir_free = r.ir_free;
         irbp++;
       }
       /* Increment to the next record */
       error = xfs_btree_increment(cur, 0, &stat);
     } else {
       /* Start of ag.  Lookup the first inode chunk */
       error = xfs_inobt_lookup(cur, 0, XFS_LOOKUP_GE, &stat);
     }
     if (error || stat == 0) {
       end_of_ag = true;
       goto del_cursor;
     }
     /*
      * Loop through inode btree records in this ag,
      * until we run out of inodes or space in the buffer.
      */
     while (irbp < irbufend && icount < ubcount) {
       struct xfs_inobt_rec_incore r;
       error = xfs_inobt_get_rec(cur, &r, &stat);
       if (error || stat == 0) {
         end_of_ag = true;
         goto del_cursor;
       }
       /*
        * If this chunk has any allocated inodes, save it.
        * Also start read-ahead now for this chunk.
        */
       if (r.ir_freecount < r.ir_count) {
         xfs_bulkstat_ichunk_ra(mp, agno, &r);
         irbp->ir_startino = r.ir_startino;
         irbp->ir_holemask = r.ir_holemask;
         irbp->ir_count = r.ir_count;
         irbp->ir_freecount = r.ir_freecount;
         irbp->ir_free = r.ir_free;
         irbp++;
         icount += r.ir_count - r.ir_freecount;
       }
       error = xfs_btree_increment(cur, 0, &stat);
       if (error || stat == 0) {
         end_of_ag = true;
         goto del_cursor;
       }
       cond_resched();
     }
     /*
      * Drop the btree buffers and the agi buffer as we can't hold any
      * of the locks these represent when calling iget. If there is a
      * pending error, then we are done.
      */
   del_cursor:
-    xfs_btree_del_cursor(cur, error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR);
+    xfs_btree_del_cursor(cur, error);
     xfs_buf_relse(agbp);
     if (error) break;
     /*
      * Now format all the good inodes into the user's buffer. The
      * call to xfs_bulkstat_ag_ichunk() sets up the agino pointer
      * for the next loop iteration.
      */
     irbufend = irbp;
     for (irbp = irbuf; irbp < irbufend && ac.ac_ubleft >= statstruct_size; irbp++) {
       error = xfs_bulkstat_ag_ichunk(mp, agno, irbp, formatter, statstruct_size, &ac, &agino);
       if (error) break;
       cond_resched();
     }
     /*
      * If we've run out of space or had a formatting error, we
      * are now done
      */
     if (ac.ac_ubleft < statstruct_size || error) break;
     if (end_of_ag) {
       agno++;
       agino = 0;
     }
   }
   /*
    * Done, we're either out of filesystem or space to put the data.
    */
   kmem_free(irbuf);
   *ubcountp = ac.ac_ubelem;
   /*
    * We found some inodes, so clear the error status and return them.
    * The lastino pointer will point directly at the inode that triggered
    * any error that occurred, so on the next call the error will be
    * triggered again and propagated to userspace as there will be no
    * formatted inodes in the buffer.
    */
   if (ac.ac_ubelem) error = 0;
   /*
    * If we ran out of filesystem, lastino will point off the end of
    * the filesystem so the next call will return immediately.
    */
   *lastinop = XFS_AGINO_TO_INO(mp, agno, agino);
   if (agno >= mp->m_sb.sb_agcount) *done = 1;
   return error;
 }<sep>@@
expression e,error;
@@

                xfs_btree_del_cursor(e, 
-                       (error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR)
+			error
		)