Commit 3155fe6d authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://oss.sgi.com/xfs/xfs

* 'for-linus' of git://oss.sgi.com/xfs/xfs: (23 commits)
  xfs: don't name variables "panic"
  xfs: factor agf counter updates into a helper
  xfs: clean up the xfs_alloc_compute_aligned calling convention
  xfs: kill support/debug.[ch]
  xfs: Convert remaining cmn_err() callers to new API
  xfs: convert the quota debug prints to new API
  xfs: rename xfs_cmn_err_fsblock_zero()
  xfs: convert xfs_fs_cmn_err to new error logging API
  xfs: kill xfs_fs_mount_cmn_err() macro
  xfs: kill xfs_fs_repair_cmn_err() macro
  xfs: convert xfs_cmn_err to xfs_alert_tag
  xfs: Convert xlog_warn to new logging interface
  xfs: Convert linux-2.6/ files to new logging interface
  xfs: introduce new logging API.
  xfs: zero proper structure size for geometry calls
  xfs: enable delaylog by default
  xfs: more sensible inode refcounting for ialloc
  xfs: stop using xfs_trans_iget in the RT allocator
  xfs: check if device support discard in xfs_ioc_trim()
  xfs: prevent leaking uninitialized stack memory in FSGEOMETRY_V1
  ...
