[PATCH] USB: add ZyXEL vendor/product ID to rtl8150 driver
[pandora-kernel.git] / fs / xfs / xfs_log.c
index 3d9a36e..e730328 100644 (file)
@@ -24,7 +24,6 @@
 #include "xfs_trans.h"
 #include "xfs_sb.h"
 #include "xfs_ag.h"
-#include "xfs_dir.h"
 #include "xfs_dir2.h"
 #include "xfs_dmapi.h"
 #include "xfs_mount.h"
@@ -36,7 +35,6 @@
 #include "xfs_ialloc_btree.h"
 #include "xfs_log_recover.h"
 #include "xfs_trans_priv.h"
-#include "xfs_dir_sf.h"
 #include "xfs_dir2_sf.h"
 #include "xfs_attr_sf.h"
 #include "xfs_dinode.h"
@@ -59,7 +57,7 @@ STATIC xlog_t *  xlog_alloc_log(xfs_mount_t   *mp,
                                int             num_bblks);
 STATIC int      xlog_space_left(xlog_t *log, int cycle, int bytes);
 STATIC int      xlog_sync(xlog_t *log, xlog_in_core_t *iclog);
-STATIC void     xlog_unalloc_log(xlog_t *log);
+STATIC void     xlog_dealloc_log(xlog_t *log);
 STATIC int      xlog_write(xfs_mount_t *mp, xfs_log_iovec_t region[],
                            int nentries, xfs_log_ticket_t tic,
                            xfs_lsn_t *start_lsn,
@@ -304,7 +302,7 @@ xfs_log_done(xfs_mount_t    *mp,
        if ((ticket->t_flags & XLOG_TIC_PERM_RESERV) == 0 ||
            (flags & XFS_LOG_REL_PERM_RESERV)) {
                /*
-                * Release ticket if not permanent reservation or a specifc
+                * Release ticket if not permanent reservation or a specific
                 * request has been made to release a permanent reservation.
                 */
                xlog_trace_loggrant(log, ticket, "xfs_log_done: (non-permanent)");
@@ -402,8 +400,8 @@ xfs_log_release_iclog(xfs_mount_t *mp,
        xlog_in_core_t    *iclog = (xlog_in_core_t *)iclog_hndl;
 
        if (xlog_state_release_iclog(log, iclog)) {
-               xfs_force_shutdown(mp, XFS_LOG_IO_ERROR);
-               return(EIO);
+               xfs_force_shutdown(mp, SHUTDOWN_LOG_IO_ERROR);
+               return EIO;
        }
 
        return 0;
@@ -498,9 +496,8 @@ xfs_log_mount(xfs_mount_t   *mp,
         * just worked.
         */
        if (!(mp->m_flags & XFS_MOUNT_NORECOVERY)) {
-               int     error;
-               vfs_t   *vfsp = XFS_MTOVFS(mp);
-               int     readonly = (vfsp->vfs_flag & VFS_RDONLY);
+               bhv_vfs_t       *vfsp = XFS_MTOVFS(mp);
+               int             error, readonly = (vfsp->vfs_flag & VFS_RDONLY);
 
                if (readonly)
                        vfsp->vfs_flag &= ~VFS_RDONLY;
@@ -511,7 +508,7 @@ xfs_log_mount(xfs_mount_t   *mp,
                        vfsp->vfs_flag |= VFS_RDONLY;
                if (error) {
                        cmn_err(CE_WARN, "XFS: log mount/recovery failed: error %d", error);
-                       xlog_unalloc_log(mp->m_log);
+                       xlog_dealloc_log(mp->m_log);
                        return error;
                }
        }
@@ -556,7 +553,7 @@ xfs_log_unmount(xfs_mount_t *mp)
 
        error = xfs_log_unmount_write(mp);
        xfs_log_unmount_dealloc(mp);
-       return (error);
+       return error;
 }
 
 /*
@@ -667,7 +664,7 @@ xfs_log_unmount_write(xfs_mount_t *mp)
                 *
                 * Go through the motions of sync'ing and releasing
                 * the iclog, even though no I/O will actually happen,
-                * we need to wait for other log I/O's that may already
+                * we need to wait for other log I/Os that may already
                 * be in progress.  Do this as a separate section of
                 * code so we'll know if we ever get stuck here that
                 * we're in this odd situation of trying to unmount
@@ -704,7 +701,7 @@ xfs_log_unmount_write(xfs_mount_t *mp)
 void
 xfs_log_unmount_dealloc(xfs_mount_t *mp)
 {
-       xlog_unalloc_log(mp->m_log);
+       xlog_dealloc_log(mp->m_log);
 }
 
 /*
@@ -726,9 +723,9 @@ xfs_log_write(xfs_mount_t * mp,
                return XFS_ERROR(EIO);
 
        if ((error = xlog_write(mp, reg, nentries, tic, start_lsn, NULL, 0))) {
-               xfs_force_shutdown(mp, XFS_LOG_IO_ERROR);
+               xfs_force_shutdown(mp, SHUTDOWN_LOG_IO_ERROR);
        }
-       return (error);
+       return error;
 }      /* xfs_log_write */
 
 
@@ -816,9 +813,9 @@ xfs_log_need_covered(xfs_mount_t *mp)
        SPLDECL(s);
        int             needed = 0, gen;
        xlog_t          *log = mp->m_log;
-       vfs_t           *vfsp = XFS_MTOVFS(mp);
+       bhv_vfs_t       *vfsp = XFS_MTOVFS(mp);
 
-       if (fs_frozen(vfsp) || XFS_FORCED_SHUTDOWN(mp) ||
+       if (vfs_test_for_freeze(vfsp) || XFS_FORCED_SHUTDOWN(mp) ||
            (vfsp->vfs_flag & VFS_RDONLY))
                return 0;
 
@@ -836,7 +833,7 @@ xfs_log_need_covered(xfs_mount_t *mp)
                needed = 1;
        }
        LOG_UNLOCK(log, s);
-       return(needed);
+       return needed;
 }
 
 /******************************************************************************
@@ -956,7 +953,7 @@ xlog_iodone(xfs_buf_t *bp)
                        XFS_ERRTAG_IODONE_IOERR, XFS_RANDOM_IODONE_IOERR)) {
                xfs_ioerror_alert("xlog_iodone", l->l_mp, bp, XFS_BUF_ADDR(bp));
                XFS_BUF_STALE(bp);
-               xfs_force_shutdown(l->l_mp, XFS_LOG_IO_ERROR);
+               xfs_force_shutdown(l->l_mp, SHUTDOWN_LOG_IO_ERROR);
                /*
                 * This flag will be propagated to the trans-committed
                 * callback routines to let them know that the log-commit
@@ -1003,7 +1000,7 @@ xlog_bdstrat_cb(struct xfs_buf *bp)
        XFS_BUF_ERROR(bp, EIO);
        XFS_BUF_STALE(bp);
        xfs_biodone(bp);
-       return (XFS_ERROR(EIO));
+       return XFS_ERROR(EIO);
 
 
 }
@@ -1261,9 +1258,9 @@ xlog_commit_record(xfs_mount_t  *mp,
        ASSERT_ALWAYS(iclog);
        if ((error = xlog_write(mp, reg, 1, ticket, commitlsnp,
                               iclog, XLOG_COMMIT_TRANS))) {
-               xfs_force_shutdown(mp, XFS_LOG_IO_ERROR);
+               xfs_force_shutdown(mp, SHUTDOWN_LOG_IO_ERROR);
        }
-       return (error);
+       return error;
 }      /* xlog_commit_record */
 
 
@@ -1460,7 +1457,7 @@ xlog_sync(xlog_t          *log,
        if ((error = XFS_bwrite(bp))) {
                xfs_ioerror_alert("xlog_sync", log->l_mp, bp,
                                  XFS_BUF_ADDR(bp));
-               return (error);
+               return error;
        }
        if (split) {
                bp              = iclog->ic_log->l_xbuf;
@@ -1492,24 +1489,24 @@ xlog_sync(xlog_t                *log,
                ASSERT(XFS_BUF_ADDR(bp) <= log->l_logBBsize-1);
                ASSERT(XFS_BUF_ADDR(bp) + BTOBB(count) <= log->l_logBBsize);
 
-               /* account for internal log which does't start at block #0 */
+               /* account for internal log which doesn't start at block #0 */
                XFS_BUF_SET_ADDR(bp, XFS_BUF_ADDR(bp) + log->l_logBBstart);
                XFS_BUF_WRITE(bp);
                if ((error = XFS_bwrite(bp))) {
                        xfs_ioerror_alert("xlog_sync (split)", log->l_mp,
                                          bp, XFS_BUF_ADDR(bp));
-                       return (error);
+                       return error;
                }
        }
-       return (0);
+       return 0;
 }      /* xlog_sync */
 
 
 /*
- * Unallocate a log structure
+ * Deallocate a log structure
  */
 void
-xlog_unalloc_log(xlog_t *log)
+xlog_dealloc_log(xlog_t *log)
 {
        xlog_in_core_t  *iclog, *next_iclog;
        xlog_ticket_t   *tic, *next_tic;
@@ -1539,7 +1536,7 @@ xlog_unalloc_log(xlog_t *log)
        if ((log->l_ticket_cnt != log->l_ticket_tcnt)  &&
            !XLOG_FORCED_SHUTDOWN(log)) {
                xfs_fs_cmn_err(CE_WARN, log->l_mp,
-                       "xlog_unalloc_log: (cnt: %d, total: %d)",
+                       "xlog_dealloc_log: (cnt: %d, total: %d)",
                        log->l_ticket_cnt, log->l_ticket_tcnt);
                /* ASSERT(log->l_ticket_cnt == log->l_ticket_tcnt); */
 
@@ -1562,7 +1559,7 @@ xlog_unalloc_log(xlog_t *log)
 #endif
        log->l_mp->m_log = NULL;
        kmem_free(log, sizeof(xlog_t));
-}      /* xlog_unalloc_log */
+}      /* xlog_dealloc_log */
 
 /*
  * Update counters atomically now that memcpy is done.
@@ -1743,10 +1740,10 @@ xlog_write(xfs_mount_t *        mp,
           xlog_in_core_t       **commit_iclog,
           uint                 flags)
 {
-    xlog_t          *log    = mp->m_log;
+    xlog_t          *log = mp->m_log;
     xlog_ticket_t    *ticket = (xlog_ticket_t *)tic;
+    xlog_in_core_t   *iclog = NULL;  /* ptr to current in-core log */
     xlog_op_header_t *logop_head;    /* ptr to log operation header */
-    xlog_in_core_t   *iclog;        /* ptr to current in-core log */
     __psint_t       ptr;            /* copy address into data region */
     int                     len;            /* # xlog_write() bytes 2 still copy */
     int                     index;          /* region index currently copying */
@@ -1790,7 +1787,7 @@ xlog_write(xfs_mount_t *  mp,
        xfs_cmn_err(XFS_PTAG_LOGRES, CE_ALERT, mp,
                "xfs_log_write: reservation ran out. Need to up reservation");
        /* If we did not panic, shutdown the filesystem */
-       xfs_force_shutdown(mp, XFS_CORRUPT_INCORE);
+       xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE);
 #endif
     } else
        ticket->t_curr_res -= len;
@@ -1798,7 +1795,7 @@ xlog_write(xfs_mount_t *  mp,
     for (index = 0; index < nentries; ) {
        if ((error = xlog_state_get_iclog_space(log, len, &iclog, ticket,
                                               &contwr, &log_offset)))
-               return (error);
+               return error;
 
        ASSERT(log_offset <= iclog->ic_size - 1);
        ptr = (__psint_t) ((char *)iclog->ic_datap+log_offset);
@@ -1903,7 +1900,7 @@ xlog_write(xfs_mount_t *  mp,
                    xlog_state_finish_copy(log, iclog, record_cnt, data_cnt);
                    record_cnt = data_cnt = 0;
                    if ((error = xlog_state_release_iclog(log, iclog)))
-                           return (error);
+                           return error;
                    break;                      /* don't increment index */
            } else {                            /* copied entire region */
                index++;
@@ -1917,7 +1914,7 @@ xlog_write(xfs_mount_t *  mp,
                        ASSERT(flags & XLOG_COMMIT_TRANS);
                        *commit_iclog = iclog;
                    } else if ((error = xlog_state_release_iclog(log, iclog)))
-                          return (error);
+                          return error;
                    if (index == nentries)
                            return 0;           /* we are done */
                    else
@@ -1934,7 +1931,7 @@ xlog_write(xfs_mount_t *  mp,
        *commit_iclog = iclog;
        return 0;
     }
-    return (xlog_state_release_iclog(log, iclog));
+    return xlog_state_release_iclog(log, iclog);
 }      /* xlog_write */
 
 
@@ -2050,7 +2047,7 @@ xlog_get_lowest_lsn(
            }
            lsn_log = lsn_log->ic_next;
        } while (lsn_log != log->l_iclog);
-       return(lowest_lsn);
+       return lowest_lsn;
 }
 
 
@@ -2402,7 +2399,7 @@ restart:
                if (iclog->ic_refcnt == 1) {
                        LOG_UNLOCK(log, s);
                        if ((error = xlog_state_release_iclog(log, iclog)))
-                               return (error);
+                               return error;
                } else {
                        iclog->ic_refcnt--;
                        LOG_UNLOCK(log, s);
@@ -2569,7 +2566,7 @@ xlog_regrant_write_log_space(xlog_t          *log,
        XLOG_TIC_RESET_RES(tic);
 
        if (tic->t_cnt > 0)
-               return (0);
+               return 0;
 
 #ifdef DEBUG
        if (log->l_flags & XLOG_ACTIVE_RECOVERY)
@@ -2667,7 +2664,7 @@ redo:
        xlog_trace_loggrant(log, tic, "xlog_regrant_write_log_space: exit");
        xlog_verify_grant_head(log, 1);
        GRANT_UNLOCK(log, s);
-       return (0);
+       return 0;
 
 
  error_return:
@@ -2829,7 +2826,7 @@ xlog_state_release_iclog(xlog_t           *log,
 
        /*
         * We let the log lock go, so it's possible that we hit a log I/O
-        * error or someother SHUTDOWN condition that marks the iclog
+        * error or some other SHUTDOWN condition that marks the iclog
         * as XLOG_STATE_IOERROR before the bwrite. However, we know that
         * this iclog has consistent data, so we ignore IOERROR
         * flags after this point.
@@ -2837,7 +2834,7 @@ xlog_state_release_iclog(xlog_t           *log,
        if (sync) {
                return xlog_sync(log, iclog);
        }
-       return (0);
+       return 0;
 
 }      /* xlog_state_release_iclog */
 
@@ -3127,7 +3124,7 @@ try_again:
     } while (iclog != log->l_iclog);
 
     LOG_UNLOCK(log, s);
-    return (0);
+    return 0;
 }      /* xlog_state_sync */
 
 
@@ -3545,12 +3542,12 @@ xlog_state_ioerror(
                        ic->ic_state = XLOG_STATE_IOERROR;
                        ic = ic->ic_next;
                } while (ic != iclog);
-               return (0);
+               return 0;
        }
        /*
         * Return non-zero, if state transition has already happened.
         */
-       return (1);
+       return 1;
 }
 
 /*
@@ -3587,7 +3584,7 @@ xfs_log_force_umount(
            log->l_flags & XLOG_ACTIVE_RECOVERY) {
                mp->m_flags |= XFS_MOUNT_FS_SHUTDOWN;
                XFS_BUF_DONE(mp->m_sb_bp);
-               return (0);
+               return 0;
        }
 
        /*
@@ -3596,7 +3593,7 @@ xfs_log_force_umount(
         */
        if (logerror && log->l_iclog->ic_state & XLOG_STATE_IOERROR) {
                ASSERT(XLOG_FORCED_SHUTDOWN(log));
-               return (1);
+               return 1;
        }
        retval = 0;
        /*
@@ -3678,7 +3675,7 @@ xfs_log_force_umount(
        }
 #endif
        /* return non-zero if log IOERROR transition had already happened */
-       return (retval);
+       return retval;
 }
 
 STATIC int
@@ -3692,8 +3689,8 @@ xlog_iclogs_empty(xlog_t *log)
                 * any language.
                 */
                if (iclog->ic_header.h_num_logops)
-                       return(0);
+                       return 0;
                iclog = iclog->ic_next;
        } while (iclog != log->l_iclog);
-       return(1);
+       return 1;
 }