]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/xfs/xfs_dir2_block.c
Merge branch 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6-omap-h63xx.git] / fs / xfs / xfs_dir2_block.c
index e4df1aaae2a2083c911d864d102641e6da80644f..fb5a556725b344904090769fb37c78f6e970179a 100644 (file)
@@ -22,6 +22,7 @@
 #include "xfs_inum.h"
 #include "xfs_trans.h"
 #include "xfs_sb.h"
+#include "xfs_ag.h"
 #include "xfs_dir2.h"
 #include "xfs_dmapi.h"
 #include "xfs_mount.h"
@@ -270,7 +271,7 @@ xfs_dir2_block_addname(
                }
                lfloglow = toidx + 1 - (be32_to_cpu(btp->stale) - 1);
                lfloghigh -= be32_to_cpu(btp->stale) - 1;
-               be32_add(&btp->count, -(be32_to_cpu(btp->stale) - 1));
+               be32_add_cpu(&btp->count, -(be32_to_cpu(btp->stale) - 1));
                xfs_dir2_data_make_free(tp, bp,
                        (xfs_dir2_data_aoff_t)((char *)blp - (char *)block),
                        (xfs_dir2_data_aoff_t)((be32_to_cpu(btp->stale) - 1) * sizeof(*blp)),
@@ -325,7 +326,7 @@ xfs_dir2_block_addname(
                /*
                 * Update the tail (entry count).
                 */
-               be32_add(&btp->count, 1);
+               be32_add_cpu(&btp->count, 1);
                /*
                 * If we now need to rebuild the bestfree map, do so.
                 * This needs to happen before the next call to use_free.
@@ -386,7 +387,7 @@ xfs_dir2_block_addname(
                        lfloglow = MIN(mid, lfloglow);
                        lfloghigh = MAX(highstale, lfloghigh);
                }
-               be32_add(&btp->stale, -1);
+               be32_add_cpu(&btp->stale, -1);
        }
        /*
         * Point to the new data entry.
@@ -432,12 +433,10 @@ xfs_dir2_block_addname(
  */
 int                                            /* error */
 xfs_dir2_block_getdents(
-       xfs_trans_t             *tp,            /* transaction (NULL) */
        xfs_inode_t             *dp,            /* incore inode */
-       uio_t                   *uio,           /* caller's buffer control */
-       int                     *eofp,          /* eof reached? (out) */
-       xfs_dirent_t            *dbp,           /* caller's buffer */
-       xfs_dir2_put_t          put)            /* abi's formatting function */
+       void                    *dirent,
+       xfs_off_t               *offset,
+       filldir_t               filldir)
 {
        xfs_dir2_block_t        *block;         /* directory block structure */
        xfs_dabuf_t             *bp;            /* buffer for block */
@@ -447,31 +446,32 @@ xfs_dir2_block_getdents(
        char                    *endptr;        /* end of the data entries */
        int                     error;          /* error return value */
        xfs_mount_t             *mp;            /* filesystem mount point */
-       xfs_dir2_put_args_t     p;              /* arg package for put rtn */
        char                    *ptr;           /* current data entry */
        int                     wantoff;        /* starting block offset */
+       xfs_ino_t               ino;
+       xfs_off_t               cook;
 
        mp = dp->i_mount;
        /*
         * If the block number in the offset is out of range, we're done.
         */
-       if (xfs_dir2_dataptr_to_db(mp, uio->uio_offset) > mp->m_dirdatablk) {
-               *eofp = 1;
+       if (xfs_dir2_dataptr_to_db(mp, *offset) > mp->m_dirdatablk) {
                return 0;
        }
        /*
         * Can't read the block, give up, else get dabuf in bp.
         */
-       if ((error =
-           xfs_da_read_buf(tp, dp, mp->m_dirdatablk, -1, &bp, XFS_DATA_FORK))) {
+       error = xfs_da_read_buf(NULL, dp, mp->m_dirdatablk, -1,
+                               &bp, XFS_DATA_FORK);
+       if (error)
                return error;
-       }
+
        ASSERT(bp != NULL);
        /*
         * Extract the byte offset we start at from the seek pointer.
         * We'll skip entries before this.
         */
-       wantoff = xfs_dir2_dataptr_to_off(mp, uio->uio_offset);
+       wantoff = xfs_dir2_dataptr_to_off(mp, *offset);
        block = bp->data;
        xfs_dir2_data_check(dp, bp);
        /*
@@ -480,9 +480,7 @@ xfs_dir2_block_getdents(
        btp = xfs_dir2_block_tail_p(mp, block);
        ptr = (char *)block->u;
        endptr = (char *)xfs_dir2_block_leaf_p(btp);
-       p.dbp = dbp;
-       p.put = put;
-       p.uio = uio;
+
        /*
         * Loop over the data portion of the block.
         * Each object is a real entry (dep) or an unused one (dup).
@@ -508,33 +506,22 @@ xfs_dir2_block_getdents(
                 */
                if ((char *)dep - (char *)block < wantoff)
                        continue;
-               /*
-                * Set up argument structure for put routine.
-                */
-               p.namelen = dep->namelen;
 
-               p.cook = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk,
-                                                   ptr - (char *)block);
-               p.ino = be64_to_cpu(dep->inumber);
+               cook = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk,
+                                           (char *)dep - (char *)block);
+               ino = be64_to_cpu(dep->inumber);
 #if XFS_BIG_INUMS
-               p.ino += mp->m_inoadd;
+               ino += mp->m_inoadd;
 #endif
-               p.name = (char *)dep->name;
-
-               /*
-                * Put the entry in the caller's buffer.
-                */
-               error = p.put(&p);
 
                /*
                 * If it didn't fit, set the final offset to here & return.
                 */
-               if (!p.done) {
-                       uio->uio_offset =
-                               xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk,
-                                       (char *)dep - (char *)block);
-                       xfs_da_brelse(tp, bp);
-                       return error;
+               if (filldir(dirent, dep->name, dep->namelen, cook,
+                           ino, DT_UNKNOWN)) {
+                       *offset = cook;
+                       xfs_da_brelse(NULL, bp);
+                       return 0;
                }
        }
 
@@ -542,13 +529,8 @@ xfs_dir2_block_getdents(
         * Reached the end of the block.
         * Set the offset to a non-existent block 1 and return.
         */
-       *eofp = 1;
-
-       uio->uio_offset =
-               xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk + 1, 0);
-
-       xfs_da_brelse(tp, bp);
-
+       *offset = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk + 1, 0);
+       xfs_da_brelse(NULL, bp);
        return 0;
 }
 
@@ -785,7 +767,7 @@ xfs_dir2_block_removename(
        /*
         * Fix up the block tail.
         */
-       be32_add(&btp->stale, 1);
+       be32_add_cpu(&btp->stale, 1);
        xfs_dir2_block_log_tail(tp, bp);
        /*
         * Remove the leaf entry by marking it stale.