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( ...@@ -887,29 +887,23 @@ xfsbdstrat(
return (xfs_bioerror_relse(bp)); 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. * operations that cannot proceed.
*/ */
int 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) || if (xfs_readonly_buftarg(mp->m_ddev_targp) ||
bdev_read_only(mp->m_logdev_targp->pbr_bdev) || xfs_readonly_buftarg(mp->m_logdev_targp) ||
(mp->m_rtdev_targp && bdev_read_only(mp->m_rtdev_targp->pbr_bdev))) { (mp->m_rtdev_targp && xfs_readonly_buftarg(mp->m_rtdev_targp))) {
cmn_err(CE_NOTE, cmn_err(CE_NOTE,
"XFS: %s required on read-only device.", message); "XFS: %s required on read-only device.", message);
cmn_err(CE_NOTE, cmn_err(CE_NOTE,
"XFS: write access unavailable, cannot proceed."); "XFS: write access unavailable, cannot proceed.");
return EROFS; return EROFS;
} }
return 0; return 0;
} }
...@@ -217,13 +217,27 @@ xfs_blkdev_put( ...@@ -217,13 +217,27 @@ xfs_blkdev_put(
} }
void void
xfs_free_buftarg( xfs_flush_buftarg(
xfs_buftarg_t *btp) xfs_buftarg_t *btp)
{ {
pagebuf_delwri_flush(btp, PBDF_WAIT, NULL); pagebuf_delwri_flush(btp, PBDF_WAIT, NULL);
}
void
xfs_free_buftarg(
xfs_buftarg_t *btp)
{
xfs_flush_buftarg(btp);
kmem_free(btp, sizeof(*btp)); kmem_free(btp, sizeof(*btp));
} }
int
xfs_readonly_buftarg(
xfs_buftarg_t *btp)
{
return bdev_read_only(btp->pbr_bdev);
}
void void
xfs_relse_buftarg( xfs_relse_buftarg(
xfs_buftarg_t *btp) xfs_buftarg_t *btp)
...@@ -432,9 +446,8 @@ linvfs_put_super( ...@@ -432,9 +446,8 @@ linvfs_put_super(
linvfs_stop_syncd(vfsp); linvfs_stop_syncd(vfsp);
VFS_SYNC(vfsp, SYNC_ATTR|SYNC_DELWRI, NULL, error); VFS_SYNC(vfsp, SYNC_ATTR|SYNC_DELWRI, NULL, error);
if (error == 0) { if (!error)
VFS_UNMOUNT(vfsp, 0, NULL, error); VFS_UNMOUNT(vfsp, 0, NULL, error);
}
if (error) { if (error) {
printk("XFS unmount got error %d\n", error); printk("XFS unmount got error %d\n", error);
printk("%s: vfsp/0x%p left dangling!\n", __FUNCTION__, vfsp); printk("%s: vfsp/0x%p left dangling!\n", __FUNCTION__, vfsp);
...@@ -483,12 +496,8 @@ linvfs_remount( ...@@ -483,12 +496,8 @@ linvfs_remount(
int error; int error;
VFS_PARSEARGS(vfsp, options, args, 1, error); VFS_PARSEARGS(vfsp, options, args, 1, error);
if (error) if (!error)
goto out; VFS_MNTUPDATE(vfsp, flags, args, error);
VFS_MNTUPDATE(vfsp, flags, args, error);
out:
kmem_free(args, sizeof(*args)); kmem_free(args, sizeof(*args));
return error; return error;
} }
...@@ -497,11 +506,10 @@ STATIC void ...@@ -497,11 +506,10 @@ STATIC void
linvfs_freeze_fs( linvfs_freeze_fs(
struct super_block *sb) struct super_block *sb)
{ {
vfs_t *vfsp; vfs_t *vfsp = LINVFS_GET_VFS(sb);
vnode_t *vp; vnode_t *vp;
int error; int error;
vfsp = LINVFS_GET_VFS(sb);
if (sb->s_flags & MS_RDONLY) if (sb->s_flags & MS_RDONLY)
return; return;
VFS_ROOT(vfsp, &vp, error); VFS_ROOT(vfsp, &vp, error);
...@@ -513,11 +521,10 @@ STATIC void ...@@ -513,11 +521,10 @@ STATIC void
linvfs_unfreeze_fs( linvfs_unfreeze_fs(
struct super_block *sb) struct super_block *sb)
{ {
vfs_t *vfsp; vfs_t *vfsp = LINVFS_GET_VFS(sb);
vnode_t *vp; vnode_t *vp;
int error; int error;
vfsp = LINVFS_GET_VFS(sb);
VFS_ROOT(vfsp, &vp, error); VFS_ROOT(vfsp, &vp, error);
VOP_IOCTL(vp, LINVFS_GET_IP(vp), NULL, XFS_IOC_THAW, 0, error); VOP_IOCTL(vp, LINVFS_GET_IP(vp), NULL, XFS_IOC_THAW, 0, error);
VN_RELE(vp); VN_RELE(vp);
......
...@@ -101,7 +101,8 @@ extern void xfs_blkdev_put(struct block_device *); ...@@ -101,7 +101,8 @@ extern void xfs_blkdev_put(struct block_device *);
extern struct pb_target *xfs_alloc_buftarg(struct block_device *); extern struct pb_target *xfs_alloc_buftarg(struct block_device *);
extern void xfs_relse_buftarg(struct pb_target *); extern void xfs_relse_buftarg(struct pb_target *);
extern void xfs_free_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 void xfs_setsize_buftarg(struct pb_target *, unsigned int, unsigned int);
extern unsigned int xfs_getsize_buftarg(struct pb_target *); 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 * 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 * 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) ...@@ -283,7 +283,6 @@ static inline int XFS_bwrite(page_buf_t *pb)
return error; return error;
} }
#define XFS_bdwrite(pb) \ #define XFS_bdwrite(pb) \
pagebuf_iostart(pb, PBF_DELWRI | PBF_ASYNC) pagebuf_iostart(pb, PBF_DELWRI | PBF_ASYNC)
...@@ -307,15 +306,15 @@ static inline int xfs_bdwrite(void *mp, page_buf_t *bp) ...@@ -307,15 +306,15 @@ static inline int xfs_bdwrite(void *mp, page_buf_t *bp)
* of its metadata. * of its metadata.
*/ */
extern void XFS_bflush(xfs_buftarg_t *); #define xfs_binval(buftarg) xfs_flush_buftarg(buftarg)
#define xfs_binval(buftarg) XFS_bflush(buftarg)
#define XFS_bflush(buftarg) xfs_flush_buftarg(buftarg)
#define xfs_incore_relse(buftarg,delwri_only,wait) \ #define xfs_incore_relse(buftarg,delwri_only,wait) \
xfs_relse_buftarg(buftarg) xfs_relse_buftarg(buftarg)
#define xfs_baread(target, rablkno, ralen) \ #define xfs_baread(target, rablkno, ralen) \
pagebuf_readahead((target), (rablkno), \ pagebuf_readahead((target), (rablkno), (ralen), PBF_DONT_BLOCK)
(ralen), PBF_DONT_BLOCK)
#define XFS_getrbuf(sleep,mp) \ #define XFS_getrbuf(sleep,mp) \
pagebuf_get_empty((mp)->m_ddev_targp) 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