Commit af043ad2 authored by Nathan Scott's avatar Nathan Scott Committed by Christoph Hellwig

[XFS] Small buftarg cleanup - keep code which pokes inside a buftarg all in

one spot, which lets us keep more common code in sync, 2.4/2.5 and is
slightly cleaner anyway.

SGI Modid: 2.5.x-xfs:slinx:149231a
parent 6d6b0da6
......@@ -887,29 +887,23 @@ xfsbdstrat(
return (xfs_bioerror_relse(bp));
}
void
XFS_bflush(xfs_buftarg_t *target)
{
pagebuf_delwri_flush(target, PBDF_WAIT, NULL);
}
/*
* If the underlying (log or data) device is readonly, there are some
* If the underlying (data/log/rt) device is readonly, there are some
* operations that cannot proceed.
*/
int
xfs_dev_is_read_only(xfs_mount_t *mp, char *message)
xfs_dev_is_read_only(
xfs_mount_t *mp,
char *message)
{
if (bdev_read_only(mp->m_ddev_targp->pbr_bdev) ||
bdev_read_only(mp->m_logdev_targp->pbr_bdev) ||
(mp->m_rtdev_targp && bdev_read_only(mp->m_rtdev_targp->pbr_bdev))) {
if (xfs_readonly_buftarg(mp->m_ddev_targp) ||
xfs_readonly_buftarg(mp->m_logdev_targp) ||
(mp->m_rtdev_targp && xfs_readonly_buftarg(mp->m_rtdev_targp))) {
cmn_err(CE_NOTE,
"XFS: %s required on read-only device.", message);
cmn_err(CE_NOTE,
"XFS: write access unavailable, cannot proceed.");
return EROFS;
}
return 0;
}
......@@ -217,13 +217,27 @@ xfs_blkdev_put(
}
void
xfs_free_buftarg(
xfs_flush_buftarg(
xfs_buftarg_t *btp)
{
pagebuf_delwri_flush(btp, PBDF_WAIT, NULL);
}
void
xfs_free_buftarg(
xfs_buftarg_t *btp)
{
xfs_flush_buftarg(btp);
kmem_free(btp, sizeof(*btp));
}
int
xfs_readonly_buftarg(
xfs_buftarg_t *btp)
{
return bdev_read_only(btp->pbr_bdev);
}
void
xfs_relse_buftarg(
xfs_buftarg_t *btp)
......@@ -432,9 +446,8 @@ linvfs_put_super(
linvfs_stop_syncd(vfsp);
VFS_SYNC(vfsp, SYNC_ATTR|SYNC_DELWRI, NULL, error);
if (error == 0) {
if (!error)
VFS_UNMOUNT(vfsp, 0, NULL, error);
}
if (error) {
printk("XFS unmount got error %d\n", error);
printk("%s: vfsp/0x%p left dangling!\n", __FUNCTION__, vfsp);
......@@ -483,12 +496,8 @@ linvfs_remount(
int error;
VFS_PARSEARGS(vfsp, options, args, 1, error);
if (error)
goto out;
if (!error)
VFS_MNTUPDATE(vfsp, flags, args, error);
out:
kmem_free(args, sizeof(*args));
return error;
}
......@@ -497,11 +506,10 @@ STATIC void
linvfs_freeze_fs(
struct super_block *sb)
{
vfs_t *vfsp;
vfs_t *vfsp = LINVFS_GET_VFS(sb);
vnode_t *vp;
int error;
vfsp = LINVFS_GET_VFS(sb);
if (sb->s_flags & MS_RDONLY)
return;
VFS_ROOT(vfsp, &vp, error);
......@@ -513,11 +521,10 @@ STATIC void
linvfs_unfreeze_fs(
struct super_block *sb)
{
vfs_t *vfsp;
vfs_t *vfsp = LINVFS_GET_VFS(sb);
vnode_t *vp;
int error;
vfsp = LINVFS_GET_VFS(sb);
VFS_ROOT(vfsp, &vp, error);
VOP_IOCTL(vp, LINVFS_GET_IP(vp), NULL, XFS_IOC_THAW, 0, error);
VN_RELE(vp);
......
......@@ -101,7 +101,8 @@ extern void xfs_blkdev_put(struct block_device *);
extern struct pb_target *xfs_alloc_buftarg(struct block_device *);
extern void xfs_relse_buftarg(struct pb_target *);
extern void xfs_free_buftarg(struct pb_target *);
extern void xfs_flush_buftarg(struct pb_target *);
extern int xfs_readonly_buftarg(struct pb_target *);
extern void xfs_setsize_buftarg(struct pb_target *, unsigned int, unsigned int);
extern unsigned int xfs_getsize_buftarg(struct pb_target *);
......
/*
* Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
* Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
......@@ -283,7 +283,6 @@ static inline int XFS_bwrite(page_buf_t *pb)
return error;
}
#define XFS_bdwrite(pb) \
pagebuf_iostart(pb, PBF_DELWRI | PBF_ASYNC)
......@@ -307,15 +306,15 @@ static inline int xfs_bdwrite(void *mp, page_buf_t *bp)
* of its metadata.
*/
extern void XFS_bflush(xfs_buftarg_t *);
#define xfs_binval(buftarg) XFS_bflush(buftarg)
#define xfs_binval(buftarg) xfs_flush_buftarg(buftarg)
#define XFS_bflush(buftarg) xfs_flush_buftarg(buftarg)
#define xfs_incore_relse(buftarg,delwri_only,wait) \
xfs_relse_buftarg(buftarg)
#define xfs_baread(target, rablkno, ralen) \
pagebuf_readahead((target), (rablkno), \
(ralen), PBF_DONT_BLOCK)
pagebuf_readahead((target), (rablkno), (ralen), PBF_DONT_BLOCK)
#define XFS_getrbuf(sleep,mp) \
pagebuf_get_empty((mp)->m_ddev_targp)
......
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