diff options
Diffstat (limited to 'fs/xfs/xfs_attr.c')
-rw-r--r-- | fs/xfs/xfs_attr.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/fs/xfs/xfs_attr.c b/fs/xfs/xfs_attr.c index 65d61b948ead..6e9bd7e46982 100644 --- a/fs/xfs/xfs_attr.c +++ b/fs/xfs/xfs_attr.c | |||
@@ -1993,8 +1993,7 @@ xfs_attr_rmtval_get(xfs_da_args_t *args) | |||
1993 | if (error) | 1993 | if (error) |
1994 | return(error); | 1994 | return(error); |
1995 | 1995 | ||
1996 | tmp = (valuelen < XFS_BUF_SIZE(bp)) | 1996 | 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); | 1997 | xfs_buf_iomove(bp, 0, tmp, dst, XBRW_READ); |
1999 | xfs_buf_relse(bp); | 1998 | xfs_buf_relse(bp); |
2000 | dst += tmp; | 1999 | dst += tmp; |
@@ -2097,6 +2096,8 @@ xfs_attr_rmtval_set(xfs_da_args_t *args) | |||
2097 | lblkno = args->rmtblkno; | 2096 | lblkno = args->rmtblkno; |
2098 | valuelen = args->valuelen; | 2097 | valuelen = args->valuelen; |
2099 | while (valuelen > 0) { | 2098 | while (valuelen > 0) { |
2099 | int buflen; | ||
2100 | |||
2100 | /* | 2101 | /* |
2101 | * Try to remember where we decided to put the value. | 2102 | * Try to remember where we decided to put the value. |
2102 | */ | 2103 | */ |
@@ -2118,11 +2119,13 @@ xfs_attr_rmtval_set(xfs_da_args_t *args) | |||
2118 | XBF_LOCK | XBF_DONT_BLOCK); | 2119 | XBF_LOCK | XBF_DONT_BLOCK); |
2119 | if (!bp) | 2120 | if (!bp) |
2120 | return ENOMEM; | 2121 | return ENOMEM; |
2121 | tmp = (valuelen < XFS_BUF_SIZE(bp)) ? valuelen : | 2122 | |
2122 | XFS_BUF_SIZE(bp); | 2123 | buflen = BBTOB(bp->b_length); |
2124 | tmp = min_t(int, valuelen, buflen); | ||
2123 | xfs_buf_iomove(bp, 0, tmp, src, XBRW_WRITE); | 2125 | xfs_buf_iomove(bp, 0, tmp, src, XBRW_WRITE); |
2124 | if (tmp < XFS_BUF_SIZE(bp)) | 2126 | if (tmp < buflen) |
2125 | xfs_buf_zero(bp, tmp, XFS_BUF_SIZE(bp) - tmp); | 2127 | xfs_buf_zero(bp, tmp, buflen - tmp); |
2128 | |||
2126 | error = xfs_bwrite(bp); /* GROT: NOTE: synchronous write */ | 2129 | error = xfs_bwrite(bp); /* GROT: NOTE: synchronous write */ |
2127 | xfs_buf_relse(bp); | 2130 | xfs_buf_relse(bp); |
2128 | if (error) | 2131 | if (error) |