aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_attr.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_attr.c')
-rw-r--r--fs/xfs/xfs_attr.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/fs/xfs/xfs_attr.c b/fs/xfs/xfs_attr.c
index 65d61b948ea..a17ff01b5ad 100644
--- a/fs/xfs/xfs_attr.c
+++ b/fs/xfs/xfs_attr.c
@@ -21,7 +21,6 @@
21#include "xfs_types.h" 21#include "xfs_types.h"
22#include "xfs_bit.h" 22#include "xfs_bit.h"
23#include "xfs_log.h" 23#include "xfs_log.h"
24#include "xfs_inum.h"
25#include "xfs_trans.h" 24#include "xfs_trans.h"
26#include "xfs_sb.h" 25#include "xfs_sb.h"
27#include "xfs_ag.h" 26#include "xfs_ag.h"
@@ -39,7 +38,6 @@
39#include "xfs_error.h" 38#include "xfs_error.h"
40#include "xfs_quota.h" 39#include "xfs_quota.h"
41#include "xfs_trans_space.h" 40#include "xfs_trans_space.h"
42#include "xfs_rw.h"
43#include "xfs_vnodeops.h" 41#include "xfs_vnodeops.h"
44#include "xfs_trace.h" 42#include "xfs_trace.h"
45 43
@@ -1987,14 +1985,12 @@ xfs_attr_rmtval_get(xfs_da_args_t *args)
1987 (map[i].br_startblock != HOLESTARTBLOCK)); 1985 (map[i].br_startblock != HOLESTARTBLOCK));
1988 dblkno = XFS_FSB_TO_DADDR(mp, map[i].br_startblock); 1986 dblkno = XFS_FSB_TO_DADDR(mp, map[i].br_startblock);
1989 blkcnt = XFS_FSB_TO_BB(mp, map[i].br_blockcount); 1987 blkcnt = XFS_FSB_TO_BB(mp, map[i].br_blockcount);
1990 error = xfs_read_buf(mp, mp->m_ddev_targp, dblkno, 1988 error = xfs_trans_read_buf(mp, NULL, mp->m_ddev_targp,
1991 blkcnt, XBF_LOCK | XBF_DONT_BLOCK, 1989 dblkno, blkcnt, 0, &bp);
1992 &bp);
1993 if (error) 1990 if (error)
1994 return(error); 1991 return(error);
1995 1992
1996 tmp = (valuelen < XFS_BUF_SIZE(bp)) 1993 tmp = min_t(int, valuelen, BBTOB(bp->b_length));
1997 ? valuelen : XFS_BUF_SIZE(bp);
1998 xfs_buf_iomove(bp, 0, tmp, dst, XBRW_READ); 1994 xfs_buf_iomove(bp, 0, tmp, dst, XBRW_READ);
1999 xfs_buf_relse(bp); 1995 xfs_buf_relse(bp);
2000 dst += tmp; 1996 dst += tmp;
@@ -2097,6 +2093,8 @@ xfs_attr_rmtval_set(xfs_da_args_t *args)
2097 lblkno = args->rmtblkno; 2093 lblkno = args->rmtblkno;
2098 valuelen = args->valuelen; 2094 valuelen = args->valuelen;
2099 while (valuelen > 0) { 2095 while (valuelen > 0) {
2096 int buflen;
2097
2100 /* 2098 /*
2101 * Try to remember where we decided to put the value. 2099 * Try to remember where we decided to put the value.
2102 */ 2100 */
@@ -2114,15 +2112,16 @@ xfs_attr_rmtval_set(xfs_da_args_t *args)
2114 dblkno = XFS_FSB_TO_DADDR(mp, map.br_startblock), 2112 dblkno = XFS_FSB_TO_DADDR(mp, map.br_startblock),
2115 blkcnt = XFS_FSB_TO_BB(mp, map.br_blockcount); 2113 blkcnt = XFS_FSB_TO_BB(mp, map.br_blockcount);
2116 2114
2117 bp = xfs_buf_get(mp->m_ddev_targp, dblkno, blkcnt, 2115 bp = xfs_buf_get(mp->m_ddev_targp, dblkno, blkcnt, 0);
2118 XBF_LOCK | XBF_DONT_BLOCK);
2119 if (!bp) 2116 if (!bp)
2120 return ENOMEM; 2117 return ENOMEM;
2121 tmp = (valuelen < XFS_BUF_SIZE(bp)) ? valuelen : 2118
2122 XFS_BUF_SIZE(bp); 2119 buflen = BBTOB(bp->b_length);
2120 tmp = min_t(int, valuelen, buflen);
2123 xfs_buf_iomove(bp, 0, tmp, src, XBRW_WRITE); 2121 xfs_buf_iomove(bp, 0, tmp, src, XBRW_WRITE);
2124 if (tmp < XFS_BUF_SIZE(bp)) 2122 if (tmp < buflen)
2125 xfs_buf_zero(bp, tmp, XFS_BUF_SIZE(bp) - tmp); 2123 xfs_buf_zero(bp, tmp, buflen - tmp);
2124
2126 error = xfs_bwrite(bp); /* GROT: NOTE: synchronous write */ 2125 error = xfs_bwrite(bp); /* GROT: NOTE: synchronous write */
2127 xfs_buf_relse(bp); 2126 xfs_buf_relse(bp);
2128 if (error) 2127 if (error)