parents da48524e 0c9ba973
...@@ -791,10 +791,3 @@ mount option. Fundamentally, there is no reason why the log manager would not ...@@ -791,10 +791,3 @@ mount option. Fundamentally, there is no reason why the log manager would not
be able to swap methods automatically and transparently depending on load be able to swap methods automatically and transparently depending on load
characteristics, but this should not be necessary if delayed logging works as characteristics, but this should not be necessary if delayed logging works as
designed. designed.
Roadmap:
2.6.39 Switch default mount option to use delayed logging
=> should be roughly 12 months after initial merge
=> enough time to shake out remaining problems before next round of
enterprise distro kernel rebases
...@@ -102,11 +102,10 @@ xfs-y += $(addprefix $(XFS_LINUX)/, \ ...@@ -102,11 +102,10 @@ xfs-y += $(addprefix $(XFS_LINUX)/, \
xfs_globals.o \ xfs_globals.o \
xfs_ioctl.o \ xfs_ioctl.o \
xfs_iops.o \ xfs_iops.o \
xfs_message.o \
xfs_super.o \ xfs_super.o \
xfs_sync.o \ xfs_sync.o \
xfs_xattr.o) xfs_xattr.o)
# Objects in support/ # Objects in support/
xfs-y += $(addprefix support/, \ xfs-y += support/uuid.o
debug.o \
uuid.o)
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <linux/backing-dev.h> #include <linux/backing-dev.h>
#include "time.h" #include "time.h"
#include "kmem.h" #include "kmem.h"
#include "xfs_message.h"
/* /*
* Greedy allocation. May fail and may return vmalloced memory. * Greedy allocation. May fail and may return vmalloced memory.
...@@ -56,8 +57,8 @@ kmem_alloc(size_t size, unsigned int __nocast flags) ...@@ -56,8 +57,8 @@ kmem_alloc(size_t size, unsigned int __nocast flags)
if (ptr || (flags & (KM_MAYFAIL|KM_NOSLEEP))) if (ptr || (flags & (KM_MAYFAIL|KM_NOSLEEP)))
return ptr; return ptr;
if (!(++retries % 100)) if (!(++retries % 100))
printk(KERN_ERR "XFS: possible memory allocation " xfs_err(NULL,
"deadlock in %s (mode:0x%x)\n", "possible memory allocation deadlock in %s (mode:0x%x)",
__func__, lflags); __func__, lflags);
congestion_wait(BLK_RW_ASYNC, HZ/50); congestion_wait(BLK_RW_ASYNC, HZ/50);
} while (1); } while (1);
...@@ -112,8 +113,8 @@ kmem_zone_alloc(kmem_zone_t *zone, unsigned int __nocast flags) ...@@ -112,8 +113,8 @@ kmem_zone_alloc(kmem_zone_t *zone, unsigned int __nocast flags)
if (ptr || (flags & (KM_MAYFAIL|KM_NOSLEEP))) if (ptr || (flags & (KM_MAYFAIL|KM_NOSLEEP)))
return ptr; return ptr;
if (!(++retries % 100)) if (!(++retries % 100))
printk(KERN_ERR "XFS: possible memory allocation " xfs_err(NULL,
"deadlock in %s (mode:0x%x)\n", "possible memory allocation deadlock in %s (mode:0x%x)",
__func__, lflags); __func__, lflags);
congestion_wait(BLK_RW_ASYNC, HZ/50); congestion_wait(BLK_RW_ASYNC, HZ/50);
} while (1); } while (1);
......
...@@ -854,7 +854,7 @@ xfs_aops_discard_page( ...@@ -854,7 +854,7 @@ xfs_aops_discard_page(
if (XFS_FORCED_SHUTDOWN(ip->i_mount)) if (XFS_FORCED_SHUTDOWN(ip->i_mount))
goto out_invalidate; goto out_invalidate;
xfs_fs_cmn_err(CE_ALERT, ip->i_mount, xfs_alert(ip->i_mount,
"page discard on page %p, inode 0x%llx, offset %llu.", "page discard on page %p, inode 0x%llx, offset %llu.",
page, ip->i_ino, offset); page, ip->i_ino, offset);
...@@ -872,7 +872,7 @@ xfs_aops_discard_page( ...@@ -872,7 +872,7 @@ xfs_aops_discard_page(
if (error) { if (error) {
/* something screwed, just bail */ /* something screwed, just bail */
if (!XFS_FORCED_SHUTDOWN(ip->i_mount)) { if (!XFS_FORCED_SHUTDOWN(ip->i_mount)) {
xfs_fs_cmn_err(CE_ALERT, ip->i_mount, xfs_alert(ip->i_mount,
"page discard unable to remove delalloc mapping."); "page discard unable to remove delalloc mapping.");
} }
break; break;
...@@ -1411,7 +1411,7 @@ xfs_vm_write_failed( ...@@ -1411,7 +1411,7 @@ xfs_vm_write_failed(
if (error) { if (error) {
/* something screwed, just bail */ /* something screwed, just bail */
if (!XFS_FORCED_SHUTDOWN(ip->i_mount)) { if (!XFS_FORCED_SHUTDOWN(ip->i_mount)) {
xfs_fs_cmn_err(CE_ALERT, ip->i_mount, xfs_alert(ip->i_mount,
"xfs_vm_write_failed: unable to clean up ino %lld", "xfs_vm_write_failed: unable to clean up ino %lld",
ip->i_ino); ip->i_ino);
} }
......
...@@ -401,9 +401,8 @@ _xfs_buf_lookup_pages( ...@@ -401,9 +401,8 @@ _xfs_buf_lookup_pages(
* handle buffer allocation failures we can't do much. * handle buffer allocation failures we can't do much.
*/ */
if (!(++retries % 100)) if (!(++retries % 100))
printk(KERN_ERR xfs_err(NULL,
"XFS: possible memory allocation " "possible memory allocation deadlock in %s (mode:0x%x)",
"deadlock in %s (mode:0x%x)\n",
__func__, gfp_mask); __func__, gfp_mask);
XFS_STATS_INC(xb_page_retries); XFS_STATS_INC(xb_page_retries);
...@@ -615,8 +614,8 @@ xfs_buf_get( ...@@ -615,8 +614,8 @@ xfs_buf_get(
if (!(bp->b_flags & XBF_MAPPED)) { if (!(bp->b_flags & XBF_MAPPED)) {
error = _xfs_buf_map_pages(bp, flags); error = _xfs_buf_map_pages(bp, flags);
if (unlikely(error)) { if (unlikely(error)) {
printk(KERN_WARNING "%s: failed to map pages\n", xfs_warn(target->bt_mount,
__func__); "%s: failed to map pages\n", __func__);
goto no_buffer; goto no_buffer;
} }
} }
...@@ -850,8 +849,8 @@ xfs_buf_get_uncached( ...@@ -850,8 +849,8 @@ xfs_buf_get_uncached(
error = _xfs_buf_map_pages(bp, XBF_MAPPED); error = _xfs_buf_map_pages(bp, XBF_MAPPED);
if (unlikely(error)) { if (unlikely(error)) {
printk(KERN_WARNING "%s: failed to map pages\n", xfs_warn(target->bt_mount,
__func__); "%s: failed to map pages\n", __func__);
goto fail_free_mem; goto fail_free_mem;
} }
...@@ -1617,8 +1616,8 @@ xfs_setsize_buftarg_flags( ...@@ -1617,8 +1616,8 @@ xfs_setsize_buftarg_flags(
btp->bt_smask = sectorsize - 1; btp->bt_smask = sectorsize - 1;
if (set_blocksize(btp->bt_bdev, sectorsize)) { if (set_blocksize(btp->bt_bdev, sectorsize)) {
printk(KERN_WARNING xfs_warn(btp->bt_mount,
"XFS: Cannot set_blocksize to %u on device %s\n", "Cannot set_blocksize to %u on device %s\n",
sectorsize, XFS_BUFTARG_NAME(btp)); sectorsize, XFS_BUFTARG_NAME(btp));
return EINVAL; return EINVAL;
} }
......
...@@ -39,7 +39,6 @@ ...@@ -39,7 +39,6 @@
#include <mrlock.h> #include <mrlock.h>
#include <time.h> #include <time.h>
#include <support/debug.h>
#include <support/uuid.h> #include <support/uuid.h>
#include <linux/semaphore.h> #include <linux/semaphore.h>
...@@ -86,6 +85,7 @@ ...@@ -86,6 +85,7 @@
#include <xfs_aops.h> #include <xfs_aops.h>
#include <xfs_super.h> #include <xfs_super.h>
#include <xfs_buf.h> #include <xfs_buf.h>
#include <xfs_message.h>
/* /*
* Feature macros (disable/enable) * Feature macros (disable/enable)
...@@ -280,4 +280,25 @@ static inline __uint64_t howmany_64(__uint64_t x, __uint32_t y) ...@@ -280,4 +280,25 @@ static inline __uint64_t howmany_64(__uint64_t x, __uint32_t y)
#define __arch_pack #define __arch_pack
#endif #endif
#define ASSERT_ALWAYS(expr) \
(unlikely(expr) ? (void)0 : assfail(#expr, __FILE__, __LINE__))
#ifndef DEBUG
#define ASSERT(expr) ((void)0)
#ifndef STATIC
# define STATIC static noinline
#endif
#else /* DEBUG */
#define ASSERT(expr) \
(unlikely(expr) ? (void)0 : assfail(#expr, __FILE__, __LINE__))
#ifndef STATIC
# define STATIC noinline
#endif
#endif /* DEBUG */
#endif /* __XFS_LINUX__ */ #endif /* __XFS_LINUX__ */
/* /*
* Copyright (c) 2000-2003,2005 Silicon Graphics, Inc. * Copyright (c) 2011 Red Hat, Inc. All Rights Reserved.
* All Rights Reserved.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as * modify it under the terms of the GNU General Public License as
...@@ -15,88 +14,115 @@ ...@@ -15,88 +14,115 @@
* along with this program; if not, write the Free Software Foundation, * along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include <xfs.h>
#include "debug.h"
/* xfs_mount.h drags a lot of crap in, sorry.. */ #include "xfs.h"
#include "xfs_sb.h" #include "xfs_fs.h"
#include "xfs_types.h"
#include "xfs_log.h"
#include "xfs_inum.h" #include "xfs_inum.h"
#include "xfs_trans.h"
#include "xfs_sb.h"
#include "xfs_ag.h" #include "xfs_ag.h"
#include "xfs_mount.h" #include "xfs_mount.h"
#include "xfs_error.h"
void /*
cmn_err( * XFS logging functions
const char *lvl, */
const char *fmt, static int
...) __xfs_printk(
const char *level,
const struct xfs_mount *mp,
struct va_format *vaf)
{ {
struct va_format vaf; if (mp && mp->m_fsname)
va_list args; return printk("%sXFS (%s): %pV\n", level, mp->m_fsname, vaf);
return printk("%sXFS: %pV\n", level, vaf);
va_start(args, fmt);
vaf.fmt = fmt;
vaf.va = &args;
printk("%s%pV", lvl, &vaf);
va_end(args);
BUG_ON(strncmp(lvl, KERN_EMERG, strlen(KERN_EMERG)) == 0);
} }
void int xfs_printk(
xfs_fs_cmn_err( const char *level,
const char *lvl, const struct xfs_mount *mp,
struct xfs_mount *mp, const char *fmt, ...)
const char *fmt,
...)
{ {
struct va_format vaf; struct va_format vaf;
va_list args; va_list args;
int r;
va_start(args, fmt); va_start(args, fmt);
vaf.fmt = fmt; vaf.fmt = fmt;
vaf.va = &args; vaf.va = &args;
printk("%sFilesystem %s: %pV", lvl, mp->m_fsname, &vaf); r = __xfs_printk(level, mp, &vaf);
va_end(args); va_end(args);
BUG_ON(strncmp(lvl, KERN_EMERG, strlen(KERN_EMERG)) == 0); return r;
} }
/* All callers to xfs_cmn_err use CE_ALERT, so don't bother testing lvl */ #define define_xfs_printk_level(func, kern_level) \
void int func(const struct xfs_mount *mp, const char *fmt, ...) \
xfs_cmn_err( { \
struct va_format vaf; \
va_list args; \
int r; \
\
va_start(args, fmt); \
\
vaf.fmt = fmt; \
vaf.va = &args; \
\
r = __xfs_printk(kern_level, mp, &vaf); \
va_end(args); \
\
return r; \
} \
define_xfs_printk_level(xfs_emerg, KERN_EMERG);
define_xfs_printk_level(xfs_alert, KERN_ALERT);
define_xfs_printk_level(xfs_crit, KERN_CRIT);
define_xfs_printk_level(xfs_err, KERN_ERR);
define_xfs_printk_level(xfs_warn, KERN_WARNING);
define_xfs_printk_level(xfs_notice, KERN_NOTICE);
define_xfs_printk_level(xfs_info, KERN_INFO);
#ifdef DEBUG
define_xfs_printk_level(xfs_debug, KERN_DEBUG);
#endif
int
xfs_alert_tag(
const struct xfs_mount *mp,
int panic_tag, int panic_tag,
const char *lvl, const char *fmt, ...)
struct xfs_mount *mp,
const char *fmt,
...)
{ {
struct va_format vaf; struct va_format vaf;
va_list args; va_list args;
int do_panic = 0; int do_panic = 0;
int r;
if (xfs_panic_mask && (xfs_panic_mask & panic_tag)) { if (xfs_panic_mask && (xfs_panic_mask & panic_tag)) {
printk(KERN_ALERT "XFS: Transforming an alert into a BUG."); xfs_printk(KERN_ALERT, mp,
"XFS: Transforming an alert into a BUG.");
do_panic = 1; do_panic = 1;
} }
va_start(args, fmt); va_start(args, fmt);
vaf.fmt = fmt; vaf.fmt = fmt;
vaf.va = &args; vaf.va = &args;
printk(KERN_ALERT "Filesystem %s: %pV", mp->m_fsname, &vaf); r = __xfs_printk(KERN_ALERT, mp, &vaf);
va_end(args); va_end(args);
BUG_ON(do_panic); BUG_ON(do_panic);
return r;
} }
void void
assfail(char *expr, char *file, int line) assfail(char *expr, char *file, int line)
{ {
printk(KERN_CRIT "Assertion failed: %s, file: %s, line: %d\n", expr, xfs_emerg(NULL, "Assertion failed: %s, file: %s, line: %d",
file, line); expr, file, line);
BUG(); BUG();
} }
......
#ifndef __XFS_MESSAGE_H
#define __XFS_MESSAGE_H 1
struct xfs_mount;
extern int xfs_printk(const char *level, const struct xfs_mount *mp,
const char *fmt, ...)
__attribute__ ((format (printf, 3, 4)));
extern int xfs_emerg(const struct xfs_mount *mp, const char *fmt, ...)
__attribute__ ((format (printf, 2, 3)));
extern int xfs_alert(const struct xfs_mount *mp, const char *fmt, ...)
__attribute__ ((format (printf, 2, 3)));
extern int xfs_alert_tag(const struct xfs_mount *mp, int tag,
const char *fmt, ...)
__attribute__ ((format (printf, 3, 4)));
extern int xfs_crit(const struct xfs_mount *mp, const char *fmt, ...)
__attribute__ ((format (printf, 2, 3)));
extern int xfs_err(const struct xfs_mount *mp, const char *fmt, ...)
__attribute__ ((format (printf, 2, 3)));
extern int xfs_warn(const struct xfs_mount *mp, const char *fmt, ...)
__attribute__ ((format (printf, 2, 3)));
extern int xfs_notice(const struct xfs_mount *mp, const char *fmt, ...)
__attribute__ ((format (printf, 2, 3)));
extern int xfs_info(const struct xfs_mount *mp, const char *fmt, ...)
__attribute__ ((format (printf, 2, 3)));
#ifdef DEBUG
extern int xfs_debug(const struct xfs_mount *mp, const char *fmt, ...)
__attribute__ ((format (printf, 2, 3)));
#else
#define xfs_debug(mp, fmt, ...) (0)
#endif
extern void assfail(char *expr, char *f, int l);
extern void xfs_hex_dump(void *p, int length);
#endif /* __XFS_MESSAGE_H */
This diff is collapsed.
...@@ -425,8 +425,7 @@ xfs_quiesce_attr( ...@@ -425,8 +425,7 @@ xfs_quiesce_attr(
/* Push the superblock and write an unmount record */ /* Push the superblock and write an unmount record */
error = xfs_log_sbcount(mp, 1); error = xfs_log_sbcount(mp, 1);
if (error) if (error)
xfs_fs_cmn_err(CE_WARN, mp, xfs_warn(mp, "xfs_attr_quiesce: failed to log sb changes. "
"xfs_attr_quiesce: failed to log sb changes. "
"Frozen image may not be consistent."); "Frozen image may not be consistent.");
xfs_log_unmount_write(mp); xfs_log_unmount_write(mp);
xfs_unmountfs_writesb(mp); xfs_unmountfs_writesb(mp);
...@@ -806,7 +805,7 @@ xfs_reclaim_inode( ...@@ -806,7 +805,7 @@ xfs_reclaim_inode(
* pass on the error. * pass on the error.
*/ */
if (error && error != EAGAIN && !XFS_FORCED_SHUTDOWN(ip->i_mount)) { if (error && error != EAGAIN && !XFS_FORCED_SHUTDOWN(ip->i_mount)) {
xfs_fs_cmn_err(CE_WARN, ip->i_mount, xfs_warn(ip->i_mount,
"inode 0x%llx background reclaim flush failed with %d", "inode 0x%llx background reclaim flush failed with %d",
(long long)ip->i_ino, error); (long long)ip->i_ino, error);
} }
......
...@@ -37,7 +37,7 @@ xfs_stats_clear_proc_handler( ...@@ -37,7 +37,7 @@ xfs_stats_clear_proc_handler(
ret = proc_dointvec_minmax(ctl, write, buffer, lenp, ppos); ret = proc_dointvec_minmax(ctl, write, buffer, lenp, ppos);
if (!ret && write && *valp) { if (!ret && write && *valp) {
printk("XFS Clearing xfsstats\n"); xfs_notice(NULL, "Clearing xfsstats");
for_each_possible_cpu(c) { for_each_possible_cpu(c) {
preempt_disable(); preempt_disable();
/* save vn_active, it's a universal truth! */ /* save vn_active, it's a universal truth! */
......
...@@ -544,9 +544,10 @@ xfs_qm_dqtobp( ...@@ -544,9 +544,10 @@ xfs_qm_dqtobp(
/* /*
* A simple sanity check in case we got a corrupted dquot... * A simple sanity check in case we got a corrupted dquot...
*/ */
if (xfs_qm_dqcheck(ddq, id, dqp->dq_flags & XFS_DQ_ALLTYPES, error = xfs_qm_dqcheck(mp, ddq, id, dqp->dq_flags & XFS_DQ_ALLTYPES,
flags & (XFS_QMOPT_DQREPAIR|XFS_QMOPT_DOWARN), flags & (XFS_QMOPT_DQREPAIR|XFS_QMOPT_DOWARN),
"dqtobp")) { "dqtobp");
if (error) {
if (!(flags & XFS_QMOPT_DQREPAIR)) { if (!(flags & XFS_QMOPT_DQREPAIR)) {
xfs_trans_brelse(tp, bp); xfs_trans_brelse(tp, bp);
return XFS_ERROR(EIO); return XFS_ERROR(EIO);
...@@ -827,7 +828,7 @@ xfs_qm_dqget( ...@@ -827,7 +828,7 @@ xfs_qm_dqget(
if (xfs_do_dqerror) { if (xfs_do_dqerror) {
if ((xfs_dqerror_target == mp->m_ddev_targp) && if ((xfs_dqerror_target == mp->m_ddev_targp) &&
(xfs_dqreq_num++ % xfs_dqerror_mod) == 0) { (xfs_dqreq_num++ % xfs_dqerror_mod) == 0) {
cmn_err(CE_DEBUG, "Returning error in dqget"); xfs_debug(mp, "Returning error in dqget");
return (EIO); return (EIO);
} }
} }
...@@ -1207,8 +1208,9 @@ xfs_qm_dqflush( ...@@ -1207,8 +1208,9 @@ xfs_qm_dqflush(
/* /*
* A simple sanity check in case we got a corrupted dquot.. * A simple sanity check in case we got a corrupted dquot..
*/ */
if (xfs_qm_dqcheck(&dqp->q_core, be32_to_cpu(ddqp->d_id), 0, error = xfs_qm_dqcheck(mp, &dqp->q_core, be32_to_cpu(ddqp->d_id), 0,
XFS_QMOPT_DOWARN, "dqflush (incore copy)")) { XFS_QMOPT_DOWARN, "dqflush (incore copy)");
if (error) {
xfs_buf_relse(bp); xfs_buf_relse(bp);
xfs_dqfunlock(dqp); xfs_dqfunlock(dqp);
xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE); xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE);
...@@ -1391,8 +1393,8 @@ xfs_qm_dqpurge( ...@@ -1391,8 +1393,8 @@ xfs_qm_dqpurge(
*/ */
error = xfs_qm_dqflush(dqp, SYNC_WAIT); error = xfs_qm_dqflush(dqp, SYNC_WAIT);
if (error) if (error)
xfs_fs_cmn_err(CE_WARN, mp, xfs_warn(mp, "%s: dquot %p flush failed",
"xfs_qm_dqpurge: dquot %p flush failed", dqp); __func__, dqp);
xfs_dqflock(dqp); xfs_dqflock(dqp);
} }
ASSERT(atomic_read(&dqp->q_pincount) == 0); ASSERT(atomic_read(&dqp->q_pincount) == 0);
...@@ -1425,36 +1427,38 @@ xfs_qm_dqpurge( ...@@ -1425,36 +1427,38 @@ xfs_qm_dqpurge(
void void
xfs_qm_dqprint(xfs_dquot_t *dqp) xfs_qm_dqprint(xfs_dquot_t *dqp)
{ {
cmn_err(CE_DEBUG, "-----------KERNEL DQUOT----------------"); struct xfs_mount *mp = dqp->q_mount;
cmn_err(CE_DEBUG, "---- dquotID = %d",
xfs_debug(mp, "-----------KERNEL DQUOT----------------");
xfs_debug(mp, "---- dquotID = %d",
(int)be32_to_cpu(dqp->q_core.d_id)); (int)be32_to_cpu(dqp->q_core.d_id));
cmn_err(CE_DEBUG, "---- type = %s", DQFLAGTO_TYPESTR(dqp)); xfs_debug(mp, "---- type = %s", DQFLAGTO_TYPESTR(dqp));
cmn_err(CE_DEBUG, "---- fs = 0x%p", dqp->q_mount); xfs_debug(mp, "---- fs = 0x%p", dqp->q_mount);
cmn_err(CE_DEBUG, "---- blkno = 0x%x", (int) dqp->q_blkno); xfs_debug(mp, "---- blkno = 0x%x", (int) dqp->q_blkno);
cmn_err(CE_DEBUG, "---- boffset = 0x%x", (int) dqp->q_bufoffset); xfs_debug(mp, "---- boffset = 0x%x", (int) dqp->q_bufoffset);
cmn_err(CE_DEBUG, "---- blkhlimit = %Lu (0x%x)", xfs_debug(mp, "---- blkhlimit = %Lu (0x%x)",
be64_to_cpu(dqp->q_core.d_blk_hardlimit), be64_to_cpu(dqp->q_core.d_blk_hardlimit),
(int)be64_to_cpu(dqp->q_core.d_blk_hardlimit)); (int)be64_to_cpu(dqp->q_core.d_blk_hardlimit));
cmn_err(CE_DEBUG, "---- blkslimit = %Lu (0x%x)", xfs_debug(mp, "---- blkslimit = %Lu (0x%x)",
be64_to_cpu(dqp->q_core.d_blk_softlimit), be64_to_cpu(dqp->q_core.d_blk_softlimit),
(int)be64_to_cpu(dqp->q_core.d_blk_softlimit)); (int)be64_to_cpu(dqp->q_core.d_blk_softlimit));
cmn_err(CE_DEBUG, "---- inohlimit = %Lu (0x%x)", xfs_debug(mp, "---- inohlimit = %Lu (0x%x)",
be64_to_cpu(dqp->q_core.d_ino_hardlimit), be64_to_cpu(dqp->q_core.d_ino_hardlimit),
(int)be64_to_cpu(dqp->q_core.d_ino_hardlimit)); (int)be64_to_cpu(dqp->q_core.d_ino_hardlimit));
cmn_err(CE_DEBUG, "---- inoslimit = %Lu (0x%x)", xfs_debug(mp, "---- inoslimit = %Lu (0x%x)",
be64_to_cpu(dqp->q_core.d_ino_softlimit), be64_to_cpu(dqp->q_core.d_ino_softlimit),
(int)be64_to_cpu(dqp->q_core.d_ino_softlimit)); (int)be64_to_cpu(dqp->q_core.d_ino_softlimit));
cmn_err(CE_DEBUG, "---- bcount = %Lu (0x%x)", xfs_debug(mp, "---- bcount = %Lu (0x%x)",
be64_to_cpu(dqp->q_core.d_bcount), be64_to_cpu(dqp->q_core.d_bcount),
(int)be64_to_cpu(dqp->q_core.d_bcount)); (int)be64_to_cpu(dqp->q_core.d_bcount));
cmn_err(CE_DEBUG, "---- icount = %Lu (0x%x)", xfs_debug(mp, "---- icount = %Lu (0x%x)",
be64_to_cpu(dqp->q_core.d_icount), be64_to_cpu(dqp->q_core.d_icount),
(int)be64_to_cpu(dqp->q_core.d_icount)); (int)be64_to_cpu(dqp->q_core.d_icount));
cmn_err(CE_DEBUG, "---- btimer = %d", xfs_debug(mp, "---- btimer = %d",
(int)be32_to_cpu(dqp->q_core.d_btimer)); (int)be32_to_cpu(dqp->q_core.d_btimer));
cmn_err(CE_DEBUG, "---- itimer = %d", xfs_debug(mp, "---- itimer = %d",
(int)be32_to_cpu(dqp->q_core.d_itimer)); (int)be32_to_cpu(dqp->q_core.d_itimer));
cmn_err(CE_DEBUG, "---------------------------"); xfs_debug(mp, "---------------------------");
} }
#endif #endif
......
...@@ -136,9 +136,8 @@ xfs_qm_dquot_logitem_push( ...@@ -136,9 +136,8 @@ xfs_qm_dquot_logitem_push(
*/ */
error = xfs_qm_dqflush(dqp, 0); error = xfs_qm_dqflush(dqp, 0);
if (error) if (error)
xfs_fs_cmn_err(CE_WARN, dqp->q_mount, xfs_warn(dqp->q_mount, "%s: push error %d on dqp %p",
"xfs_qm_dquot_logitem_push: push error %d on dqp %p", __func__, error, dqp);
error, dqp);
xfs_dqunlock(dqp); xfs_dqunlock(dqp);
} }
......
...@@ -80,7 +80,7 @@ xfs_qm_dquot_list_print( ...@@ -80,7 +80,7 @@ xfs_qm_dquot_list_print(
int i = 0; int i = 0;
list_for_each_entry(dqp, &mp->m_quotainfo->qi_dqlist_lock, qi_mplist) { list_for_each_entry(dqp, &mp->m_quotainfo->qi_dqlist_lock, qi_mplist) {
cmn_err(CE_DEBUG, " %d. \"%d (%s)\" " xfs_debug(mp, " %d. \"%d (%s)\" "
"bcnt = %lld, icnt = %lld, refs = %d", "bcnt = %lld, icnt = %lld, refs = %d",
i++, be32_to_cpu(dqp->q_core.d_id), i++, be32_to_cpu(dqp->q_core.d_id),
DQFLAGTO_TYPESTR(dqp), DQFLAGTO_TYPESTR(dqp),
...@@ -205,7 +205,7 @@ xfs_qm_destroy( ...@@ -205,7 +205,7 @@ xfs_qm_destroy(
list_for_each_entry_safe(dqp, n, &xqm->qm_dqfrlist, q_freelist) { list_for_each_entry_safe(dqp, n, &xqm->qm_dqfrlist, q_freelist) {
xfs_dqlock(dqp); xfs_dqlock(dqp);
#ifdef QUOTADEBUG #ifdef QUOTADEBUG
cmn_err(CE_DEBUG, "FREELIST destroy 0x%p", dqp); xfs_debug(dqp->q_mount, "FREELIST destroy 0x%p", dqp);
#endif #endif
list_del_init(&dqp->q_freelist); list_del_init(&dqp->q_freelist);
xfs_Gqm->qm_dqfrlist_cnt--; xfs_Gqm->qm_dqfrlist_cnt--;
...@@ -341,9 +341,7 @@ xfs_qm_mount_quotas( ...@@ -341,9 +341,7 @@ xfs_qm_mount_quotas(
* quotas immediately. * quotas immediately.
*/ */
if (mp->m_sb.sb_rextents) { if (mp->m_sb.sb_rextents) {
cmn_err(CE_NOTE, xfs_notice(mp, "Cannot turn on quotas for realtime filesystem");
"Cannot turn on quotas for realtime filesystem %s",
mp->m_fsname);
mp->m_qflags = 0; mp->m_qflags = 0;
goto write_changes; goto write_changes;
} }
...@@ -402,14 +400,13 @@ xfs_qm_mount_quotas( ...@@ -402,14 +400,13 @@ xfs_qm_mount_quotas(
* off, but the on disk superblock doesn't know that ! * off, but the on disk superblock doesn't know that !
*/ */
ASSERT(!(XFS_IS_QUOTA_RUNNING(mp))); ASSERT(!(XFS_IS_QUOTA_RUNNING(mp)));
xfs_fs_cmn_err(CE_ALERT, mp, xfs_alert(mp, "%s: Superblock update failed!",
"XFS mount_quotas: Superblock update failed!"); __func__);
} }
} }
if (error) { if (error) {
xfs_fs_cmn_err(CE_WARN, mp, xfs_warn(mp, "Failed to initialize disk quotas.");
"Failed to initialize disk quotas.");
return; return;
} }
...@@ -1229,13 +1226,6 @@ xfs_qm_qino_alloc( ...@@ -1229,13 +1226,6 @@ xfs_qm_qino_alloc(
return error; return error;
} }
/*
* Keep an extra reference to this quota inode. This inode is
* locked exclusively and joined to the transaction already.
*/
ASSERT(xfs_isilocked(*ip, XFS_ILOCK_EXCL));
IHOLD(*ip);
/* /*
* Make the changes in the superblock, and log those too. * Make the changes in the superblock, and log those too.
* sbfields arg may contain fields other than *QUOTINO; * sbfields arg may contain fields other than *QUOTINO;
...@@ -1264,7 +1254,7 @@ xfs_qm_qino_alloc( ...@@ -1264,7 +1254,7 @@ xfs_qm_qino_alloc(
xfs_mod_sb(tp, sbfields); xfs_mod_sb(tp, sbfields);
if ((error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES))) { if ((error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES))) {
xfs_fs_cmn_err(CE_ALERT, mp, "XFS qino_alloc failed!"); xfs_alert(mp, "%s failed (error %d)!", __func__, error);
return error; return error;
} }
return 0; return 0;
...@@ -1299,7 +1289,7 @@ xfs_qm_reset_dqcounts( ...@@ -1299,7 +1289,7 @@ xfs_qm_reset_dqcounts(
* output any warnings because it's perfectly possible to * output any warnings because it's perfectly possible to
* find uninitialised dquot blks. See comment in xfs_qm_dqcheck. * find uninitialised dquot blks. See comment in xfs_qm_dqcheck.
*/ */
(void) xfs_qm_dqcheck(ddq, id+j, type, XFS_QMOPT_DQREPAIR, (void) xfs_qm_dqcheck(mp, ddq, id+j, type, XFS_QMOPT_DQREPAIR,
"xfs_quotacheck"); "xfs_quotacheck");
ddq->d_bcount = 0; ddq->d_bcount = 0;
ddq->d_icount = 0; ddq->d_icount = 0;
...@@ -1676,7 +1666,7 @@ xfs_qm_quotacheck( ...@@ -1676,7 +1666,7 @@ xfs_qm_quotacheck(
*/ */
ASSERT(list_empty(&mp->m_quotainfo->qi_dqlist)); ASSERT(list_empty(&mp->m_quotainfo->qi_dqlist));
cmn_err(CE_NOTE, "XFS quotacheck %s: Please wait.", mp->m_fsname); xfs_notice(mp, "Quotacheck needed: Please wait.");
/* /*
* First we go thru all the dquots on disk, USR and GRP/PRJ, and reset * First we go thru all the dquots on disk, USR and GRP/PRJ, and reset
...@@ -1754,9 +1744,9 @@ xfs_qm_quotacheck( ...@@ -1754,9 +1744,9 @@ xfs_qm_quotacheck(
error_return: error_return:
if (error) { if (error) {
cmn_err(CE_WARN, "XFS quotacheck %s: Unsuccessful (Error %d): " xfs_warn(mp,
"Disabling quotas.", "Quotacheck: Unsuccessful (Error %d): Disabling quotas.",
mp->m_fsname, error); error);
/* /*
* We must turn off quotas. * We must turn off quotas.
*/ */
...@@ -1764,12 +1754,11 @@ xfs_qm_quotacheck( ...@@ -1764,12 +1754,11 @@ xfs_qm_quotacheck(
ASSERT(xfs_Gqm != NULL); ASSERT(xfs_Gqm != NULL);
xfs_qm_destroy_quotainfo(mp); xfs_qm_destroy_quotainfo(mp);
if (xfs_mount_reset_sbqflags(mp)) { if (xfs_mount_reset_sbqflags(mp)) {
cmn_err(CE_WARN, "XFS quotacheck %s: " xfs_warn(mp,
"Failed to reset quota flags.", mp->m_fsname); "Quotacheck: Failed to reset quota flags.");
} }
} else { } else
cmn_err(CE_NOTE, "XFS quotacheck %s: Done.", mp->m_fsname); xfs_notice(mp, "Quotacheck: Done.");
}
return (error); return (error);
} }
...@@ -1937,8 +1926,8 @@ xfs_qm_dqreclaim_one(void) ...@@ -1937,8 +1926,8 @@ xfs_qm_dqreclaim_one(void)
*/ */
error = xfs_qm_dqflush(dqp, 0); error = xfs_qm_dqflush(dqp, 0);
if (error) { if (error) {
xfs_fs_cmn_err(CE_WARN, mp, xfs_warn(mp, "%s: dquot %p flush failed",
"xfs_qm_dqreclaim: dquot %p flush failed", dqp); __func__, dqp);
} }
goto dqunlock; goto dqunlock;
} }
...@@ -2115,7 +2104,7 @@ xfs_qm_write_sb_changes( ...@@ -2115,7 +2104,7 @@ xfs_qm_write_sb_changes(
int error; int error;
#ifdef QUOTADEBUG #ifdef QUOTADEBUG
cmn_err(CE_NOTE, "Writing superblock quota changes :%s", mp->m_fsname); xfs_notice(mp, "Writing superblock quota changes");
#endif #endif
tp = xfs_trans_alloc(mp, XFS_TRANS_QM_SBCHANGE); tp = xfs_trans_alloc(mp, XFS_TRANS_QM_SBCHANGE);
if ((error = xfs_trans_reserve(tp, 0, if ((error = xfs_trans_reserve(tp, 0,
......
...@@ -119,8 +119,7 @@ xfs_qm_newmount( ...@@ -119,8 +119,7 @@ xfs_qm_newmount(
(gquotaondisk && !XFS_IS_GQUOTA_ON(mp)) || (gquotaondisk && !XFS_IS_GQUOTA_ON(mp)) ||
(!gquotaondisk && XFS_IS_OQUOTA_ON(mp))) && (!gquotaondisk && XFS_IS_OQUOTA_ON(mp))) &&
xfs_dev_is_read_only(mp, "changing quota state")) { xfs_dev_is_read_only(mp, "changing quota state")) {
cmn_err(CE_WARN, xfs_warn(mp, "please mount with%s%s%s%s.",
"XFS: please mount with%s%s%s%s.",
(!quotaondisk ? "out quota" : ""), (!quotaondisk ? "out quota" : ""),
(uquotaondisk ? " usrquota" : ""), (uquotaondisk ? " usrquota" : ""),
(pquotaondisk ? " prjquota" : ""), (pquotaondisk ? " prjquota" : ""),
......
...@@ -41,12 +41,6 @@ ...@@ -41,12 +41,6 @@
#include "xfs_qm.h" #include "xfs_qm.h"
#include "xfs_trace.h" #include "xfs_trace.h"
#ifdef DEBUG
# define qdprintk(s, args...) cmn_err(CE_DEBUG, s, ## args)
#else
# define qdprintk(s, args...) do { } while (0)
#endif
STATIC int xfs_qm_log_quotaoff(xfs_mount_t *, xfs_qoff_logitem_t **, uint); STATIC int xfs_qm_log_quotaoff(xfs_mount_t *, xfs_qoff_logitem_t **, uint);
STATIC int xfs_qm_log_quotaoff_end(xfs_mount_t *, xfs_qoff_logitem_t *, STATIC int xfs_qm_log_quotaoff_end(xfs_mount_t *, xfs_qoff_logitem_t *,
uint); uint);
...@@ -294,7 +288,8 @@ xfs_qm_scall_trunc_qfiles( ...@@ -294,7 +288,8 @@ xfs_qm_scall_trunc_qfiles(
int error = 0, error2 = 0; int error = 0, error2 = 0;
if (!xfs_sb_version_hasquota(&mp->m_sb) || flags == 0) { if (!xfs_sb_version_hasquota(&mp->m_sb) || flags == 0) {
qdprintk("qtrunc flags=%x m_qflags=%x\n", flags, mp->m_qflags); xfs_debug(mp, "%s: flags=%x m_qflags=%x\n",
__func__, flags, mp->m_qflags);
return XFS_ERROR(EINVAL); return XFS_ERROR(EINVAL);
} }
...@@ -331,7 +326,8 @@ xfs_qm_scall_quotaon( ...@@ -331,7 +326,8 @@ xfs_qm_scall_quotaon(
sbflags = 0; sbflags = 0;
if (flags == 0) { if (flags == 0) {
qdprintk("quotaon: zero flags, m_qflags=%x\n", mp->m_qflags); xfs_debug(mp, "%s: zero flags, m_qflags=%x\n",
__func__, mp->m_qflags);
return XFS_ERROR(EINVAL); return XFS_ERROR(EINVAL);
} }
...@@ -352,8 +348,9 @@ xfs_qm_scall_quotaon( ...@@ -352,8 +348,9 @@ xfs_qm_scall_quotaon(
(flags & XFS_GQUOTA_ACCT) == 0 && (flags & XFS_GQUOTA_ACCT) == 0 &&
(mp->m_sb.sb_qflags & XFS_GQUOTA_ACCT) == 0 && (mp->m_sb.sb_qflags & XFS_GQUOTA_ACCT) == 0 &&
(flags & XFS_OQUOTA_ENFD))) { (flags & XFS_OQUOTA_ENFD))) {
qdprintk("Can't enforce without acct, flags=%x sbflags=%x\n", xfs_debug(mp,
flags, mp->m_sb.sb_qflags); "%s: Can't enforce without acct, flags=%x sbflags=%x\n",
__func__, flags, mp->m_sb.sb_qflags);
return XFS_ERROR(EINVAL); return XFS_ERROR(EINVAL);
} }
/* /*
...@@ -541,7 +538,7 @@ xfs_qm_scall_setqlim( ...@@ -541,7 +538,7 @@ xfs_qm_scall_setqlim(
q->qi_bsoftlimit = soft; q->qi_bsoftlimit = soft;
} }
} else { } else {
qdprintk("blkhard %Ld < blksoft %Ld\n", hard, soft); xfs_debug(mp, "blkhard %Ld < blksoft %Ld\n", hard, soft);
} }
hard = (newlim->d_fieldmask & FS_DQ_RTBHARD) ? hard = (newlim->d_fieldmask & FS_DQ_RTBHARD) ?
(xfs_qcnt_t) XFS_BB_TO_FSB(mp, newlim->d_rtb_hardlimit) : (xfs_qcnt_t) XFS_BB_TO_FSB(mp, newlim->d_rtb_hardlimit) :
...@@ -557,7 +554,7 @@ xfs_qm_scall_setqlim( ...@@ -557,7 +554,7 @@ xfs_qm_scall_setqlim(
q->qi_rtbsoftlimit = soft; q->qi_rtbsoftlimit = soft;
} }
} else { } else {
qdprintk("rtbhard %Ld < rtbsoft %Ld\n", hard, soft); xfs_debug(mp, "rtbhard %Ld < rtbsoft %Ld\n", hard, soft);
} }
hard = (newlim->d_fieldmask & FS_DQ_IHARD) ? hard = (newlim->d_fieldmask & FS_DQ_IHARD) ?
...@@ -574,7 +571,7 @@ xfs_qm_scall_setqlim( ...@@ -574,7 +571,7 @@ xfs_qm_scall_setqlim(
q->qi_isoftlimit = soft; q->qi_isoftlimit = soft;
} }
} else { } else {
qdprintk("ihard %Ld < isoft %Ld\n", hard, soft); xfs_debug(mp, "ihard %Ld < isoft %Ld\n", hard, soft);
} }
/* /*
...@@ -939,10 +936,11 @@ struct mutex qcheck_lock; ...@@ -939,10 +936,11 @@ struct mutex qcheck_lock;
#define DQTEST_LIST_PRINT(l, NXT, title) \ #define DQTEST_LIST_PRINT(l, NXT, title) \
{ \ { \
xfs_dqtest_t *dqp; int i = 0;\ xfs_dqtest_t *dqp; int i = 0;\
cmn_err(CE_DEBUG, "%s (#%d)", title, (int) (l)->qh_nelems); \ xfs_debug(NULL, "%s (#%d)", title, (int) (l)->qh_nelems); \
for (dqp = (xfs_dqtest_t *)(l)->qh_next; dqp != NULL; \ for (dqp = (xfs_dqtest_t *)(l)->qh_next; dqp != NULL; \
dqp = (xfs_dqtest_t *)dqp->NXT) { \ dqp = (xfs_dqtest_t *)dqp->NXT) { \
cmn_err(CE_DEBUG, " %d. \"%d (%s)\" bcnt = %d, icnt = %d", \ xfs_debug(dqp->q_mount, \
" %d. \"%d (%s)\" bcnt = %d, icnt = %d", \
++i, dqp->d_id, DQFLAGTO_TYPESTR(dqp), \ ++i, dqp->d_id, DQFLAGTO_TYPESTR(dqp), \
dqp->d_bcount, dqp->d_icount); } \ dqp->d_bcount, dqp->d_icount); } \
} }
...@@ -966,16 +964,17 @@ xfs_qm_hashinsert(xfs_dqhash_t *h, xfs_dqtest_t *dqp) ...@@ -966,16 +964,17 @@ xfs_qm_hashinsert(xfs_dqhash_t *h, xfs_dqtest_t *dqp)
} }
STATIC void STATIC void
xfs_qm_dqtest_print( xfs_qm_dqtest_print(
xfs_dqtest_t *d) struct xfs_mount *mp,
struct dqtest *d)
{ {
cmn_err(CE_DEBUG, "-----------DQTEST DQUOT----------------"); xfs_debug(mp, "-----------DQTEST DQUOT----------------");
cmn_err(CE_DEBUG, "---- dquot ID = %d", d->d_id); xfs_debug(mp, "---- dquot ID = %d", d->d_id);
cmn_err(CE_DEBUG, "---- fs = 0x%p", d->q_mount); xfs_debug(mp, "---- fs = 0x%p", d->q_mount);
cmn_err(CE_DEBUG, "---- bcount = %Lu (0x%x)", xfs_debug(mp, "---- bcount = %Lu (0x%x)",
d->d_bcount, (int)d->d_bcount); d->d_bcount, (int)d->d_bcount);
cmn_err(CE_DEBUG, "---- icount = %Lu (0x%x)", xfs_debug(mp, "---- icount = %Lu (0x%x)",
d->d_icount, (int)d->d_icount); d->d_icount, (int)d->d_icount);
cmn_err(CE_DEBUG, "---------------------------"); xfs_debug(mp, "---------------------------");
} }
STATIC void STATIC void
...@@ -989,12 +988,14 @@ xfs_qm_dqtest_failed( ...@@ -989,12 +988,14 @@ xfs_qm_dqtest_failed(
{ {
qmtest_nfails++; qmtest_nfails++;
if (error) if (error)
cmn_err(CE_DEBUG, "quotacheck failed id=%d, err=%d\nreason: %s", xfs_debug(dqp->q_mount,
d->d_id, error, reason); "quotacheck failed id=%d, err=%d\nreason: %s",
d->d_id, error, reason);
else else
cmn_err(CE_DEBUG, "quotacheck failed id=%d (%s) [%d != %d]", xfs_debug(dqp->q_mount,
d->d_id, reason, (int)a, (int)b); "quotacheck failed id=%d (%s) [%d != %d]",
xfs_qm_dqtest_print(d); d->d_id, reason, (int)a, (int)b);
xfs_qm_dqtest_print(dqp->q_mount, d);
if (dqp) if (dqp)
xfs_qm_dqprint(dqp); xfs_qm_dqprint(dqp);
} }
...@@ -1021,9 +1022,9 @@ xfs_dqtest_cmp2( ...@@ -1021,9 +1022,9 @@ xfs_dqtest_cmp2(
be64_to_cpu(dqp->q_core.d_bcount) >= be64_to_cpu(dqp->q_core.d_bcount) >=
be64_to_cpu(dqp->q_core.d_blk_softlimit)) { be64_to_cpu(dqp->q_core.d_blk_softlimit)) {
if (!dqp->q_core.d_btimer && dqp->q_core.d_id) { if (!dqp->q_core.d_btimer && dqp->q_core.d_id) {
cmn_err(CE_DEBUG, xfs_debug(dqp->q_mount,
"%d [%s] [0x%p] BLK TIMER NOT STARTED", "%d [%s] BLK TIMER NOT STARTED",
d->d_id, DQFLAGTO_TYPESTR(d), d->q_mount); d->d_id, DQFLAGTO_TYPESTR(d));
err++; err++;
} }
} }
...@@ -1031,16 +1032,16 @@ xfs_dqtest_cmp2( ...@@ -1031,16 +1032,16 @@ xfs_dqtest_cmp2(
be64_to_cpu(dqp->q_core.d_icount) >= be64_to_cpu(dqp->q_core.d_icount) >=
be64_to_cpu(dqp->q_core.d_ino_softlimit)) { be64_to_cpu(dqp->q_core.d_ino_softlimit)) {
if (!dqp->q_core.d_itimer && dqp->q_core.d_id) { if (!dqp->q_core.d_itimer && dqp->q_core.d_id) {
cmn_err(CE_DEBUG, xfs_debug(dqp->q_mount,
"%d [%s] [0x%p] INO TIMER NOT STARTED", "%d [%s] INO TIMER NOT STARTED",
d->d_id, DQFLAGTO_TYPESTR(d), d->q_mount); d->d_id, DQFLAGTO_TYPESTR(d));
err++; err++;
} }
} }
#ifdef QUOTADEBUG #ifdef QUOTADEBUG
if (!err) { if (!err) {
cmn_err(CE_DEBUG, "%d [%s] [0x%p] qchecked", xfs_debug(dqp->q_mount, "%d [%s] qchecked",
d->d_id, DQFLAGTO_TYPESTR(d), d->q_mount); d->d_id, DQFLAGTO_TYPESTR(d));
} }
#endif #endif
return (err); return (err);
...@@ -1137,8 +1138,8 @@ xfs_qm_internalqcheck_adjust( ...@@ -1137,8 +1138,8 @@ xfs_qm_internalqcheck_adjust(
if (ino == mp->m_sb.sb_uquotino || ino == mp->m_sb.sb_gquotino) { if (ino == mp->m_sb.sb_uquotino || ino == mp->m_sb.sb_gquotino) {
*res = BULKSTAT_RV_NOTHING; *res = BULKSTAT_RV_NOTHING;
qdprintk("internalqcheck: ino=%llu, uqino=%llu, gqino=%llu\n", xfs_debug(mp, "%s: ino=%llu, uqino=%llu, gqino=%llu\n",
(unsigned long long) ino, __func__, (unsigned long long) ino,
(unsigned long long) mp->m_sb.sb_uquotino, (unsigned long long) mp->m_sb.sb_uquotino,
(unsigned long long) mp->m_sb.sb_gquotino); (unsigned long long) mp->m_sb.sb_gquotino);
return XFS_ERROR(EINVAL); return XFS_ERROR(EINVAL);
...@@ -1223,12 +1224,12 @@ xfs_qm_internalqcheck( ...@@ -1223,12 +1224,12 @@ xfs_qm_internalqcheck(
xfs_qm_internalqcheck_adjust, xfs_qm_internalqcheck_adjust,
0, NULL, &done); 0, NULL, &done);
if (error) { if (error) {
cmn_err(CE_DEBUG, "Bulkstat returned error 0x%x", error); xfs_debug(mp, "Bulkstat returned error 0x%x", error);
break; break;
} }
} while (!done); } while (!done);
cmn_err(CE_DEBUG, "Checking results against system dquots"); xfs_debug(mp, "Checking results against system dquots");
for (i = 0; i < qmtest_hashmask; i++) { for (i = 0; i < qmtest_hashmask; i++) {
xfs_dqtest_t *d, *n; xfs_dqtest_t *d, *n;
xfs_dqhash_t *h; xfs_dqhash_t *h;
...@@ -1246,10 +1247,10 @@ xfs_qm_internalqcheck( ...@@ -1246,10 +1247,10 @@ xfs_qm_internalqcheck(
} }
if (qmtest_nfails) { if (qmtest_nfails) {
cmn_err(CE_DEBUG, "******** quotacheck failed ********"); xfs_debug(mp, "******** quotacheck failed ********");
cmn_err(CE_DEBUG, "failures = %d", qmtest_nfails); xfs_debug(mp, "failures = %d", qmtest_nfails);
} else { } else {
cmn_err(CE_DEBUG, "******** quotacheck successful! ********"); xfs_debug(mp, "******** quotacheck successful! ********");
} }
kmem_free(qmtest_udqtab); kmem_free(qmtest_udqtab);
kmem_free(qmtest_gdqtab); kmem_free(qmtest_gdqtab);
......
...@@ -643,8 +643,9 @@ xfs_trans_dqresv( ...@@ -643,8 +643,9 @@ xfs_trans_dqresv(
(XFS_IS_OQUOTA_ENFORCED(dqp->q_mount) && (XFS_IS_OQUOTA_ENFORCED(dqp->q_mount) &&
(XFS_QM_ISPDQ(dqp) || XFS_QM_ISGDQ(dqp))))) { (XFS_QM_ISPDQ(dqp) || XFS_QM_ISGDQ(dqp))))) {
#ifdef QUOTADEBUG #ifdef QUOTADEBUG
cmn_err(CE_DEBUG, "BLK Res: nblks=%ld + resbcount=%Ld" xfs_debug(mp,
" > hardlimit=%Ld?", nblks, *resbcountp, hardlimit); "BLK Res: nblks=%ld + resbcount=%Ld > hardlimit=%Ld?",
nblks, *resbcountp, hardlimit);
#endif #endif
if (nblks > 0) { if (nblks > 0) {
/* /*
......
/*
* Copyright (c) 2000-2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it would be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef __XFS_SUPPORT_DEBUG_H__
#define __XFS_SUPPORT_DEBUG_H__
#include <stdarg.h>
struct xfs_mount;
#define CE_DEBUG KERN_DEBUG
#define CE_CONT KERN_INFO
#define CE_NOTE KERN_NOTICE
#define CE_WARN KERN_WARNING
#define CE_ALERT KERN_ALERT
#define CE_PANIC KERN_EMERG
void cmn_err(const char *lvl, const char *fmt, ...)
__attribute__ ((format (printf, 2, 3)));
void xfs_fs_cmn_err( const char *lvl, struct xfs_mount *mp,
const char *fmt, ...) __attribute__ ((format (printf, 3, 4)));
void xfs_cmn_err( int panic_tag, const char *lvl, struct xfs_mount *mp,
const char *fmt, ...) __attribute__ ((format (printf, 4, 5)));
extern void assfail(char *expr, char *f, int l);
#define ASSERT_ALWAYS(expr) \
(unlikely(expr) ? (void)0 : assfail(#expr, __FILE__, __LINE__))
#ifndef DEBUG
#define ASSERT(expr) ((void)0)
#ifndef STATIC
# define STATIC static noinline
#endif
#else /* DEBUG */
#define ASSERT(expr) \
(unlikely(expr) ? (void)0 : assfail(#expr, __FILE__, __LINE__))
#ifndef STATIC
# define STATIC noinline
#endif
#endif /* DEBUG */
#endif /* __XFS_SUPPORT_DEBUG_H__ */
...@@ -147,10 +147,9 @@ xfs_alloc_get_rec( ...@@ -147,10 +147,9 @@ xfs_alloc_get_rec(
*/ */
STATIC void STATIC void
xfs_alloc_compute_aligned( xfs_alloc_compute_aligned(
xfs_alloc_arg_t *args, /* allocation argument structure */
xfs_agblock_t foundbno, /* starting block in found extent */ xfs_agblock_t foundbno, /* starting block in found extent */
xfs_extlen_t foundlen, /* length in found extent */ xfs_extlen_t foundlen, /* length in found extent */
xfs_extlen_t alignment, /* alignment for allocation */
xfs_extlen_t minlen, /* minimum length for allocation */
xfs_agblock_t *resbno, /* result block number */ xfs_agblock_t *resbno, /* result block number */
xfs_extlen_t *reslen) /* result length */ xfs_extlen_t *reslen) /* result length */
{ {
...@@ -158,8 +157,8 @@ xfs_alloc_compute_aligned( ...@@ -158,8 +157,8 @@ xfs_alloc_compute_aligned(
xfs_extlen_t diff; xfs_extlen_t diff;
xfs_extlen_t len; xfs_extlen_t len;
if (alignment > 1 && foundlen >= minlen) { if (args->alignment > 1 && foundlen >= args->minlen) {
bno = roundup(foundbno, alignment); bno = roundup(foundbno, args->alignment);
diff = bno - foundbno; diff = bno - foundbno;
len = diff >= foundlen ? 0 : foundlen - diff; len = diff >= foundlen ? 0 : foundlen - diff;
} else { } else {
...@@ -464,6 +463,27 @@ xfs_alloc_read_agfl( ...@@ -464,6 +463,27 @@ xfs_alloc_read_agfl(
return 0; return 0;
} }
STATIC int
xfs_alloc_update_counters(
struct xfs_trans *tp,
struct xfs_perag *pag,
struct xfs_buf *agbp,
long len)
{
struct xfs_agf *agf = XFS_BUF_TO_AGF(agbp);
pag->pagf_freeblks += len;
be32_add_cpu(&agf->agf_freeblks, len);
xfs_trans_agblocks_delta(tp, len);
if (unlikely(be32_to_cpu(agf->agf_freeblks) >
be32_to_cpu(agf->agf_length)))
return EFSCORRUPTED;
xfs_alloc_log_agf(tp, agbp, XFS_AGF_FREEBLKS);
return 0;
}
/* /*
* Allocation group level functions. * Allocation group level functions.
*/ */
...@@ -505,49 +525,44 @@ xfs_alloc_ag_vextent( ...@@ -505,49 +525,44 @@ xfs_alloc_ag_vextent(
ASSERT(0); ASSERT(0);
/* NOTREACHED */ /* NOTREACHED */
} }
if (error)
if (error || args->agbno == NULLAGBLOCK)
return error; return error;
/*
* If the allocation worked, need to change the agf structure
* (and log it), and the superblock.
*/
if (args->agbno != NULLAGBLOCK) {
xfs_agf_t *agf; /* allocation group freelist header */
long slen = (long)args->len;
ASSERT(args->len >= args->minlen && args->len <= args->maxlen); ASSERT(args->len >= args->minlen);
ASSERT(!(args->wasfromfl) || !args->isfl); ASSERT(args->len <= args->maxlen);
ASSERT(args->agbno % args->alignment == 0); ASSERT(!args->wasfromfl || !args->isfl);
if (!(args->wasfromfl)) { ASSERT(args->agbno % args->alignment == 0);
agf = XFS_BUF_TO_AGF(args->agbp); if (!args->wasfromfl) {
be32_add_cpu(&agf->agf_freeblks, -(args->len)); error = xfs_alloc_update_counters(args->tp, args->pag,
xfs_trans_agblocks_delta(args->tp, args->agbp,
-((long)(args->len))); -((long)(args->len)));
args->pag->pagf_freeblks -= args->len; if (error)
ASSERT(be32_to_cpu(agf->agf_freeblks) <= return error;
be32_to_cpu(agf->agf_length));
xfs_alloc_log_agf(args->tp, args->agbp, /*
XFS_AGF_FREEBLKS); * Search the busylist for these blocks and mark the
/* * transaction as synchronous if blocks are found. This
* Search the busylist for these blocks and mark the * avoids the need to block due to a synchronous log
* transaction as synchronous if blocks are found. This * force to ensure correct ordering as the synchronous
* avoids the need to block due to a synchronous log * transaction will guarantee that for us.
* force to ensure correct ordering as the synchronous */
* transaction will guarantee that for us. if (xfs_alloc_busy_search(args->mp, args->agno,
*/ args->agbno, args->len))
if (xfs_alloc_busy_search(args->mp, args->agno, xfs_trans_set_sync(args->tp);
args->agbno, args->len))
xfs_trans_set_sync(args->tp);
}
if (!args->isfl)
xfs_trans_mod_sb(args->tp,
args->wasdel ? XFS_TRANS_SB_RES_FDBLOCKS :
XFS_TRANS_SB_FDBLOCKS, -slen);
XFS_STATS_INC(xs_allocx);
XFS_STATS_ADD(xs_allocb, args->len);
} }
return 0;
if (!args->isfl) {
xfs_trans_mod_sb(args->tp, args->wasdel ?
XFS_TRANS_SB_RES_FDBLOCKS :
XFS_TRANS_SB_FDBLOCKS,
-((long)(args->len)));
}
XFS_STATS_INC(xs_allocx);
XFS_STATS_ADD(xs_allocb, args->len);
return error;
} }
/* /*
...@@ -693,8 +708,7 @@ xfs_alloc_find_best_extent( ...@@ -693,8 +708,7 @@ xfs_alloc_find_best_extent(
if (error) if (error)
goto error0; goto error0;
XFS_WANT_CORRUPTED_GOTO(i == 1, error0); XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
xfs_alloc_compute_aligned(*sbno, *slen, args->alignment, xfs_alloc_compute_aligned(args, *sbno, *slen, &bno, slena);
args->minlen, &bno, slena);
/* /*
* The good extent is closer than this one. * The good extent is closer than this one.
...@@ -866,8 +880,8 @@ xfs_alloc_ag_vextent_near( ...@@ -866,8 +880,8 @@ xfs_alloc_ag_vextent_near(
if ((error = xfs_alloc_get_rec(cnt_cur, &ltbno, &ltlen, &i))) if ((error = xfs_alloc_get_rec(cnt_cur, &ltbno, &ltlen, &i)))
goto error0; goto error0;
XFS_WANT_CORRUPTED_GOTO(i == 1, error0); XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
xfs_alloc_compute_aligned(ltbno, ltlen, args->alignment, xfs_alloc_compute_aligned(args, ltbno, ltlen,
args->minlen, &ltbnoa, &ltlena); &ltbnoa, &ltlena);
if (ltlena < args->minlen) if (ltlena < args->minlen)
continue; continue;
args->len = XFS_EXTLEN_MIN(ltlena, args->maxlen); args->len = XFS_EXTLEN_MIN(ltlena, args->maxlen);
...@@ -987,8 +1001,8 @@ xfs_alloc_ag_vextent_near( ...@@ -987,8 +1001,8 @@ xfs_alloc_ag_vextent_near(
if ((error = xfs_alloc_get_rec(bno_cur_lt, &ltbno, &ltlen, &i))) if ((error = xfs_alloc_get_rec(bno_cur_lt, &ltbno, &ltlen, &i)))
goto error0; goto error0;
XFS_WANT_CORRUPTED_GOTO(i == 1, error0); XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
xfs_alloc_compute_aligned(ltbno, ltlen, args->alignment, xfs_alloc_compute_aligned(args, ltbno, ltlen,
args->minlen, &ltbnoa, &ltlena); &ltbnoa, &ltlena);
if (ltlena >= args->minlen) if (ltlena >= args->minlen)
break; break;
if ((error = xfs_btree_decrement(bno_cur_lt, 0, &i))) if ((error = xfs_btree_decrement(bno_cur_lt, 0, &i)))
...@@ -1003,8 +1017,8 @@ xfs_alloc_ag_vextent_near( ...@@ -1003,8 +1017,8 @@ xfs_alloc_ag_vextent_near(
if ((error = xfs_alloc_get_rec(bno_cur_gt, &gtbno, &gtlen, &i))) if ((error = xfs_alloc_get_rec(bno_cur_gt, &gtbno, &gtlen, &i)))
goto error0; goto error0;
XFS_WANT_CORRUPTED_GOTO(i == 1, error0); XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
xfs_alloc_compute_aligned(gtbno, gtlen, args->alignment, xfs_alloc_compute_aligned(args, gtbno, gtlen,
args->minlen, &gtbnoa, &gtlena); &gtbnoa, &gtlena);
if (gtlena >= args->minlen) if (gtlena >= args->minlen)
break; break;
if ((error = xfs_btree_increment(bno_cur_gt, 0, &i))) if ((error = xfs_btree_increment(bno_cur_gt, 0, &i)))
...@@ -1183,8 +1197,7 @@ xfs_alloc_ag_vextent_size( ...@@ -1183,8 +1197,7 @@ xfs_alloc_ag_vextent_size(
* once aligned; if not, we search left for something better. * once aligned; if not, we search left for something better.
* This can't happen in the second case above. * This can't happen in the second case above.
*/ */
xfs_alloc_compute_aligned(fbno, flen, args->alignment, args->minlen, xfs_alloc_compute_aligned(args, fbno, flen, &rbno, &rlen);
&rbno, &rlen);
rlen = XFS_EXTLEN_MIN(args->maxlen, rlen); rlen = XFS_EXTLEN_MIN(args->maxlen, rlen);
XFS_WANT_CORRUPTED_GOTO(rlen == 0 || XFS_WANT_CORRUPTED_GOTO(rlen == 0 ||
(rlen <= flen && rbno + rlen <= fbno + flen), error0); (rlen <= flen && rbno + rlen <= fbno + flen), error0);
...@@ -1209,8 +1222,8 @@ xfs_alloc_ag_vextent_size( ...@@ -1209,8 +1222,8 @@ xfs_alloc_ag_vextent_size(
XFS_WANT_CORRUPTED_GOTO(i == 1, error0); XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
if (flen < bestrlen) if (flen < bestrlen)
break; break;
xfs_alloc_compute_aligned(fbno, flen, args->alignment, xfs_alloc_compute_aligned(args, fbno, flen,
args->minlen, &rbno, &rlen); &rbno, &rlen);
rlen = XFS_EXTLEN_MIN(args->maxlen, rlen); rlen = XFS_EXTLEN_MIN(args->maxlen, rlen);
XFS_WANT_CORRUPTED_GOTO(rlen == 0 || XFS_WANT_CORRUPTED_GOTO(rlen == 0 ||
(rlen <= flen && rbno + rlen <= fbno + flen), (rlen <= flen && rbno + rlen <= fbno + flen),
...@@ -1388,6 +1401,7 @@ xfs_free_ag_extent( ...@@ -1388,6 +1401,7 @@ xfs_free_ag_extent(
xfs_mount_t *mp; /* mount point struct for filesystem */ xfs_mount_t *mp; /* mount point struct for filesystem */
xfs_agblock_t nbno; /* new starting block of freespace */ xfs_agblock_t nbno; /* new starting block of freespace */
xfs_extlen_t nlen; /* new length of freespace */ xfs_extlen_t nlen; /* new length of freespace */
xfs_perag_t *pag; /* per allocation group data */
mp = tp->t_mountp; mp = tp->t_mountp;
/* /*
...@@ -1586,30 +1600,20 @@ xfs_free_ag_extent( ...@@ -1586,30 +1600,20 @@ xfs_free_ag_extent(
XFS_WANT_CORRUPTED_GOTO(i == 1, error0); XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
xfs_btree_del_cursor(cnt_cur, XFS_BTREE_NOERROR); xfs_btree_del_cursor(cnt_cur, XFS_BTREE_NOERROR);
cnt_cur = NULL; cnt_cur = NULL;
/* /*
* Update the freespace totals in the ag and superblock. * Update the freespace totals in the ag and superblock.
*/ */
{ pag = xfs_perag_get(mp, agno);
xfs_agf_t *agf; error = xfs_alloc_update_counters(tp, pag, agbp, len);
xfs_perag_t *pag; /* per allocation group data */ xfs_perag_put(pag);
if (error)
pag = xfs_perag_get(mp, agno); goto error0;
pag->pagf_freeblks += len;
xfs_perag_put(pag); if (!isfl)
xfs_trans_mod_sb(tp, XFS_TRANS_SB_FDBLOCKS, (long)len);
agf = XFS_BUF_TO_AGF(agbp); XFS_STATS_INC(xs_freex);
be32_add_cpu(&agf->agf_freeblks, len); XFS_STATS_ADD(xs_freeb, len);
xfs_trans_agblocks_delta(tp, len);
XFS_WANT_CORRUPTED_GOTO(
be32_to_cpu(agf->agf_freeblks) <=
be32_to_cpu(agf->agf_length),
error0);
xfs_alloc_log_agf(tp, agbp, XFS_AGF_FREEBLKS);
if (!isfl)
xfs_trans_mod_sb(tp, XFS_TRANS_SB_FDBLOCKS, (long)len);
XFS_STATS_INC(xs_freex);
XFS_STATS_ADD(xs_freeb, len);
}
trace_xfs_free_extent(mp, agno, bno, len, isfl, haveleft, haveright); trace_xfs_free_extent(mp, agno, bno, len, isfl, haveleft, haveright);
......
...@@ -2365,6 +2365,13 @@ xfs_bmap_rtalloc( ...@@ -2365,6 +2365,13 @@ xfs_bmap_rtalloc(
*/ */
if (ralen * mp->m_sb.sb_rextsize >= MAXEXTLEN) if (ralen * mp->m_sb.sb_rextsize >= MAXEXTLEN)
ralen = MAXEXTLEN / mp->m_sb.sb_rextsize; ralen = MAXEXTLEN / mp->m_sb.sb_rextsize;
/*
* Lock out other modifications to the RT bitmap inode.
*/
xfs_ilock(mp->m_rbmip, XFS_ILOCK_EXCL);
xfs_trans_ijoin_ref(ap->tp, mp->m_rbmip, XFS_ILOCK_EXCL);
/* /*
* If it's an allocation to an empty file at offset 0, * If it's an allocation to an empty file at offset 0,
* pick an extent that will space things out in the rt area. * pick an extent that will space things out in the rt area.
...@@ -3519,7 +3526,7 @@ xfs_bmap_search_extents( ...@@ -3519,7 +3526,7 @@ xfs_bmap_search_extents(
if (unlikely(!(gotp->br_startblock) && (*lastxp != NULLEXTNUM) && if (unlikely(!(gotp->br_startblock) && (*lastxp != NULLEXTNUM) &&
!(XFS_IS_REALTIME_INODE(ip) && fork == XFS_DATA_FORK))) { !(XFS_IS_REALTIME_INODE(ip) && fork == XFS_DATA_FORK))) {
xfs_cmn_err(XFS_PTAG_FSBLOCK_ZERO, CE_ALERT, ip->i_mount, xfs_alert_tag(ip->i_mount, XFS_PTAG_FSBLOCK_ZERO,
"Access to block zero in inode %llu " "Access to block zero in inode %llu "
"start_block: %llx start_off: %llx " "start_block: %llx start_off: %llx "
"blkcnt: %llx extent-state: %x lastx: %x\n", "blkcnt: %llx extent-state: %x lastx: %x\n",
...@@ -4193,12 +4200,11 @@ xfs_bmap_read_extents( ...@@ -4193,12 +4200,11 @@ xfs_bmap_read_extents(
num_recs = xfs_btree_get_numrecs(block); num_recs = xfs_btree_get_numrecs(block);
if (unlikely(i + num_recs > room)) { if (unlikely(i + num_recs > room)) {
ASSERT(i + num_recs <= room); ASSERT(i + num_recs <= room);
xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount, xfs_warn(ip->i_mount,
"corrupt dinode %Lu, (btree extents).", "corrupt dinode %Lu, (btree extents).",
(unsigned long long) ip->i_ino); (unsigned long long) ip->i_ino);
XFS_ERROR_REPORT("xfs_bmap_read_extents(1)", XFS_CORRUPTION_ERROR("xfs_bmap_read_extents(1)",
XFS_ERRLEVEL_LOW, XFS_ERRLEVEL_LOW, ip->i_mount, block);
ip->i_mount);
goto error0; goto error0;
} }
XFS_WANT_CORRUPTED_GOTO( XFS_WANT_CORRUPTED_GOTO(
...@@ -5772,7 +5778,7 @@ xfs_check_block( ...@@ -5772,7 +5778,7 @@ xfs_check_block(
else else
thispa = XFS_BMBT_PTR_ADDR(mp, block, j, dmxr); thispa = XFS_BMBT_PTR_ADDR(mp, block, j, dmxr);
if (*thispa == *pp) { if (*thispa == *pp) {
cmn_err(CE_WARN, "%s: thispa(%d) == pp(%d) %Ld", xfs_warn(mp, "%s: thispa(%d) == pp(%d) %Ld",
__func__, j, i, __func__, j, i,
(unsigned long long)be64_to_cpu(*thispa)); (unsigned long long)be64_to_cpu(*thispa));
panic("%s: ptrs are equal in node\n", panic("%s: ptrs are equal in node\n",
...@@ -5937,11 +5943,11 @@ xfs_bmap_check_leaf_extents( ...@@ -5937,11 +5943,11 @@ xfs_bmap_check_leaf_extents(
return; return;
error0: error0:
cmn_err(CE_WARN, "%s: at error0", __func__); xfs_warn(mp, "%s: at error0", __func__);
if (bp_release) if (bp_release)
xfs_trans_brelse(NULL, bp); xfs_trans_brelse(NULL, bp);
error_norelse: error_norelse:
cmn_err(CE_WARN, "%s: BAD after btree leaves for %d extents", xfs_warn(mp, "%s: BAD after btree leaves for %d extents",
__func__, i); __func__, i);
panic("%s: CORRUPTED BTREE OR SOMETHING", __func__); panic("%s: CORRUPTED BTREE OR SOMETHING", __func__);
return; return;
...@@ -6144,7 +6150,7 @@ xfs_bmap_punch_delalloc_range( ...@@ -6144,7 +6150,7 @@ xfs_bmap_punch_delalloc_range(
if (error) { if (error) {
/* something screwed, just bail */ /* something screwed, just bail */
if (!XFS_FORCED_SHUTDOWN(ip->i_mount)) { if (!XFS_FORCED_SHUTDOWN(ip->i_mount)) {
xfs_fs_cmn_err(CE_ALERT, ip->i_mount, xfs_alert(ip->i_mount,
"Failed delalloc mapping lookup ino %lld fsb %lld.", "Failed delalloc mapping lookup ino %lld fsb %lld.",
ip->i_ino, start_fsb); ip->i_ino, start_fsb);
} }
......
...@@ -130,10 +130,12 @@ xfs_buf_item_log_check( ...@@ -130,10 +130,12 @@ xfs_buf_item_log_check(
orig = bip->bli_orig; orig = bip->bli_orig;
buffer = XFS_BUF_PTR(bp); buffer = XFS_BUF_PTR(bp);
for (x = 0; x < XFS_BUF_COUNT(bp); x++) { for (x = 0; x < XFS_BUF_COUNT(bp); x++) {
if (orig[x] != buffer[x] && !btst(bip->bli_logged, x)) if (orig[x] != buffer[x] && !btst(bip->bli_logged, x)) {
cmn_err(CE_PANIC, xfs_emerg(bp->b_mount,
"xfs_buf_item_log_check bip %x buffer %x orig %x index %d", "%s: bip %x buffer %x orig %x index %d",
bip, bp, orig, x); __func__, bip, bp, orig, x);
ASSERT(0);
}
} }
} }
#else #else
...@@ -983,10 +985,9 @@ xfs_buf_iodone_callbacks( ...@@ -983,10 +985,9 @@ xfs_buf_iodone_callbacks(
if (XFS_BUF_TARGET(bp) != lasttarg || if (XFS_BUF_TARGET(bp) != lasttarg ||
time_after(jiffies, (lasttime + 5*HZ))) { time_after(jiffies, (lasttime + 5*HZ))) {
lasttime = jiffies; lasttime = jiffies;
cmn_err(CE_ALERT, "Device %s, XFS metadata write error" xfs_alert(mp, "Device %s: metadata write error block 0x%llx",
" block 0x%llx in %s",
XFS_BUFTARG_NAME(XFS_BUF_TARGET(bp)), XFS_BUFTARG_NAME(XFS_BUF_TARGET(bp)),
(__uint64_t)XFS_BUF_ADDR(bp), mp->m_fsname); (__uint64_t)XFS_BUF_ADDR(bp));
} }
lasttarg = XFS_BUF_TARGET(bp); lasttarg = XFS_BUF_TARGET(bp);
......
...@@ -1995,13 +1995,12 @@ xfs_da_do_buf( ...@@ -1995,13 +1995,12 @@ xfs_da_do_buf(
error = mappedbno == -2 ? 0 : XFS_ERROR(EFSCORRUPTED); error = mappedbno == -2 ? 0 : XFS_ERROR(EFSCORRUPTED);
if (unlikely(error == EFSCORRUPTED)) { if (unlikely(error == EFSCORRUPTED)) {
if (xfs_error_level >= XFS_ERRLEVEL_LOW) { if (xfs_error_level >= XFS_ERRLEVEL_LOW) {
cmn_err(CE_ALERT, "xfs_da_do_buf: bno %lld\n", xfs_alert(mp, "%s: bno %lld dir: inode %lld",
(long long)bno); __func__, (long long)bno,
cmn_err(CE_ALERT, "dir: inode %lld\n",
(long long)dp->i_ino); (long long)dp->i_ino);
for (i = 0; i < nmap; i++) { for (i = 0; i < nmap; i++) {
cmn_err(CE_ALERT, xfs_alert(mp,
"[%02d] br_startoff %lld br_startblock %lld br_blockcount %lld br_state %d\n", "[%02d] br_startoff %lld br_startblock %lld br_blockcount %lld br_state %d",
i, i,
(long long)mapp[i].br_startoff, (long long)mapp[i].br_startoff,
(long long)mapp[i].br_startblock, (long long)mapp[i].br_startblock,
......
...@@ -270,9 +270,9 @@ xfs_swap_extents( ...@@ -270,9 +270,9 @@ xfs_swap_extents(
/* check inode formats now that data is flushed */ /* check inode formats now that data is flushed */
error = xfs_swap_extents_check_format(ip, tip); error = xfs_swap_extents_check_format(ip, tip);
if (error) { if (error) {
xfs_fs_cmn_err(CE_NOTE, mp, xfs_notice(mp,
"%s: inode 0x%llx format is incompatible for exchanging.", "%s: inode 0x%llx format is incompatible for exchanging.",
__FILE__, ip->i_ino); __func__, ip->i_ino);
goto out_unlock; goto out_unlock;
} }
......
...@@ -159,7 +159,7 @@ xfs_dir_ino_validate( ...@@ -159,7 +159,7 @@ xfs_dir_ino_validate(
XFS_AGINO_TO_INO(mp, agno, agino) == ino; XFS_AGINO_TO_INO(mp, agno, agino) == ino;
if (unlikely(XFS_TEST_ERROR(!ino_ok, mp, XFS_ERRTAG_DIR_INO_VALIDATE, if (unlikely(XFS_TEST_ERROR(!ino_ok, mp, XFS_ERRTAG_DIR_INO_VALIDATE,
XFS_RANDOM_DIR_INO_VALIDATE))) { XFS_RANDOM_DIR_INO_VALIDATE))) {
xfs_fs_cmn_err(CE_WARN, mp, "Invalid inode number 0x%Lx", xfs_warn(mp, "Invalid inode number 0x%Lx",
(unsigned long long) ino); (unsigned long long) ino);
XFS_ERROR_REPORT("xfs_dir_ino_validate", XFS_ERRLEVEL_LOW, mp); XFS_ERROR_REPORT("xfs_dir_ino_validate", XFS_ERRLEVEL_LOW, mp);
return XFS_ERROR(EFSCORRUPTED); return XFS_ERROR(EFSCORRUPTED);
......
...@@ -899,10 +899,9 @@ xfs_dir2_leafn_rebalance( ...@@ -899,10 +899,9 @@ xfs_dir2_leafn_rebalance(
if(blk2->index < 0) { if(blk2->index < 0) {
state->inleaf = 1; state->inleaf = 1;
blk2->index = 0; blk2->index = 0;
cmn_err(CE_ALERT, xfs_alert(args->dp->i_mount,
"xfs_dir2_leafn_rebalance: picked the wrong leaf? reverting original leaf: " "%s: picked the wrong leaf? reverting original leaf: blk1->index %d\n",
"blk1->index %d\n", __func__, blk1->index);
blk1->index);
} }
} }
...@@ -1641,26 +1640,22 @@ xfs_dir2_node_addname_int( ...@@ -1641,26 +1640,22 @@ xfs_dir2_node_addname_int(
} }
if (unlikely(xfs_dir2_db_to_fdb(mp, dbno) != fbno)) { if (unlikely(xfs_dir2_db_to_fdb(mp, dbno) != fbno)) {
cmn_err(CE_ALERT, xfs_alert(mp,
"xfs_dir2_node_addname_int: dir ino " "%s: dir ino " "%llu needed freesp block %lld for\n"
"%llu needed freesp block %lld for\n" " data block %lld, got %lld ifbno %llu lastfbno %d",
" data block %lld, got %lld\n" __func__, (unsigned long long)dp->i_ino,
" ifbno %llu lastfbno %d\n",
(unsigned long long)dp->i_ino,
(long long)xfs_dir2_db_to_fdb(mp, dbno), (long long)xfs_dir2_db_to_fdb(mp, dbno),
(long long)dbno, (long long)fbno, (long long)dbno, (long long)fbno,
(unsigned long long)ifbno, lastfbno); (unsigned long long)ifbno, lastfbno);
if (fblk) { if (fblk) {
cmn_err(CE_ALERT, xfs_alert(mp,
" fblk 0x%p blkno %llu " " fblk 0x%p blkno %llu index %d magic 0x%x",
"index %d magic 0x%x\n",
fblk, fblk,
(unsigned long long)fblk->blkno, (unsigned long long)fblk->blkno,
fblk->index, fblk->index,
fblk->magic); fblk->magic);
} else { } else {
cmn_err(CE_ALERT, xfs_alert(mp, " ... fblk is NULL");
" ... fblk is NULL\n");
} }
XFS_ERROR_REPORT("xfs_dir2_node_addname_int", XFS_ERROR_REPORT("xfs_dir2_node_addname_int",
XFS_ERRLEVEL_LOW, mp); XFS_ERRLEVEL_LOW, mp);
......
...@@ -48,7 +48,7 @@ xfs_error_trap(int e) ...@@ -48,7 +48,7 @@ xfs_error_trap(int e)
break; break;
if (e != xfs_etrap[i]) if (e != xfs_etrap[i])
continue; continue;
cmn_err(CE_NOTE, "xfs_error_trap: error %d", e); xfs_notice(NULL, "%s: error %d", __func__, e);
BUG(); BUG();
break; break;
} }
...@@ -74,7 +74,7 @@ xfs_error_test(int error_tag, int *fsidp, char *expression, ...@@ -74,7 +74,7 @@ xfs_error_test(int error_tag, int *fsidp, char *expression,
for (i = 0; i < XFS_NUM_INJECT_ERROR; i++) { for (i = 0; i < XFS_NUM_INJECT_ERROR; i++) {
if (xfs_etest[i] == error_tag && xfs_etest_fsid[i] == fsid) { if (xfs_etest[i] == error_tag && xfs_etest_fsid[i] == fsid) {
cmn_err(CE_WARN, xfs_warn(NULL,
"Injecting error (%s) at file %s, line %d, on filesystem \"%s\"", "Injecting error (%s) at file %s, line %d, on filesystem \"%s\"",
expression, file, line, xfs_etest_fsname[i]); expression, file, line, xfs_etest_fsname[i]);
return 1; return 1;
...@@ -95,14 +95,14 @@ xfs_errortag_add(int error_tag, xfs_mount_t *mp) ...@@ -95,14 +95,14 @@ xfs_errortag_add(int error_tag, xfs_mount_t *mp)
for (i = 0; i < XFS_NUM_INJECT_ERROR; i++) { for (i = 0; i < XFS_NUM_INJECT_ERROR; i++) {
if (xfs_etest_fsid[i] == fsid && xfs_etest[i] == error_tag) { if (xfs_etest_fsid[i] == fsid && xfs_etest[i] == error_tag) {
cmn_err(CE_WARN, "XFS error tag #%d on", error_tag); xfs_warn(mp, "error tag #%d on", error_tag);
return 0; return 0;
} }
} }
for (i = 0; i < XFS_NUM_INJECT_ERROR; i++) { for (i = 0; i < XFS_NUM_INJECT_ERROR; i++) {
if (xfs_etest[i] == 0) { if (xfs_etest[i] == 0) {
cmn_err(CE_WARN, "Turned on XFS error tag #%d", xfs_warn(mp, "Turned on XFS error tag #%d",
error_tag); error_tag);
xfs_etest[i] = error_tag; xfs_etest[i] = error_tag;
xfs_etest_fsid[i] = fsid; xfs_etest_fsid[i] = fsid;
...@@ -114,7 +114,7 @@ xfs_errortag_add(int error_tag, xfs_mount_t *mp) ...@@ -114,7 +114,7 @@ xfs_errortag_add(int error_tag, xfs_mount_t *mp)
} }
} }
cmn_err(CE_WARN, "error tag overflow, too many turned on"); xfs_warn(mp, "error tag overflow, too many turned on");
return 1; return 1;
} }
...@@ -133,7 +133,7 @@ xfs_errortag_clearall(xfs_mount_t *mp, int loud) ...@@ -133,7 +133,7 @@ xfs_errortag_clearall(xfs_mount_t *mp, int loud)
if ((fsid == 0LL || xfs_etest_fsid[i] == fsid) && if ((fsid == 0LL || xfs_etest_fsid[i] == fsid) &&
xfs_etest[i] != 0) { xfs_etest[i] != 0) {
cleared = 1; cleared = 1;
cmn_err(CE_WARN, "Clearing XFS error tag #%d", xfs_warn(mp, "Clearing XFS error tag #%d",
xfs_etest[i]); xfs_etest[i]);
xfs_etest[i] = 0; xfs_etest[i] = 0;
xfs_etest_fsid[i] = 0LL; xfs_etest_fsid[i] = 0LL;
...@@ -144,9 +144,7 @@ xfs_errortag_clearall(xfs_mount_t *mp, int loud) ...@@ -144,9 +144,7 @@ xfs_errortag_clearall(xfs_mount_t *mp, int loud)
} }
if (loud || cleared) if (loud || cleared)
cmn_err(CE_WARN, xfs_warn(mp, "Cleared all XFS error tags for filesystem");
"Cleared all XFS error tags for filesystem \"%s\"",
mp->m_fsname);
return 0; return 0;
} }
...@@ -162,9 +160,8 @@ xfs_error_report( ...@@ -162,9 +160,8 @@ xfs_error_report(
inst_t *ra) inst_t *ra)
{ {
if (level <= xfs_error_level) { if (level <= xfs_error_level) {
xfs_cmn_err(XFS_PTAG_ERROR_REPORT, xfs_alert_tag(mp, XFS_PTAG_ERROR_REPORT,
CE_ALERT, mp, "Internal error %s at line %d of file %s. Caller 0x%p\n",
"XFS internal error %s at line %d of file %s. Caller 0x%p\n",
tag, linenum, filename, ra); tag, linenum, filename, ra);
xfs_stack_trace(); xfs_stack_trace();
...@@ -184,4 +181,5 @@ xfs_corruption_error( ...@@ -184,4 +181,5 @@ xfs_corruption_error(
if (level <= xfs_error_level) if (level <= xfs_error_level)
xfs_hex_dump(p, 16); xfs_hex_dump(p, 16);
xfs_error_report(tag, level, mp, filename, linenum, ra); xfs_error_report(tag, level, mp, filename, linenum, ra);
xfs_alert(mp, "Corruption detected. Unmount and run xfs_repair");
} }
...@@ -145,10 +145,8 @@ extern int xfs_errortag_clearall(struct xfs_mount *mp, int loud); ...@@ -145,10 +145,8 @@ extern int xfs_errortag_clearall(struct xfs_mount *mp, int loud);
#endif /* DEBUG */ #endif /* DEBUG */
/* /*
* XFS panic tags -- allow a call to xfs_cmn_err() be turned into * XFS panic tags -- allow a call to xfs_alert_tag() be turned into
* a panic by setting xfs_panic_mask in a * a panic by setting xfs_panic_mask in a sysctl.
* sysctl. update xfs_max[XFS_PARAM] if
* more are added.
*/ */
#define XFS_NO_PTAG 0 #define XFS_NO_PTAG 0
#define XFS_PTAG_IFLUSH 0x00000001 #define XFS_PTAG_IFLUSH 0x00000001
...@@ -160,17 +158,4 @@ extern int xfs_errortag_clearall(struct xfs_mount *mp, int loud); ...@@ -160,17 +158,4 @@ extern int xfs_errortag_clearall(struct xfs_mount *mp, int loud);
#define XFS_PTAG_SHUTDOWN_LOGERROR 0x00000040 #define XFS_PTAG_SHUTDOWN_LOGERROR 0x00000040
#define XFS_PTAG_FSBLOCK_ZERO 0x00000080 #define XFS_PTAG_FSBLOCK_ZERO 0x00000080
struct xfs_mount;
extern void xfs_hex_dump(void *p, int length);
#define xfs_fs_repair_cmn_err(level, mp, fmt, args...) \
xfs_fs_cmn_err(level, mp, fmt " Unmount and run xfs_repair.", ## args)
#define xfs_fs_mount_cmn_err(f, fmt, args...) \
do { \
if (!(f & XFS_MFSI_QUIET)) \
cmn_err(CE_WARN, "XFS: " fmt, ## args); \
} while (0)
#endif /* __XFS_ERROR_H__ */ #endif /* __XFS_ERROR_H__ */
...@@ -385,8 +385,8 @@ xfs_growfs_data_private( ...@@ -385,8 +385,8 @@ xfs_growfs_data_private(
XFS_AGB_TO_DADDR(mp, agno, XFS_SB_BLOCK(mp)), XFS_AGB_TO_DADDR(mp, agno, XFS_SB_BLOCK(mp)),
XFS_FSS_TO_BB(mp, 1), 0, &bp); XFS_FSS_TO_BB(mp, 1), 0, &bp);
if (error) { if (error) {
xfs_fs_cmn_err(CE_WARN, mp, xfs_warn(mp,
"error %d reading secondary superblock for ag %d", "error %d reading secondary superblock for ag %d",
error, agno); error, agno);
break; break;
} }
...@@ -399,7 +399,7 @@ xfs_growfs_data_private( ...@@ -399,7 +399,7 @@ xfs_growfs_data_private(
if (!(error = xfs_bwrite(mp, bp))) { if (!(error = xfs_bwrite(mp, bp))) {
continue; continue;
} else { } else {
xfs_fs_cmn_err(CE_WARN, mp, xfs_warn(mp,
"write error %d updating secondary superblock for ag %d", "write error %d updating secondary superblock for ag %d",
error, agno); error, agno);
break; /* no point in continuing */ break; /* no point in continuing */
......
...@@ -1055,28 +1055,23 @@ xfs_difree( ...@@ -1055,28 +1055,23 @@ xfs_difree(
*/ */
agno = XFS_INO_TO_AGNO(mp, inode); agno = XFS_INO_TO_AGNO(mp, inode);
if (agno >= mp->m_sb.sb_agcount) { if (agno >= mp->m_sb.sb_agcount) {
cmn_err(CE_WARN, xfs_warn(mp, "%s: agno >= mp->m_sb.sb_agcount (%d >= %d).",
"xfs_difree: agno >= mp->m_sb.sb_agcount (%d >= %d) on %s. Returning EINVAL.", __func__, agno, mp->m_sb.sb_agcount);
agno, mp->m_sb.sb_agcount, mp->m_fsname);
ASSERT(0); ASSERT(0);
return XFS_ERROR(EINVAL); return XFS_ERROR(EINVAL);
} }
agino = XFS_INO_TO_AGINO(mp, inode); agino = XFS_INO_TO_AGINO(mp, inode);
if (inode != XFS_AGINO_TO_INO(mp, agno, agino)) { if (inode != XFS_AGINO_TO_INO(mp, agno, agino)) {
cmn_err(CE_WARN, xfs_warn(mp, "%s: inode != XFS_AGINO_TO_INO() (%llu != %llu).",
"xfs_difree: inode != XFS_AGINO_TO_INO() " __func__, (unsigned long long)inode,
"(%llu != %llu) on %s. Returning EINVAL.", (unsigned long long)XFS_AGINO_TO_INO(mp, agno, agino));
(unsigned long long)inode,
(unsigned long long)XFS_AGINO_TO_INO(mp, agno, agino),
mp->m_fsname);
ASSERT(0); ASSERT(0);
return XFS_ERROR(EINVAL); return XFS_ERROR(EINVAL);
} }
agbno = XFS_AGINO_TO_AGBNO(mp, agino); agbno = XFS_AGINO_TO_AGBNO(mp, agino);
if (agbno >= mp->m_sb.sb_agblocks) { if (agbno >= mp->m_sb.sb_agblocks) {
cmn_err(CE_WARN, xfs_warn(mp, "%s: agbno >= mp->m_sb.sb_agblocks (%d >= %d).",
"xfs_difree: agbno >= mp->m_sb.sb_agblocks (%d >= %d) on %s. Returning EINVAL.", __func__, agbno, mp->m_sb.sb_agblocks);
agbno, mp->m_sb.sb_agblocks, mp->m_fsname);
ASSERT(0); ASSERT(0);
return XFS_ERROR(EINVAL); return XFS_ERROR(EINVAL);
} }
...@@ -1085,9 +1080,8 @@ xfs_difree( ...@@ -1085,9 +1080,8 @@ xfs_difree(
*/ */
error = xfs_ialloc_read_agi(mp, tp, agno, &agbp); error = xfs_ialloc_read_agi(mp, tp, agno, &agbp);
if (error) { if (error) {
cmn_err(CE_WARN, xfs_warn(mp, "%s: xfs_ialloc_read_agi() returned error %d.",
"xfs_difree: xfs_ialloc_read_agi() returned an error %d on %s. Returning error.", __func__, error);
error, mp->m_fsname);
return error; return error;
} }
agi = XFS_BUF_TO_AGI(agbp); agi = XFS_BUF_TO_AGI(agbp);
...@@ -1106,17 +1100,15 @@ xfs_difree( ...@@ -1106,17 +1100,15 @@ xfs_difree(
* Look for the entry describing this inode. * Look for the entry describing this inode.
*/ */
if ((error = xfs_inobt_lookup(cur, agino, XFS_LOOKUP_LE, &i))) { if ((error = xfs_inobt_lookup(cur, agino, XFS_LOOKUP_LE, &i))) {
cmn_err(CE_WARN, xfs_warn(mp, "%s: xfs_inobt_lookup() returned error %d.",
"xfs_difree: xfs_inobt_lookup returned() an error %d on %s. Returning error.", __func__, error);
error, mp->m_fsname);
goto error0; goto error0;
} }
XFS_WANT_CORRUPTED_GOTO(i == 1, error0); XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
error = xfs_inobt_get_rec(cur, &rec, &i); error = xfs_inobt_get_rec(cur, &rec, &i);
if (error) { if (error) {
cmn_err(CE_WARN, xfs_warn(mp, "%s: xfs_inobt_get_rec() returned error %d.",
"xfs_difree: xfs_inobt_get_rec() returned an error %d on %s. Returning error.", __func__, error);
error, mp->m_fsname);
goto error0; goto error0;
} }
XFS_WANT_CORRUPTED_GOTO(i == 1, error0); XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
...@@ -1157,8 +1149,8 @@ xfs_difree( ...@@ -1157,8 +1149,8 @@ xfs_difree(
xfs_trans_mod_sb(tp, XFS_TRANS_SB_IFREE, -(ilen - 1)); xfs_trans_mod_sb(tp, XFS_TRANS_SB_IFREE, -(ilen - 1));
if ((error = xfs_btree_delete(cur, &i))) { if ((error = xfs_btree_delete(cur, &i))) {
cmn_err(CE_WARN, "xfs_difree: xfs_btree_delete returned an error %d on %s.\n", xfs_warn(mp, "%s: xfs_btree_delete returned error %d.",
error, mp->m_fsname); __func__, error);
goto error0; goto error0;
} }
...@@ -1170,9 +1162,8 @@ xfs_difree( ...@@ -1170,9 +1162,8 @@ xfs_difree(
error = xfs_inobt_update(cur, &rec); error = xfs_inobt_update(cur, &rec);
if (error) { if (error) {
cmn_err(CE_WARN, xfs_warn(mp, "%s: xfs_inobt_update returned error %d.",
"xfs_difree: xfs_inobt_update returned an error %d on %s.", __func__, error);
error, mp->m_fsname);
goto error0; goto error0;
} }
...@@ -1218,10 +1209,9 @@ xfs_imap_lookup( ...@@ -1218,10 +1209,9 @@ xfs_imap_lookup(
error = xfs_ialloc_read_agi(mp, tp, agno, &agbp); error = xfs_ialloc_read_agi(mp, tp, agno, &agbp);
if (error) { if (error) {
xfs_fs_cmn_err(CE_ALERT, mp, "xfs_imap: " xfs_alert(mp,
"xfs_ialloc_read_agi() returned " "%s: xfs_ialloc_read_agi() returned error %d, agno %d",
"error %d, agno %d", __func__, error, agno);
error, agno);
return error; return error;
} }
...@@ -1299,24 +1289,21 @@ xfs_imap( ...@@ -1299,24 +1289,21 @@ xfs_imap(
if (flags & XFS_IGET_UNTRUSTED) if (flags & XFS_IGET_UNTRUSTED)
return XFS_ERROR(EINVAL); return XFS_ERROR(EINVAL);
if (agno >= mp->m_sb.sb_agcount) { if (agno >= mp->m_sb.sb_agcount) {
xfs_fs_cmn_err(CE_ALERT, mp, xfs_alert(mp,
"xfs_imap: agno (%d) >= " "%s: agno (%d) >= mp->m_sb.sb_agcount (%d)",
"mp->m_sb.sb_agcount (%d)", __func__, agno, mp->m_sb.sb_agcount);
agno, mp->m_sb.sb_agcount);
} }
if (agbno >= mp->m_sb.sb_agblocks) { if (agbno >= mp->m_sb.sb_agblocks) {
xfs_fs_cmn_err(CE_ALERT, mp, xfs_alert(mp,
"xfs_imap: agbno (0x%llx) >= " "%s: agbno (0x%llx) >= mp->m_sb.sb_agblocks (0x%lx)",
"mp->m_sb.sb_agblocks (0x%lx)", __func__, (unsigned long long)agbno,
(unsigned long long) agbno, (unsigned long)mp->m_sb.sb_agblocks);
(unsigned long) mp->m_sb.sb_agblocks);
} }
if (ino != XFS_AGINO_TO_INO(mp, agno, agino)) { if (ino != XFS_AGINO_TO_INO(mp, agno, agino)) {
xfs_fs_cmn_err(CE_ALERT, mp, xfs_alert(mp,
"xfs_imap: ino (0x%llx) != " "%s: ino (0x%llx) != XFS_AGINO_TO_INO() (0x%llx)",
"XFS_AGINO_TO_INO(mp, agno, agino) " __func__, ino,
"(0x%llx)", XFS_AGINO_TO_INO(mp, agno, agino));
ino, XFS_AGINO_TO_INO(mp, agno, agino));
} }
xfs_stack_trace(); xfs_stack_trace();
#endif /* DEBUG */ #endif /* DEBUG */
...@@ -1388,10 +1375,9 @@ xfs_imap( ...@@ -1388,10 +1375,9 @@ xfs_imap(
*/ */
if ((imap->im_blkno + imap->im_len) > if ((imap->im_blkno + imap->im_len) >
XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks)) { XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks)) {
xfs_fs_cmn_err(CE_ALERT, mp, "xfs_imap: " xfs_alert(mp,
"(imap->im_blkno (0x%llx) + imap->im_len (0x%llx)) > " "%s: (im_blkno (0x%llx) + im_len (0x%llx)) > sb_dblocks (0x%llx)",
" XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks) (0x%llx)", __func__, (unsigned long long) imap->im_blkno,
(unsigned long long) imap->im_blkno,
(unsigned long long) imap->im_len, (unsigned long long) imap->im_len,
XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks)); XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks));
return XFS_ERROR(EINVAL); return XFS_ERROR(EINVAL);
......
This diff is collapsed.
...@@ -409,28 +409,35 @@ static inline void xfs_ifunlock(xfs_inode_t *ip) ...@@ -409,28 +409,35 @@ static inline void xfs_ifunlock(xfs_inode_t *ip)
/* /*
* Flags for lockdep annotations. * Flags for lockdep annotations.
* *
* XFS_I[O]LOCK_PARENT - for operations that require locking two inodes * XFS_LOCK_PARENT - for directory operations that require locking a
* (ie directory operations that require locking a directory inode and * parent directory inode and a child entry inode. The parent gets locked
* an entry inode). The first inode gets locked with this flag so it * with this flag so it gets a lockdep subclass of 1 and the child entry
* gets a lockdep subclass of 1 and the second lock will have a lockdep * lock will have a lockdep subclass of 0.
* subclass of 0. *
* XFS_LOCK_RTBITMAP/XFS_LOCK_RTSUM - the realtime device bitmap and summary
* inodes do not participate in the normal lock order, and thus have their
* own subclasses.
* *
* XFS_LOCK_INUMORDER - for locking several inodes at the some time * XFS_LOCK_INUMORDER - for locking several inodes at the some time
* with xfs_lock_inodes(). This flag is used as the starting subclass * with xfs_lock_inodes(). This flag is used as the starting subclass
* and each subsequent lock acquired will increment the subclass by one. * and each subsequent lock acquired will increment the subclass by one.
* So the first lock acquired will have a lockdep subclass of 2, the * So the first lock acquired will have a lockdep subclass of 4, the
* second lock will have a lockdep subclass of 3, and so on. It is * second lock will have a lockdep subclass of 5, and so on. It is
* the responsibility of the class builder to shift this to the correct * the responsibility of the class builder to shift this to the correct
* portion of the lock_mode lockdep mask. * portion of the lock_mode lockdep mask.
*/ */
#define XFS_LOCK_PARENT 1 #define XFS_LOCK_PARENT 1
#define XFS_LOCK_INUMORDER 2 #define XFS_LOCK_RTBITMAP 2
#define XFS_LOCK_RTSUM 3
#define XFS_LOCK_INUMORDER 4
#define XFS_IOLOCK_SHIFT 16 #define XFS_IOLOCK_SHIFT 16
#define XFS_IOLOCK_PARENT (XFS_LOCK_PARENT << XFS_IOLOCK_SHIFT) #define XFS_IOLOCK_PARENT (XFS_LOCK_PARENT << XFS_IOLOCK_SHIFT)
#define XFS_ILOCK_SHIFT 24 #define XFS_ILOCK_SHIFT 24
#define XFS_ILOCK_PARENT (XFS_LOCK_PARENT << XFS_ILOCK_SHIFT) #define XFS_ILOCK_PARENT (XFS_LOCK_PARENT << XFS_ILOCK_SHIFT)
#define XFS_ILOCK_RTBITMAP (XFS_LOCK_RTBITMAP << XFS_ILOCK_SHIFT)
#define XFS_ILOCK_RTSUM (XFS_LOCK_RTSUM << XFS_ILOCK_SHIFT)
#define XFS_IOLOCK_DEP_MASK 0x00ff0000 #define XFS_IOLOCK_DEP_MASK 0x00ff0000
#define XFS_ILOCK_DEP_MASK 0xff000000 #define XFS_ILOCK_DEP_MASK 0xff000000
......
...@@ -101,11 +101,11 @@ xfs_iomap_eof_align_last_fsb( ...@@ -101,11 +101,11 @@ xfs_iomap_eof_align_last_fsb(
} }
STATIC int STATIC int
xfs_cmn_err_fsblock_zero( xfs_alert_fsblock_zero(
xfs_inode_t *ip, xfs_inode_t *ip,
xfs_bmbt_irec_t *imap) xfs_bmbt_irec_t *imap)
{ {
xfs_cmn_err(XFS_PTAG_FSBLOCK_ZERO, CE_ALERT, ip->i_mount, xfs_alert_tag(ip->i_mount, XFS_PTAG_FSBLOCK_ZERO,
"Access to block zero in inode %llu " "Access to block zero in inode %llu "
"start_block: %llx start_off: %llx " "start_block: %llx start_off: %llx "
"blkcnt: %llx extent-state: %x\n", "blkcnt: %llx extent-state: %x\n",
...@@ -246,7 +246,7 @@ xfs_iomap_write_direct( ...@@ -246,7 +246,7 @@ xfs_iomap_write_direct(
} }
if (!(imap->br_startblock || XFS_IS_REALTIME_INODE(ip))) { if (!(imap->br_startblock || XFS_IS_REALTIME_INODE(ip))) {
error = xfs_cmn_err_fsblock_zero(ip, imap); error = xfs_alert_fsblock_zero(ip, imap);
goto error_out; goto error_out;
} }
...@@ -464,7 +464,7 @@ xfs_iomap_write_delay( ...@@ -464,7 +464,7 @@ xfs_iomap_write_delay(
} }
if (!(imap[0].br_startblock || XFS_IS_REALTIME_INODE(ip))) if (!(imap[0].br_startblock || XFS_IS_REALTIME_INODE(ip)))
return xfs_cmn_err_fsblock_zero(ip, &imap[0]); return xfs_alert_fsblock_zero(ip, &imap[0]);
*ret_imap = imap[0]; *ret_imap = imap[0];
return 0; return 0;
...@@ -614,7 +614,7 @@ xfs_iomap_write_allocate( ...@@ -614,7 +614,7 @@ xfs_iomap_write_allocate(
* covers at least part of the callers request * covers at least part of the callers request
*/ */
if (!(imap->br_startblock || XFS_IS_REALTIME_INODE(ip))) if (!(imap->br_startblock || XFS_IS_REALTIME_INODE(ip)))
return xfs_cmn_err_fsblock_zero(ip, imap); return xfs_alert_fsblock_zero(ip, imap);
if ((offset_fsb >= imap->br_startoff) && if ((offset_fsb >= imap->br_startoff) &&
(offset_fsb < (imap->br_startoff + (offset_fsb < (imap->br_startoff +
...@@ -724,7 +724,7 @@ xfs_iomap_write_unwritten( ...@@ -724,7 +724,7 @@ xfs_iomap_write_unwritten(
return XFS_ERROR(error); return XFS_ERROR(error);
if (!(imap.br_startblock || XFS_IS_REALTIME_INODE(ip))) if (!(imap.br_startblock || XFS_IS_REALTIME_INODE(ip)))
return xfs_cmn_err_fsblock_zero(ip, &imap); return xfs_alert_fsblock_zero(ip, &imap);
if ((numblks_fsb = imap.br_blockcount) == 0) { if ((numblks_fsb = imap.br_blockcount) == 0) {
/* /*
......
...@@ -374,11 +374,10 @@ xfs_log_mount( ...@@ -374,11 +374,10 @@ xfs_log_mount(
int error; int error;
if (!(mp->m_flags & XFS_MOUNT_NORECOVERY)) if (!(mp->m_flags & XFS_MOUNT_NORECOVERY))
cmn_err(CE_NOTE, "XFS mounting filesystem %s", mp->m_fsname); xfs_notice(mp, "Mounting Filesystem");
else { else {
cmn_err(CE_NOTE, xfs_notice(mp,
"Mounting filesystem \"%s\" in no-recovery mode. Filesystem will be inconsistent.", "Mounting filesystem in no-recovery mode. Filesystem will be inconsistent.");
mp->m_fsname);
ASSERT(mp->m_flags & XFS_MOUNT_RDONLY); ASSERT(mp->m_flags & XFS_MOUNT_RDONLY);
} }
...@@ -393,7 +392,7 @@ xfs_log_mount( ...@@ -393,7 +392,7 @@ xfs_log_mount(
*/ */
error = xfs_trans_ail_init(mp); error = xfs_trans_ail_init(mp);
if (error) { if (error) {
cmn_err(CE_WARN, "XFS: AIL initialisation failed: error %d", error); xfs_warn(mp, "AIL initialisation failed: error %d", error);
goto out_free_log; goto out_free_log;
} }
mp->m_log->l_ailp = mp->m_ail; mp->m_log->l_ailp = mp->m_ail;
...@@ -413,7 +412,8 @@ xfs_log_mount( ...@@ -413,7 +412,8 @@ xfs_log_mount(
if (readonly) if (readonly)
mp->m_flags |= XFS_MOUNT_RDONLY; mp->m_flags |= XFS_MOUNT_RDONLY;
if (error) { if (error) {
cmn_err(CE_WARN, "XFS: log mount/recovery failed: error %d", error); xfs_warn(mp, "log mount/recovery failed: error %d",
error);
goto out_destroy_ail; goto out_destroy_ail;
} }
} }
...@@ -542,10 +542,8 @@ xfs_log_unmount_write(xfs_mount_t *mp) ...@@ -542,10 +542,8 @@ xfs_log_unmount_write(xfs_mount_t *mp)
*/ */
} }
if (error) { if (error)
xfs_fs_cmn_err(CE_ALERT, mp, xfs_alert(mp, "%s: unmount record failed", __func__);
"xfs_log_unmount: unmount record failed");
}
spin_lock(&log->l_icloglock); spin_lock(&log->l_icloglock);
...@@ -852,7 +850,7 @@ xlog_space_left( ...@@ -852,7 +850,7 @@ xlog_space_left(
* In this case we just want to return the size of the * In this case we just want to return the size of the
* log as the amount of space left. * log as the amount of space left.
*/ */
xfs_fs_cmn_err(CE_ALERT, log->l_mp, xfs_alert(log->l_mp,
"xlog_space_left: head behind tail\n" "xlog_space_left: head behind tail\n"
" tail_cycle = %d, tail_bytes = %d\n" " tail_cycle = %d, tail_bytes = %d\n"
" GH cycle = %d, GH bytes = %d", " GH cycle = %d, GH bytes = %d",
...@@ -1001,7 +999,7 @@ xlog_alloc_log(xfs_mount_t *mp, ...@@ -1001,7 +999,7 @@ xlog_alloc_log(xfs_mount_t *mp,
log = kmem_zalloc(sizeof(xlog_t), KM_MAYFAIL); log = kmem_zalloc(sizeof(xlog_t), KM_MAYFAIL);
if (!log) { if (!log) {
xlog_warn("XFS: Log allocation failed: No memory!"); xfs_warn(mp, "Log allocation failed: No memory!");
goto out; goto out;
} }
...@@ -1029,24 +1027,24 @@ xlog_alloc_log(xfs_mount_t *mp, ...@@ -1029,24 +1027,24 @@ xlog_alloc_log(xfs_mount_t *mp,
if (xfs_sb_version_hassector(&mp->m_sb)) { if (xfs_sb_version_hassector(&mp->m_sb)) {
log2_size = mp->m_sb.sb_logsectlog; log2_size = mp->m_sb.sb_logsectlog;
if (log2_size < BBSHIFT) { if (log2_size < BBSHIFT) {
xlog_warn("XFS: Log sector size too small " xfs_warn(mp, "Log sector size too small (0x%x < 0x%x)",
"(0x%x < 0x%x)", log2_size, BBSHIFT); log2_size, BBSHIFT);
goto out_free_log; goto out_free_log;
} }
log2_size -= BBSHIFT; log2_size -= BBSHIFT;
if (log2_size > mp->m_sectbb_log) { if (log2_size > mp->m_sectbb_log) {
xlog_warn("XFS: Log sector size too large " xfs_warn(mp, "Log sector size too large (0x%x > 0x%x)",
"(0x%x > 0x%x)", log2_size, mp->m_sectbb_log); log2_size, mp->m_sectbb_log);
goto out_free_log; goto out_free_log;
} }
/* for larger sector sizes, must have v2 or external log */ /* for larger sector sizes, must have v2 or external log */
if (log2_size && log->l_logBBstart > 0 && if (log2_size && log->l_logBBstart > 0 &&
!xfs_sb_version_haslogv2(&mp->m_sb)) { !xfs_sb_version_haslogv2(&mp->m_sb)) {
xfs_warn(mp,
xlog_warn("XFS: log sector size (0x%x) invalid " "log sector size (0x%x) invalid for configuration.",
"for configuration.", log2_size); log2_size);
goto out_free_log; goto out_free_log;
} }
} }
...@@ -1563,38 +1561,36 @@ xlog_print_tic_res( ...@@ -1563,38 +1561,36 @@ xlog_print_tic_res(
"SWAPEXT" "SWAPEXT"
}; };
xfs_fs_cmn_err(CE_WARN, mp, xfs_warn(mp,
"xfs_log_write: reservation summary:\n" "xfs_log_write: reservation summary:\n"
" trans type = %s (%u)\n" " trans type = %s (%u)\n"
" unit res = %d bytes\n" " unit res = %d bytes\n"
" current res = %d bytes\n" " current res = %d bytes\n"
" total reg = %u bytes (o/flow = %u bytes)\n" " total reg = %u bytes (o/flow = %u bytes)\n"
" ophdrs = %u (ophdr space = %u bytes)\n" " ophdrs = %u (ophdr space = %u bytes)\n"
" ophdr + reg = %u bytes\n" " ophdr + reg = %u bytes\n"
" num regions = %u\n", " num regions = %u\n",
((ticket->t_trans_type <= 0 || ((ticket->t_trans_type <= 0 ||
ticket->t_trans_type > XFS_TRANS_TYPE_MAX) ? ticket->t_trans_type > XFS_TRANS_TYPE_MAX) ?
"bad-trans-type" : trans_type_str[ticket->t_trans_type-1]), "bad-trans-type" : trans_type_str[ticket->t_trans_type-1]),
ticket->t_trans_type, ticket->t_trans_type,
ticket->t_unit_res, ticket->t_unit_res,
ticket->t_curr_res, ticket->t_curr_res,
ticket->t_res_arr_sum, ticket->t_res_o_flow, ticket->t_res_arr_sum, ticket->t_res_o_flow,
ticket->t_res_num_ophdrs, ophdr_spc, ticket->t_res_num_ophdrs, ophdr_spc,
ticket->t_res_arr_sum + ticket->t_res_arr_sum +
ticket->t_res_o_flow + ophdr_spc, ticket->t_res_o_flow + ophdr_spc,
ticket->t_res_num); ticket->t_res_num);
for (i = 0; i < ticket->t_res_num; i++) { for (i = 0; i < ticket->t_res_num; i++) {
uint r_type = ticket->t_res_arr[i].r_type; uint r_type = ticket->t_res_arr[i].r_type;
cmn_err(CE_WARN, xfs_warn(mp, "region[%u]: %s - %u bytes\n", i,
"region[%u]: %s - %u bytes\n",
i,
((r_type <= 0 || r_type > XLOG_REG_TYPE_MAX) ? ((r_type <= 0 || r_type > XLOG_REG_TYPE_MAX) ?
"bad-rtype" : res_type_str[r_type-1]), "bad-rtype" : res_type_str[r_type-1]),
ticket->t_res_arr[i].r_len); ticket->t_res_arr[i].r_len);
} }
xfs_cmn_err(XFS_PTAG_LOGRES, CE_ALERT, mp, xfs_alert_tag(mp, XFS_PTAG_LOGRES,
"xfs_log_write: reservation ran out. Need to up reservation"); "xfs_log_write: reservation ran out. Need to up reservation");
xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE); xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE);
} }
...@@ -1682,7 +1678,7 @@ xlog_write_setup_ophdr( ...@@ -1682,7 +1678,7 @@ xlog_write_setup_ophdr(
case XFS_LOG: case XFS_LOG:
break; break;
default: default:
xfs_fs_cmn_err(CE_WARN, log->l_mp, xfs_warn(log->l_mp,
"Bad XFS transaction clientid 0x%x in ticket 0x%p", "Bad XFS transaction clientid 0x%x in ticket 0x%p",
ophdr->oh_clientid, ticket); ophdr->oh_clientid, ticket);
return NULL; return NULL;
...@@ -2264,7 +2260,7 @@ xlog_state_do_callback( ...@@ -2264,7 +2260,7 @@ xlog_state_do_callback(
if (repeats > 5000) { if (repeats > 5000) {
flushcnt += repeats; flushcnt += repeats;
repeats = 0; repeats = 0;
xfs_fs_cmn_err(CE_WARN, log->l_mp, xfs_warn(log->l_mp,
"%s: possible infinite loop (%d iterations)", "%s: possible infinite loop (%d iterations)",
__func__, flushcnt); __func__, flushcnt);
} }
...@@ -3052,10 +3048,8 @@ xfs_log_force( ...@@ -3052,10 +3048,8 @@ xfs_log_force(
int error; int error;
error = _xfs_log_force(mp, flags, NULL); error = _xfs_log_force(mp, flags, NULL);
if (error) { if (error)
xfs_fs_cmn_err(CE_WARN, mp, "xfs_log_force: " xfs_warn(mp, "%s: error %d returned.", __func__, error);
"error %d returned.", error);
}
} }
/* /*
...@@ -3204,10 +3198,8 @@ xfs_log_force_lsn( ...@@ -3204,10 +3198,8 @@ xfs_log_force_lsn(
int error; int error;
error = _xfs_log_force_lsn(mp, lsn, flags, NULL); error = _xfs_log_force_lsn(mp, lsn, flags, NULL);
if (error) { if (error)
xfs_fs_cmn_err(CE_WARN, mp, "xfs_log_force: " xfs_warn(mp, "%s: error %d returned.", __func__, error);
"error %d returned.", error);
}
} }
/* /*
...@@ -3412,7 +3404,7 @@ xlog_verify_dest_ptr( ...@@ -3412,7 +3404,7 @@ xlog_verify_dest_ptr(
} }
if (!good_ptr) if (!good_ptr)
xlog_panic("xlog_verify_dest_ptr: invalid ptr"); xfs_emerg(log->l_mp, "%s: invalid ptr", __func__);
} }
STATIC void STATIC void
...@@ -3448,16 +3440,16 @@ xlog_verify_tail_lsn(xlog_t *log, ...@@ -3448,16 +3440,16 @@ xlog_verify_tail_lsn(xlog_t *log,
blocks = blocks =
log->l_logBBsize - (log->l_prev_block - BLOCK_LSN(tail_lsn)); log->l_logBBsize - (log->l_prev_block - BLOCK_LSN(tail_lsn));
if (blocks < BTOBB(iclog->ic_offset)+BTOBB(log->l_iclog_hsize)) if (blocks < BTOBB(iclog->ic_offset)+BTOBB(log->l_iclog_hsize))
xlog_panic("xlog_verify_tail_lsn: ran out of log space"); xfs_emerg(log->l_mp, "%s: ran out of log space", __func__);
} else { } else {
ASSERT(CYCLE_LSN(tail_lsn)+1 == log->l_prev_cycle); ASSERT(CYCLE_LSN(tail_lsn)+1 == log->l_prev_cycle);
if (BLOCK_LSN(tail_lsn) == log->l_prev_block) if (BLOCK_LSN(tail_lsn) == log->l_prev_block)
xlog_panic("xlog_verify_tail_lsn: tail wrapped"); xfs_emerg(log->l_mp, "%s: tail wrapped", __func__);
blocks = BLOCK_LSN(tail_lsn) - log->l_prev_block; blocks = BLOCK_LSN(tail_lsn) - log->l_prev_block;
if (blocks < BTOBB(iclog->ic_offset) + 1) if (blocks < BTOBB(iclog->ic_offset) + 1)
xlog_panic("xlog_verify_tail_lsn: ran out of log space"); xfs_emerg(log->l_mp, "%s: ran out of log space", __func__);
} }
} /* xlog_verify_tail_lsn */ } /* xlog_verify_tail_lsn */
...@@ -3497,22 +3489,23 @@ xlog_verify_iclog(xlog_t *log, ...@@ -3497,22 +3489,23 @@ xlog_verify_iclog(xlog_t *log,
icptr = log->l_iclog; icptr = log->l_iclog;
for (i=0; i < log->l_iclog_bufs; i++) { for (i=0; i < log->l_iclog_bufs; i++) {
if (icptr == NULL) if (icptr == NULL)
xlog_panic("xlog_verify_iclog: invalid ptr"); xfs_emerg(log->l_mp, "%s: invalid ptr", __func__);
icptr = icptr->ic_next; icptr = icptr->ic_next;
} }
if (icptr != log->l_iclog) if (icptr != log->l_iclog)
xlog_panic("xlog_verify_iclog: corrupt iclog ring"); xfs_emerg(log->l_mp, "%s: corrupt iclog ring", __func__);
spin_unlock(&log->l_icloglock); spin_unlock(&log->l_icloglock);
/* check log magic numbers */ /* check log magic numbers */
if (be32_to_cpu(iclog->ic_header.h_magicno) != XLOG_HEADER_MAGIC_NUM) if (be32_to_cpu(iclog->ic_header.h_magicno) != XLOG_HEADER_MAGIC_NUM)
xlog_panic("xlog_verify_iclog: invalid magic num"); xfs_emerg(log->l_mp, "%s: invalid magic num", __func__);
ptr = (xfs_caddr_t) &iclog->ic_header; ptr = (xfs_caddr_t) &iclog->ic_header;
for (ptr += BBSIZE; ptr < ((xfs_caddr_t)&iclog->ic_header) + count; for (ptr += BBSIZE; ptr < ((xfs_caddr_t)&iclog->ic_header) + count;
ptr += BBSIZE) { ptr += BBSIZE) {
if (be32_to_cpu(*(__be32 *)ptr) == XLOG_HEADER_MAGIC_NUM) if (be32_to_cpu(*(__be32 *)ptr) == XLOG_HEADER_MAGIC_NUM)
xlog_panic("xlog_verify_iclog: unexpected magic num"); xfs_emerg(log->l_mp, "%s: unexpected magic num",
__func__);
} }
/* check fields */ /* check fields */
...@@ -3542,9 +3535,10 @@ xlog_verify_iclog(xlog_t *log, ...@@ -3542,9 +3535,10 @@ xlog_verify_iclog(xlog_t *log,
} }
} }
if (clientid != XFS_TRANSACTION && clientid != XFS_LOG) if (clientid != XFS_TRANSACTION && clientid != XFS_LOG)
cmn_err(CE_WARN, "xlog_verify_iclog: " xfs_warn(log->l_mp,
"invalid clientid %d op 0x%p offset 0x%lx", "%s: invalid clientid %d op 0x%p offset 0x%lx",
clientid, ophead, (unsigned long)field_offset); __func__, clientid, ophead,
(unsigned long)field_offset);
/* check length */ /* check length */
field_offset = (__psint_t) field_offset = (__psint_t)
......
...@@ -87,10 +87,6 @@ static inline uint xlog_get_client_id(__be32 i) ...@@ -87,10 +87,6 @@ static inline uint xlog_get_client_id(__be32 i)
return be32_to_cpu(i) >> 24; return be32_to_cpu(i) >> 24;
} }
#define xlog_panic(args...) cmn_err(CE_PANIC, ## args)
#define xlog_exit(args...) cmn_err(CE_PANIC, ## args)
#define xlog_warn(args...) cmn_err(CE_WARN, ## args)
/* /*
* In core log state * In core log state
*/ */
......
This diff is collapsed.
This diff is collapsed.
...@@ -382,7 +382,8 @@ static inline int xfs_qm_sync(struct xfs_mount *mp, int flags) ...@@ -382,7 +382,8 @@ static inline int xfs_qm_sync(struct xfs_mount *mp, int flags)
xfs_trans_reserve_quota_bydquots(tp, mp, ud, gd, nb, ni, \ xfs_trans_reserve_quota_bydquots(tp, mp, ud, gd, nb, ni, \
f | XFS_QMOPT_RES_REGBLKS) f | XFS_QMOPT_RES_REGBLKS)
extern int xfs_qm_dqcheck(xfs_disk_dquot_t *, xfs_dqid_t, uint, uint, char *); extern int xfs_qm_dqcheck(struct xfs_mount *, xfs_disk_dquot_t *,
xfs_dqid_t, uint, uint, char *);
extern int xfs_mount_reset_sbqflags(struct xfs_mount *); extern int xfs_mount_reset_sbqflags(struct xfs_mount *);
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
......
...@@ -76,7 +76,7 @@ xfs_growfs_rt_alloc( ...@@ -76,7 +76,7 @@ xfs_growfs_rt_alloc(
xfs_mount_t *mp, /* file system mount point */ xfs_mount_t *mp, /* file system mount point */
xfs_extlen_t oblocks, /* old count of blocks */ xfs_extlen_t oblocks, /* old count of blocks */
xfs_extlen_t nblocks, /* new count of blocks */ xfs_extlen_t nblocks, /* new count of blocks */
xfs_ino_t ino) /* inode number (bitmap/summary) */ xfs_inode_t *ip) /* inode (bitmap/summary) */
{ {
xfs_fileoff_t bno; /* block number in file */ xfs_fileoff_t bno; /* block number in file */
xfs_buf_t *bp; /* temporary buffer for zeroing */ xfs_buf_t *bp; /* temporary buffer for zeroing */
...@@ -86,7 +86,6 @@ xfs_growfs_rt_alloc( ...@@ -86,7 +86,6 @@ xfs_growfs_rt_alloc(
xfs_fsblock_t firstblock; /* first block allocated in xaction */ xfs_fsblock_t firstblock; /* first block allocated in xaction */
xfs_bmap_free_t flist; /* list of freed blocks */ xfs_bmap_free_t flist; /* list of freed blocks */
xfs_fsblock_t fsbno; /* filesystem block for bno */ xfs_fsblock_t fsbno; /* filesystem block for bno */
xfs_inode_t *ip; /* pointer to incore inode */
xfs_bmbt_irec_t map; /* block map output */ xfs_bmbt_irec_t map; /* block map output */
int nmap; /* number of block maps */ int nmap; /* number of block maps */
int resblks; /* space reservation */ int resblks; /* space reservation */
...@@ -112,9 +111,9 @@ xfs_growfs_rt_alloc( ...@@ -112,9 +111,9 @@ xfs_growfs_rt_alloc(
/* /*
* Lock the inode. * Lock the inode.
*/ */
if ((error = xfs_trans_iget(mp, tp, ino, 0, xfs_ilock(ip, XFS_ILOCK_EXCL);
XFS_ILOCK_EXCL, &ip))) xfs_trans_ijoin_ref(tp, ip, XFS_ILOCK_EXCL);
goto error_cancel;
xfs_bmap_init(&flist, &firstblock); xfs_bmap_init(&flist, &firstblock);
/* /*
* Allocate blocks to the bitmap file. * Allocate blocks to the bitmap file.
...@@ -155,9 +154,8 @@ xfs_growfs_rt_alloc( ...@@ -155,9 +154,8 @@ xfs_growfs_rt_alloc(
/* /*
* Lock the bitmap inode. * Lock the bitmap inode.
*/ */
if ((error = xfs_trans_iget(mp, tp, ino, 0, xfs_ilock(ip, XFS_ILOCK_EXCL);
XFS_ILOCK_EXCL, &ip))) xfs_trans_ijoin_ref(tp, ip, XFS_ILOCK_EXCL);
goto error_cancel;
/* /*
* Get a buffer for the block. * Get a buffer for the block.
*/ */
...@@ -1854,7 +1852,6 @@ xfs_growfs_rt( ...@@ -1854,7 +1852,6 @@ xfs_growfs_rt(
xfs_rtblock_t bmbno; /* bitmap block number */ xfs_rtblock_t bmbno; /* bitmap block number */
xfs_buf_t *bp; /* temporary buffer */ xfs_buf_t *bp; /* temporary buffer */
int error; /* error return value */ int error; /* error return value */
xfs_inode_t *ip; /* bitmap inode, used as lock */
xfs_mount_t *nmp; /* new (fake) mount structure */ xfs_mount_t *nmp; /* new (fake) mount structure */
xfs_drfsbno_t nrblocks; /* new number of realtime blocks */ xfs_drfsbno_t nrblocks; /* new number of realtime blocks */
xfs_extlen_t nrbmblocks; /* new number of rt bitmap blocks */ xfs_extlen_t nrbmblocks; /* new number of rt bitmap blocks */
...@@ -1918,11 +1915,11 @@ xfs_growfs_rt( ...@@ -1918,11 +1915,11 @@ xfs_growfs_rt(
/* /*
* Allocate space to the bitmap and summary files, as necessary. * Allocate space to the bitmap and summary files, as necessary.
*/ */
if ((error = xfs_growfs_rt_alloc(mp, rbmblocks, nrbmblocks, error = xfs_growfs_rt_alloc(mp, rbmblocks, nrbmblocks, mp->m_rbmip);
mp->m_sb.sb_rbmino))) if (error)
return error; return error;
if ((error = xfs_growfs_rt_alloc(mp, rsumblocks, nrsumblocks, error = xfs_growfs_rt_alloc(mp, rsumblocks, nrsumblocks, mp->m_rsumip);
mp->m_sb.sb_rsumino))) if (error)
return error; return error;
/* /*
* Allocate a new (fake) mount/sb. * Allocate a new (fake) mount/sb.
...@@ -1972,10 +1969,8 @@ xfs_growfs_rt( ...@@ -1972,10 +1969,8 @@ xfs_growfs_rt(
/* /*
* Lock out other callers by grabbing the bitmap inode lock. * Lock out other callers by grabbing the bitmap inode lock.
*/ */
if ((error = xfs_trans_iget(mp, tp, mp->m_sb.sb_rbmino, 0, xfs_ilock(mp->m_rbmip, XFS_ILOCK_EXCL);
XFS_ILOCK_EXCL, &ip))) xfs_trans_ijoin_ref(tp, mp->m_rbmip, XFS_ILOCK_EXCL);
goto error_cancel;
ASSERT(ip == mp->m_rbmip);
/* /*
* Update the bitmap inode's size. * Update the bitmap inode's size.
*/ */
...@@ -1986,10 +1981,8 @@ xfs_growfs_rt( ...@@ -1986,10 +1981,8 @@ xfs_growfs_rt(
/* /*
* Get the summary inode into the transaction. * Get the summary inode into the transaction.
*/ */
if ((error = xfs_trans_iget(mp, tp, mp->m_sb.sb_rsumino, 0, xfs_ilock(mp->m_rsumip, XFS_ILOCK_EXCL);
XFS_ILOCK_EXCL, &ip))) xfs_trans_ijoin_ref(tp, mp->m_rsumip, XFS_ILOCK_EXCL);
goto error_cancel;
ASSERT(ip == mp->m_rsumip);
/* /*
* Update the summary inode's size. * Update the summary inode's size.
*/ */
...@@ -2075,15 +2068,15 @@ xfs_rtallocate_extent( ...@@ -2075,15 +2068,15 @@ xfs_rtallocate_extent(
xfs_extlen_t prod, /* extent product factor */ xfs_extlen_t prod, /* extent product factor */
xfs_rtblock_t *rtblock) /* out: start block allocated */ xfs_rtblock_t *rtblock) /* out: start block allocated */
{ {
xfs_mount_t *mp = tp->t_mountp;
int error; /* error value */ int error; /* error value */
xfs_inode_t *ip; /* inode for bitmap file */
xfs_mount_t *mp; /* file system mount structure */
xfs_rtblock_t r; /* result allocated block */ xfs_rtblock_t r; /* result allocated block */
xfs_fsblock_t sb; /* summary file block number */ xfs_fsblock_t sb; /* summary file block number */
xfs_buf_t *sumbp; /* summary file block buffer */ xfs_buf_t *sumbp; /* summary file block buffer */
ASSERT(xfs_isilocked(mp->m_rbmip, XFS_ILOCK_EXCL));
ASSERT(minlen > 0 && minlen <= maxlen); ASSERT(minlen > 0 && minlen <= maxlen);
mp = tp->t_mountp;
/* /*
* If prod is set then figure out what to do to minlen and maxlen. * If prod is set then figure out what to do to minlen and maxlen.
*/ */
...@@ -2099,12 +2092,7 @@ xfs_rtallocate_extent( ...@@ -2099,12 +2092,7 @@ xfs_rtallocate_extent(
return 0; return 0;
} }
} }
/*
* Lock out other callers by grabbing the bitmap inode lock.
*/
if ((error = xfs_trans_iget(mp, tp, mp->m_sb.sb_rbmino, 0,
XFS_ILOCK_EXCL, &ip)))
return error;
sumbp = NULL; sumbp = NULL;
/* /*
* Allocate by size, or near another block, or exactly at some block. * Allocate by size, or near another block, or exactly at some block.
...@@ -2123,11 +2111,12 @@ xfs_rtallocate_extent( ...@@ -2123,11 +2111,12 @@ xfs_rtallocate_extent(
len, &sumbp, &sb, prod, &r); len, &sumbp, &sb, prod, &r);
break; break;
default: default:
error = EIO;
ASSERT(0); ASSERT(0);
} }
if (error) { if (error)
return error; return error;
}
/* /*
* If it worked, update the superblock. * If it worked, update the superblock.
*/ */
...@@ -2155,7 +2144,6 @@ xfs_rtfree_extent( ...@@ -2155,7 +2144,6 @@ xfs_rtfree_extent(
xfs_extlen_t len) /* length of extent freed */ xfs_extlen_t len) /* length of extent freed */
{ {
int error; /* error value */ int error; /* error value */
xfs_inode_t *ip; /* bitmap file inode */
xfs_mount_t *mp; /* file system mount structure */ xfs_mount_t *mp; /* file system mount structure */
xfs_fsblock_t sb; /* summary file block number */ xfs_fsblock_t sb; /* summary file block number */
xfs_buf_t *sumbp; /* summary file block buffer */ xfs_buf_t *sumbp; /* summary file block buffer */
...@@ -2164,9 +2152,9 @@ xfs_rtfree_extent( ...@@ -2164,9 +2152,9 @@ xfs_rtfree_extent(
/* /*
* Synchronize by locking the bitmap inode. * Synchronize by locking the bitmap inode.
*/ */
if ((error = xfs_trans_iget(mp, tp, mp->m_sb.sb_rbmino, 0, xfs_ilock(mp->m_rbmip, XFS_ILOCK_EXCL);
XFS_ILOCK_EXCL, &ip))) xfs_trans_ijoin_ref(tp, mp->m_rbmip, XFS_ILOCK_EXCL);
return error;
#if defined(__KERNEL__) && defined(DEBUG) #if defined(__KERNEL__) && defined(DEBUG)
/* /*
* Check to see that this whole range is currently allocated. * Check to see that this whole range is currently allocated.
...@@ -2199,10 +2187,10 @@ xfs_rtfree_extent( ...@@ -2199,10 +2187,10 @@ xfs_rtfree_extent(
*/ */
if (tp->t_frextents_delta + mp->m_sb.sb_frextents == if (tp->t_frextents_delta + mp->m_sb.sb_frextents ==
mp->m_sb.sb_rextents) { mp->m_sb.sb_rextents) {
if (!(ip->i_d.di_flags & XFS_DIFLAG_NEWRTBM)) if (!(mp->m_rbmip->i_d.di_flags & XFS_DIFLAG_NEWRTBM))
ip->i_d.di_flags |= XFS_DIFLAG_NEWRTBM; mp->m_rbmip->i_d.di_flags |= XFS_DIFLAG_NEWRTBM;
*(__uint64_t *)&ip->i_d.di_atime = 0; *(__uint64_t *)&mp->m_rbmip->i_d.di_atime = 0;
xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); xfs_trans_log_inode(tp, mp->m_rbmip, XFS_ILOG_CORE);
} }
return 0; return 0;
} }
...@@ -2222,8 +2210,8 @@ xfs_rtmount_init( ...@@ -2222,8 +2210,8 @@ xfs_rtmount_init(
if (sbp->sb_rblocks == 0) if (sbp->sb_rblocks == 0)
return 0; return 0;
if (mp->m_rtdev_targp == NULL) { if (mp->m_rtdev_targp == NULL) {
cmn_err(CE_WARN, xfs_warn(mp,
"XFS: This filesystem has a realtime volume, use rtdev=device option"); "Filesystem has a realtime volume, use rtdev=device option");
return XFS_ERROR(ENODEV); return XFS_ERROR(ENODEV);
} }
mp->m_rsumlevels = sbp->sb_rextslog + 1; mp->m_rsumlevels = sbp->sb_rextslog + 1;
...@@ -2237,7 +2225,7 @@ xfs_rtmount_init( ...@@ -2237,7 +2225,7 @@ xfs_rtmount_init(
*/ */
d = (xfs_daddr_t)XFS_FSB_TO_BB(mp, mp->m_sb.sb_rblocks); d = (xfs_daddr_t)XFS_FSB_TO_BB(mp, mp->m_sb.sb_rblocks);
if (XFS_BB_TO_FSB(mp, d) != mp->m_sb.sb_rblocks) { if (XFS_BB_TO_FSB(mp, d) != mp->m_sb.sb_rblocks) {
cmn_err(CE_WARN, "XFS: realtime mount -- %llu != %llu", xfs_warn(mp, "realtime mount -- %llu != %llu",
(unsigned long long) XFS_BB_TO_FSB(mp, d), (unsigned long long) XFS_BB_TO_FSB(mp, d),
(unsigned long long) mp->m_sb.sb_rblocks); (unsigned long long) mp->m_sb.sb_rblocks);
return XFS_ERROR(EFBIG); return XFS_ERROR(EFBIG);
...@@ -2246,7 +2234,7 @@ xfs_rtmount_init( ...@@ -2246,7 +2234,7 @@ xfs_rtmount_init(
d - XFS_FSB_TO_BB(mp, 1), d - XFS_FSB_TO_BB(mp, 1),
XFS_FSB_TO_B(mp, 1), 0); XFS_FSB_TO_B(mp, 1), 0);
if (!bp) { if (!bp) {
cmn_err(CE_WARN, "XFS: realtime device size check failed"); xfs_warn(mp, "realtime device size check failed");
return EIO; return EIO;
} }
xfs_buf_relse(bp); xfs_buf_relse(bp);
...@@ -2306,20 +2294,16 @@ xfs_rtpick_extent( ...@@ -2306,20 +2294,16 @@ xfs_rtpick_extent(
xfs_rtblock_t *pick) /* result rt extent */ xfs_rtblock_t *pick) /* result rt extent */
{ {
xfs_rtblock_t b; /* result block */ xfs_rtblock_t b; /* result block */
int error; /* error return value */
xfs_inode_t *ip; /* bitmap incore inode */
int log2; /* log of sequence number */ int log2; /* log of sequence number */
__uint64_t resid; /* residual after log removed */ __uint64_t resid; /* residual after log removed */
__uint64_t seq; /* sequence number of file creation */ __uint64_t seq; /* sequence number of file creation */
__uint64_t *seqp; /* pointer to seqno in inode */ __uint64_t *seqp; /* pointer to seqno in inode */
if ((error = xfs_trans_iget(mp, tp, mp->m_sb.sb_rbmino, 0, ASSERT(xfs_isilocked(mp->m_rbmip, XFS_ILOCK_EXCL));
XFS_ILOCK_EXCL, &ip)))
return error; seqp = (__uint64_t *)&mp->m_rbmip->i_d.di_atime;
ASSERT(ip == mp->m_rbmip); if (!(mp->m_rbmip->i_d.di_flags & XFS_DIFLAG_NEWRTBM)) {
seqp = (__uint64_t *)&ip->i_d.di_atime; mp->m_rbmip->i_d.di_flags |= XFS_DIFLAG_NEWRTBM;
if (!(ip->i_d.di_flags & XFS_DIFLAG_NEWRTBM)) {
ip->i_d.di_flags |= XFS_DIFLAG_NEWRTBM;
*seqp = 0; *seqp = 0;
} }
seq = *seqp; seq = *seqp;
...@@ -2335,7 +2319,7 @@ xfs_rtpick_extent( ...@@ -2335,7 +2319,7 @@ xfs_rtpick_extent(
b = mp->m_sb.sb_rextents - len; b = mp->m_sb.sb_rextents - len;
} }
*seqp = seq + 1; *seqp = seq + 1;
xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); xfs_trans_log_inode(tp, mp->m_rbmip, XFS_ILOG_CORE);
*pick = b; *pick = b;
return 0; return 0;
} }
...@@ -154,7 +154,7 @@ xfs_rtmount_init( ...@@ -154,7 +154,7 @@ xfs_rtmount_init(
if (mp->m_sb.sb_rblocks == 0) if (mp->m_sb.sb_rblocks == 0)
return 0; return 0;
cmn_err(CE_WARN, "XFS: Not built with CONFIG_XFS_RT"); xfs_warn(mp, "Not built with CONFIG_XFS_RT");
return ENOSYS; return ENOSYS;
} }
# define xfs_rtmount_inodes(m) (((mp)->m_sb.sb_rblocks == 0)? 0 : (ENOSYS)) # define xfs_rtmount_inodes(m) (((mp)->m_sb.sb_rblocks == 0)? 0 : (ENOSYS))
......
...@@ -49,9 +49,9 @@ xfs_do_force_shutdown( ...@@ -49,9 +49,9 @@ xfs_do_force_shutdown(
logerror = flags & SHUTDOWN_LOG_IO_ERROR; logerror = flags & SHUTDOWN_LOG_IO_ERROR;
if (!(flags & SHUTDOWN_FORCE_UMOUNT)) { if (!(flags & SHUTDOWN_FORCE_UMOUNT)) {
cmn_err(CE_NOTE, "xfs_force_shutdown(%s,0x%x) called from " xfs_notice(mp,
"line %d of file %s. Return address = 0x%p", "%s(0x%x) called from line %d of file %s. Return address = 0x%p",
mp->m_fsname, flags, lnnum, fname, __return_address); __func__, flags, lnnum, fname, __return_address);
} }
/* /*
* No need to duplicate efforts. * No need to duplicate efforts.
...@@ -69,30 +69,25 @@ xfs_do_force_shutdown( ...@@ -69,30 +69,25 @@ xfs_do_force_shutdown(
return; return;
if (flags & SHUTDOWN_CORRUPT_INCORE) { if (flags & SHUTDOWN_CORRUPT_INCORE) {
xfs_cmn_err(XFS_PTAG_SHUTDOWN_CORRUPT, CE_ALERT, mp, xfs_alert_tag(mp, XFS_PTAG_SHUTDOWN_CORRUPT,
"Corruption of in-memory data detected. Shutting down filesystem: %s", "Corruption of in-memory data detected. Shutting down filesystem");
mp->m_fsname); if (XFS_ERRLEVEL_HIGH <= xfs_error_level)
if (XFS_ERRLEVEL_HIGH <= xfs_error_level) {
xfs_stack_trace(); xfs_stack_trace();
}
} else if (!(flags & SHUTDOWN_FORCE_UMOUNT)) { } else if (!(flags & SHUTDOWN_FORCE_UMOUNT)) {
if (logerror) { if (logerror) {
xfs_cmn_err(XFS_PTAG_SHUTDOWN_LOGERROR, CE_ALERT, mp, xfs_alert_tag(mp, XFS_PTAG_SHUTDOWN_LOGERROR,
"Log I/O Error Detected. Shutting down filesystem: %s", "Log I/O Error Detected. Shutting down filesystem");
mp->m_fsname);
} else if (flags & SHUTDOWN_DEVICE_REQ) { } else if (flags & SHUTDOWN_DEVICE_REQ) {
xfs_cmn_err(XFS_PTAG_SHUTDOWN_IOERROR, CE_ALERT, mp, xfs_alert_tag(mp, XFS_PTAG_SHUTDOWN_IOERROR,
"All device paths lost. Shutting down filesystem: %s", "All device paths lost. Shutting down filesystem");
mp->m_fsname);
} else if (!(flags & SHUTDOWN_REMOTE_REQ)) { } else if (!(flags & SHUTDOWN_REMOTE_REQ)) {
xfs_cmn_err(XFS_PTAG_SHUTDOWN_IOERROR, CE_ALERT, mp, xfs_alert_tag(mp, XFS_PTAG_SHUTDOWN_IOERROR,
"I/O Error Detected. Shutting down filesystem: %s", "I/O Error Detected. Shutting down filesystem");
mp->m_fsname);
} }
} }
if (!(flags & SHUTDOWN_FORCE_UMOUNT)) { if (!(flags & SHUTDOWN_FORCE_UMOUNT)) {
cmn_err(CE_ALERT, "Please umount the filesystem, " xfs_alert(mp,
"and rectify the problem(s)"); "Please umount the filesystem and rectify the problem(s)");
} }
} }
...@@ -106,10 +101,9 @@ xfs_ioerror_alert( ...@@ -106,10 +101,9 @@ xfs_ioerror_alert(
xfs_buf_t *bp, xfs_buf_t *bp,
xfs_daddr_t blkno) xfs_daddr_t blkno)
{ {
cmn_err(CE_ALERT, xfs_alert(mp,
"I/O error in filesystem (\"%s\") meta-data dev %s block 0x%llx" "I/O error occurred: meta-data dev %s block 0x%llx"
" (\"%s\") error %d buf count %zd", " (\"%s\") error %d buf count %zd",
(!mp || !mp->m_fsname) ? "(fs name not set)" : mp->m_fsname,
XFS_BUFTARG_NAME(XFS_BUF_TARGET(bp)), XFS_BUFTARG_NAME(XFS_BUF_TARGET(bp)),
(__uint64_t)blkno, func, (__uint64_t)blkno, func,
XFS_BUF_GETERROR(bp), XFS_BUF_COUNT(bp)); XFS_BUF_GETERROR(bp), XFS_BUF_COUNT(bp));
...@@ -173,17 +167,9 @@ xfs_extlen_t ...@@ -173,17 +167,9 @@ xfs_extlen_t
xfs_get_extsz_hint( xfs_get_extsz_hint(
struct xfs_inode *ip) struct xfs_inode *ip)
{ {
xfs_extlen_t extsz; if ((ip->i_d.di_flags & XFS_DIFLAG_EXTSIZE) && ip->i_d.di_extsize)
return ip->i_d.di_extsize;
if (unlikely(XFS_IS_REALTIME_INODE(ip))) { if (XFS_IS_REALTIME_INODE(ip))
extsz = (ip->i_d.di_flags & XFS_DIFLAG_EXTSIZE) return ip->i_mount->m_sb.sb_rextsize;
? ip->i_d.di_extsize return 0;
: ip->i_mount->m_sb.sb_rextsize;
ASSERT(extsz);
} else {
extsz = (ip->i_d.di_flags & XFS_DIFLAG_EXTSIZE)
? ip->i_d.di_extsize : 0;
}
return extsz;
} }
...@@ -469,8 +469,6 @@ void xfs_trans_inode_buf(xfs_trans_t *, struct xfs_buf *); ...@@ -469,8 +469,6 @@ void xfs_trans_inode_buf(xfs_trans_t *, struct xfs_buf *);
void xfs_trans_stale_inode_buf(xfs_trans_t *, struct xfs_buf *); void xfs_trans_stale_inode_buf(xfs_trans_t *, struct xfs_buf *);
void xfs_trans_dquot_buf(xfs_trans_t *, struct xfs_buf *, uint); void xfs_trans_dquot_buf(xfs_trans_t *, struct xfs_buf *, uint);
void xfs_trans_inode_alloc_buf(xfs_trans_t *, struct xfs_buf *); void xfs_trans_inode_alloc_buf(xfs_trans_t *, struct xfs_buf *);
int xfs_trans_iget(struct xfs_mount *, xfs_trans_t *,
xfs_ino_t , uint, uint, struct xfs_inode **);
void xfs_trans_ichgtime(struct xfs_trans *, struct xfs_inode *, int); void xfs_trans_ichgtime(struct xfs_trans *, struct xfs_inode *, int);
void xfs_trans_ijoin_ref(struct xfs_trans *, struct xfs_inode *, uint); void xfs_trans_ijoin_ref(struct xfs_trans *, struct xfs_inode *, uint);
void xfs_trans_ijoin(struct xfs_trans *, struct xfs_inode *); void xfs_trans_ijoin(struct xfs_trans *, struct xfs_inode *);
......
...@@ -563,7 +563,7 @@ xfs_trans_ail_delete_bulk( ...@@ -563,7 +563,7 @@ xfs_trans_ail_delete_bulk(
spin_unlock(&ailp->xa_lock); spin_unlock(&ailp->xa_lock);
if (!XFS_FORCED_SHUTDOWN(mp)) { if (!XFS_FORCED_SHUTDOWN(mp)) {
xfs_cmn_err(XFS_PTAG_AILDELETE, CE_ALERT, mp, xfs_alert_tag(mp, XFS_PTAG_AILDELETE,
"%s: attempting to delete a log item that is not in the AIL", "%s: attempting to delete a log item that is not in the AIL",
__func__); __func__);
xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE); xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE);
......
...@@ -305,7 +305,7 @@ xfs_trans_read_buf( ...@@ -305,7 +305,7 @@ xfs_trans_read_buf(
if (xfs_error_target == target) { if (xfs_error_target == target) {
if (((xfs_req_num++) % xfs_error_mod) == 0) { if (((xfs_req_num++) % xfs_error_mod) == 0) {
xfs_buf_relse(bp); xfs_buf_relse(bp);
cmn_err(CE_DEBUG, "Returning error!\n"); xfs_debug(mp, "Returning error!");
return XFS_ERROR(EIO); return XFS_ERROR(EIO);
} }
} }
...@@ -403,7 +403,7 @@ xfs_trans_read_buf( ...@@ -403,7 +403,7 @@ xfs_trans_read_buf(
xfs_force_shutdown(tp->t_mountp, xfs_force_shutdown(tp->t_mountp,
SHUTDOWN_META_IO_ERROR); SHUTDOWN_META_IO_ERROR);
xfs_buf_relse(bp); xfs_buf_relse(bp);
cmn_err(CE_DEBUG, "Returning trans error!\n"); xfs_debug(mp, "Returning trans error!");
return XFS_ERROR(EIO); return XFS_ERROR(EIO);
} }
} }
...@@ -427,7 +427,7 @@ xfs_trans_read_buf( ...@@ -427,7 +427,7 @@ xfs_trans_read_buf(
*/ */
#if defined(DEBUG) #if defined(DEBUG)
if (XFS_BUF_ISSTALE(bp) && XFS_BUF_ISDELAYWRITE(bp)) if (XFS_BUF_ISSTALE(bp) && XFS_BUF_ISDELAYWRITE(bp))
cmn_err(CE_NOTE, "about to pop assert, bp == 0x%p", bp); xfs_notice(mp, "about to pop assert, bp == 0x%p", bp);
#endif #endif
ASSERT((XFS_BUF_BFLAGS(bp) & (XBF_STALE|XBF_DELWRI)) != ASSERT((XFS_BUF_BFLAGS(bp) & (XBF_STALE|XBF_DELWRI)) !=
(XBF_STALE|XBF_DELWRI)); (XBF_STALE|XBF_DELWRI));
......
...@@ -43,28 +43,6 @@ xfs_trans_inode_broot_debug( ...@@ -43,28 +43,6 @@ xfs_trans_inode_broot_debug(
#define xfs_trans_inode_broot_debug(ip) #define xfs_trans_inode_broot_debug(ip)
#endif #endif
/*
* Get an inode and join it to the transaction.
*/
int
xfs_trans_iget(
xfs_mount_t *mp,
xfs_trans_t *tp,
xfs_ino_t ino,
uint flags,
uint lock_flags,
xfs_inode_t **ipp)
{
int error;
error = xfs_iget(mp, tp, ino, flags, lock_flags, ipp);
if (!error && tp) {
xfs_trans_ijoin(tp, *ipp);
(*ipp)->i_itemp->ili_lock_flags = lock_flags;
}
return error;
}
/* /*
* Add a locked inode to the transaction. * Add a locked inode to the transaction.
* *
......
...@@ -1189,9 +1189,8 @@ xfs_inactive( ...@@ -1189,9 +1189,8 @@ xfs_inactive(
* inode might be lost for a long time or forever. * inode might be lost for a long time or forever.
*/ */
if (!XFS_FORCED_SHUTDOWN(mp)) { if (!XFS_FORCED_SHUTDOWN(mp)) {
cmn_err(CE_NOTE, xfs_notice(mp, "%s: xfs_ifree returned error %d",
"xfs_inactive: xfs_ifree() returned an error = %d on %s", __func__, error);
error, mp->m_fsname);
xfs_force_shutdown(mp, SHUTDOWN_META_IO_ERROR); xfs_force_shutdown(mp, SHUTDOWN_META_IO_ERROR);
} }
xfs_trans_cancel(tp, XFS_TRANS_RELEASE_LOG_RES|XFS_TRANS_ABORT); xfs_trans_cancel(tp, XFS_TRANS_RELEASE_LOG_RES|XFS_TRANS_ABORT);
...@@ -1208,12 +1207,12 @@ xfs_inactive( ...@@ -1208,12 +1207,12 @@ xfs_inactive(
*/ */
error = xfs_bmap_finish(&tp, &free_list, &committed); error = xfs_bmap_finish(&tp, &free_list, &committed);
if (error) if (error)
xfs_fs_cmn_err(CE_NOTE, mp, "xfs_inactive: " xfs_notice(mp, "%s: xfs_bmap_finish returned error %d",
"xfs_bmap_finish() returned error %d", error); __func__, error);
error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES); error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES);
if (error) if (error)
xfs_fs_cmn_err(CE_NOTE, mp, "xfs_inactive: " xfs_notice(mp, "%s: xfs_trans_commit returned error %d",
"xfs_trans_commit() returned error %d", error); __func__, error);
} }
/* /*
...@@ -1310,7 +1309,7 @@ xfs_create( ...@@ -1310,7 +1309,7 @@ xfs_create(
error = xfs_qm_vop_dqalloc(dp, current_fsuid(), current_fsgid(), prid, error = xfs_qm_vop_dqalloc(dp, current_fsuid(), current_fsgid(), prid,
XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT, &udqp, &gdqp); XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT, &udqp, &gdqp);
if (error) if (error)
goto std_return; return error;
if (is_dir) { if (is_dir) {
rdev = 0; rdev = 0;
...@@ -1389,12 +1388,6 @@ xfs_create( ...@@ -1389,12 +1388,6 @@ xfs_create(
goto out_trans_abort; goto out_trans_abort;
} }
/*
* At this point, we've gotten a newly allocated inode.
* It is locked (and joined to the transaction).
*/
ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
/* /*
* Now we join the directory inode to the transaction. We do not do it * Now we join the directory inode to the transaction. We do not do it
* earlier because xfs_dir_ialloc might commit the previous transaction * earlier because xfs_dir_ialloc might commit the previous transaction
...@@ -1440,22 +1433,13 @@ xfs_create( ...@@ -1440,22 +1433,13 @@ xfs_create(
*/ */
xfs_qm_vop_create_dqattach(tp, ip, udqp, gdqp); xfs_qm_vop_create_dqattach(tp, ip, udqp, gdqp);
/*
* xfs_trans_commit normally decrements the vnode ref count
* when it unlocks the inode. Since we want to return the
* vnode to the caller, we bump the vnode ref count now.
*/
IHOLD(ip);
error = xfs_bmap_finish(&tp, &free_list, &committed); error = xfs_bmap_finish(&tp, &free_list, &committed);
if (error) if (error)
goto out_abort_rele; goto out_bmap_cancel;
error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES); error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES);
if (error) { if (error)
IRELE(ip); goto out_release_inode;
goto out_dqrele;
}
xfs_qm_dqrele(udqp); xfs_qm_dqrele(udqp);
xfs_qm_dqrele(gdqp); xfs_qm_dqrele(gdqp);
...@@ -1469,27 +1453,21 @@ xfs_create( ...@@ -1469,27 +1453,21 @@ xfs_create(
cancel_flags |= XFS_TRANS_ABORT; cancel_flags |= XFS_TRANS_ABORT;
out_trans_cancel: out_trans_cancel:
xfs_trans_cancel(tp, cancel_flags); xfs_trans_cancel(tp, cancel_flags);
out_dqrele: out_release_inode:
/*
* Wait until after the current transaction is aborted to
* release the inode. This prevents recursive transactions
* and deadlocks from xfs_inactive.
*/
if (ip)
IRELE(ip);
xfs_qm_dqrele(udqp); xfs_qm_dqrele(udqp);
xfs_qm_dqrele(gdqp); xfs_qm_dqrele(gdqp);
if (unlock_dp_on_error) if (unlock_dp_on_error)
xfs_iunlock(dp, XFS_ILOCK_EXCL); xfs_iunlock(dp, XFS_ILOCK_EXCL);
std_return:
return error; return error;
out_abort_rele:
/*
* Wait until after the current transaction is aborted to
* release the inode. This prevents recursive transactions
* and deadlocks from xfs_inactive.
*/
xfs_bmap_cancel(&free_list);
cancel_flags |= XFS_TRANS_ABORT;
xfs_trans_cancel(tp, cancel_flags);
IRELE(ip);
unlock_dp_on_error = B_FALSE;
goto out_dqrele;
} }
#ifdef DEBUG #ifdef DEBUG
...@@ -2114,9 +2092,8 @@ xfs_symlink( ...@@ -2114,9 +2092,8 @@ xfs_symlink(
XFS_BMAPI_WRITE | XFS_BMAPI_METADATA, XFS_BMAPI_WRITE | XFS_BMAPI_METADATA,
&first_block, resblks, mval, &nmaps, &first_block, resblks, mval, &nmaps,
&free_list); &free_list);
if (error) { if (error)
goto error1; goto error2;
}
if (resblks) if (resblks)
resblks -= fs_blocks; resblks -= fs_blocks;
...@@ -2148,7 +2125,7 @@ xfs_symlink( ...@@ -2148,7 +2125,7 @@ xfs_symlink(
error = xfs_dir_createname(tp, dp, link_name, ip->i_ino, error = xfs_dir_createname(tp, dp, link_name, ip->i_ino,
&first_block, &free_list, resblks); &first_block, &free_list, resblks);
if (error) if (error)
goto error1; goto error2;
xfs_trans_ichgtime(tp, dp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG); xfs_trans_ichgtime(tp, dp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG);
xfs_trans_log_inode(tp, dp, XFS_ILOG_CORE); xfs_trans_log_inode(tp, dp, XFS_ILOG_CORE);
...@@ -2161,13 +2138,6 @@ xfs_symlink( ...@@ -2161,13 +2138,6 @@ xfs_symlink(
xfs_trans_set_sync(tp); xfs_trans_set_sync(tp);
} }
/*
* xfs_trans_commit normally decrements the vnode ref count
* when it unlocks the inode. Since we want to return the
* vnode to the caller, we bump the vnode ref count now.
*/
IHOLD(ip);
error = xfs_bmap_finish(&tp, &free_list, &committed); error = xfs_bmap_finish(&tp, &free_list, &committed);
if (error) { if (error) {
goto error2; goto error2;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment