diff options
author | Dave Chinner <dchinner@redhat.com> | 2014-06-06 01:21:45 -0400 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2014-06-06 01:21:45 -0400 |
commit | c2c4c477e0d02b0b352a71a25be56c9d35537265 (patch) | |
tree | c014163d3f5a2f851dd72f1c51dfe22db96eb936 /fs/xfs/xfs_attr_remote.c | |
parent | c59f0ad23af0f4d7f64d2c2cdd85ceb49f6337fa (diff) |
xfs: replace attr LBSIZE with xfs_da_geometry
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs/xfs_attr_remote.c')
-rw-r--r-- | fs/xfs/xfs_attr_remote.c | 55 |
1 files changed, 29 insertions, 26 deletions
diff --git a/fs/xfs/xfs_attr_remote.c b/fs/xfs/xfs_attr_remote.c index 0f0679a134e2..b5adfecbb8ee 100644 --- a/fs/xfs/xfs_attr_remote.c +++ b/fs/xfs/xfs_attr_remote.c | |||
@@ -125,6 +125,7 @@ xfs_attr3_rmt_read_verify( | |||
125 | char *ptr; | 125 | char *ptr; |
126 | int len; | 126 | int len; |
127 | xfs_daddr_t bno; | 127 | xfs_daddr_t bno; |
128 | int blksize = mp->m_attr_geo->blksize; | ||
128 | 129 | ||
129 | /* no verification of non-crc buffers */ | 130 | /* no verification of non-crc buffers */ |
130 | if (!xfs_sb_version_hascrc(&mp->m_sb)) | 131 | if (!xfs_sb_version_hascrc(&mp->m_sb)) |
@@ -133,21 +134,20 @@ xfs_attr3_rmt_read_verify( | |||
133 | ptr = bp->b_addr; | 134 | ptr = bp->b_addr; |
134 | bno = bp->b_bn; | 135 | bno = bp->b_bn; |
135 | len = BBTOB(bp->b_length); | 136 | len = BBTOB(bp->b_length); |
136 | ASSERT(len >= XFS_LBSIZE(mp)); | 137 | ASSERT(len >= blksize); |
137 | 138 | ||
138 | while (len > 0) { | 139 | while (len > 0) { |
139 | if (!xfs_verify_cksum(ptr, XFS_LBSIZE(mp), | 140 | if (!xfs_verify_cksum(ptr, blksize, XFS_ATTR3_RMT_CRC_OFF)) { |
140 | XFS_ATTR3_RMT_CRC_OFF)) { | ||
141 | xfs_buf_ioerror(bp, EFSBADCRC); | 141 | xfs_buf_ioerror(bp, EFSBADCRC); |
142 | break; | 142 | break; |
143 | } | 143 | } |
144 | if (!xfs_attr3_rmt_verify(mp, ptr, XFS_LBSIZE(mp), bno)) { | 144 | if (!xfs_attr3_rmt_verify(mp, ptr, blksize, bno)) { |
145 | xfs_buf_ioerror(bp, EFSCORRUPTED); | 145 | xfs_buf_ioerror(bp, EFSCORRUPTED); |
146 | break; | 146 | break; |
147 | } | 147 | } |
148 | len -= XFS_LBSIZE(mp); | 148 | len -= blksize; |
149 | ptr += XFS_LBSIZE(mp); | 149 | ptr += blksize; |
150 | bno += mp->m_bsize; | 150 | bno += BTOBB(blksize); |
151 | } | 151 | } |
152 | 152 | ||
153 | if (bp->b_error) | 153 | if (bp->b_error) |
@@ -165,6 +165,7 @@ xfs_attr3_rmt_write_verify( | |||
165 | char *ptr; | 165 | char *ptr; |
166 | int len; | 166 | int len; |
167 | xfs_daddr_t bno; | 167 | xfs_daddr_t bno; |
168 | int blksize = mp->m_attr_geo->blksize; | ||
168 | 169 | ||
169 | /* no verification of non-crc buffers */ | 170 | /* no verification of non-crc buffers */ |
170 | if (!xfs_sb_version_hascrc(&mp->m_sb)) | 171 | if (!xfs_sb_version_hascrc(&mp->m_sb)) |
@@ -173,10 +174,10 @@ xfs_attr3_rmt_write_verify( | |||
173 | ptr = bp->b_addr; | 174 | ptr = bp->b_addr; |
174 | bno = bp->b_bn; | 175 | bno = bp->b_bn; |
175 | len = BBTOB(bp->b_length); | 176 | len = BBTOB(bp->b_length); |
176 | ASSERT(len >= XFS_LBSIZE(mp)); | 177 | ASSERT(len >= blksize); |
177 | 178 | ||
178 | while (len > 0) { | 179 | while (len > 0) { |
179 | if (!xfs_attr3_rmt_verify(mp, ptr, XFS_LBSIZE(mp), bno)) { | 180 | if (!xfs_attr3_rmt_verify(mp, ptr, blksize, bno)) { |
180 | xfs_buf_ioerror(bp, EFSCORRUPTED); | 181 | xfs_buf_ioerror(bp, EFSCORRUPTED); |
181 | xfs_verifier_error(bp); | 182 | xfs_verifier_error(bp); |
182 | return; | 183 | return; |
@@ -187,11 +188,11 @@ xfs_attr3_rmt_write_verify( | |||
187 | rmt = (struct xfs_attr3_rmt_hdr *)ptr; | 188 | rmt = (struct xfs_attr3_rmt_hdr *)ptr; |
188 | rmt->rm_lsn = cpu_to_be64(bip->bli_item.li_lsn); | 189 | rmt->rm_lsn = cpu_to_be64(bip->bli_item.li_lsn); |
189 | } | 190 | } |
190 | xfs_update_cksum(ptr, XFS_LBSIZE(mp), XFS_ATTR3_RMT_CRC_OFF); | 191 | xfs_update_cksum(ptr, blksize, XFS_ATTR3_RMT_CRC_OFF); |
191 | 192 | ||
192 | len -= XFS_LBSIZE(mp); | 193 | len -= blksize; |
193 | ptr += XFS_LBSIZE(mp); | 194 | ptr += blksize; |
194 | bno += mp->m_bsize; | 195 | bno += BTOBB(blksize); |
195 | } | 196 | } |
196 | ASSERT(len == 0); | 197 | ASSERT(len == 0); |
197 | } | 198 | } |
@@ -240,12 +241,13 @@ xfs_attr_rmtval_copyout( | |||
240 | char *src = bp->b_addr; | 241 | char *src = bp->b_addr; |
241 | xfs_daddr_t bno = bp->b_bn; | 242 | xfs_daddr_t bno = bp->b_bn; |
242 | int len = BBTOB(bp->b_length); | 243 | int len = BBTOB(bp->b_length); |
244 | int blksize = mp->m_attr_geo->blksize; | ||
243 | 245 | ||
244 | ASSERT(len >= XFS_LBSIZE(mp)); | 246 | ASSERT(len >= blksize); |
245 | 247 | ||
246 | while (len > 0 && *valuelen > 0) { | 248 | while (len > 0 && *valuelen > 0) { |
247 | int hdr_size = 0; | 249 | int hdr_size = 0; |
248 | int byte_cnt = XFS_ATTR3_RMT_BUF_SPACE(mp, XFS_LBSIZE(mp)); | 250 | int byte_cnt = XFS_ATTR3_RMT_BUF_SPACE(mp, blksize); |
249 | 251 | ||
250 | byte_cnt = min(*valuelen, byte_cnt); | 252 | byte_cnt = min(*valuelen, byte_cnt); |
251 | 253 | ||
@@ -263,9 +265,9 @@ xfs_attr_rmtval_copyout( | |||
263 | memcpy(*dst, src + hdr_size, byte_cnt); | 265 | memcpy(*dst, src + hdr_size, byte_cnt); |
264 | 266 | ||
265 | /* roll buffer forwards */ | 267 | /* roll buffer forwards */ |
266 | len -= XFS_LBSIZE(mp); | 268 | len -= blksize; |
267 | src += XFS_LBSIZE(mp); | 269 | src += blksize; |
268 | bno += mp->m_bsize; | 270 | bno += BTOBB(blksize); |
269 | 271 | ||
270 | /* roll attribute data forwards */ | 272 | /* roll attribute data forwards */ |
271 | *valuelen -= byte_cnt; | 273 | *valuelen -= byte_cnt; |
@@ -287,12 +289,13 @@ xfs_attr_rmtval_copyin( | |||
287 | char *dst = bp->b_addr; | 289 | char *dst = bp->b_addr; |
288 | xfs_daddr_t bno = bp->b_bn; | 290 | xfs_daddr_t bno = bp->b_bn; |
289 | int len = BBTOB(bp->b_length); | 291 | int len = BBTOB(bp->b_length); |
292 | int blksize = mp->m_attr_geo->blksize; | ||
290 | 293 | ||
291 | ASSERT(len >= XFS_LBSIZE(mp)); | 294 | ASSERT(len >= blksize); |
292 | 295 | ||
293 | while (len > 0 && *valuelen > 0) { | 296 | while (len > 0 && *valuelen > 0) { |
294 | int hdr_size; | 297 | int hdr_size; |
295 | int byte_cnt = XFS_ATTR3_RMT_BUF_SPACE(mp, XFS_LBSIZE(mp)); | 298 | int byte_cnt = XFS_ATTR3_RMT_BUF_SPACE(mp, blksize); |
296 | 299 | ||
297 | byte_cnt = min(*valuelen, byte_cnt); | 300 | byte_cnt = min(*valuelen, byte_cnt); |
298 | hdr_size = xfs_attr3_rmt_hdr_set(mp, dst, ino, *offset, | 301 | hdr_size = xfs_attr3_rmt_hdr_set(mp, dst, ino, *offset, |
@@ -304,17 +307,17 @@ xfs_attr_rmtval_copyin( | |||
304 | * If this is the last block, zero the remainder of it. | 307 | * If this is the last block, zero the remainder of it. |
305 | * Check that we are actually the last block, too. | 308 | * Check that we are actually the last block, too. |
306 | */ | 309 | */ |
307 | if (byte_cnt + hdr_size < XFS_LBSIZE(mp)) { | 310 | if (byte_cnt + hdr_size < blksize) { |
308 | ASSERT(*valuelen - byte_cnt == 0); | 311 | ASSERT(*valuelen - byte_cnt == 0); |
309 | ASSERT(len == XFS_LBSIZE(mp)); | 312 | ASSERT(len == blksize); |
310 | memset(dst + hdr_size + byte_cnt, 0, | 313 | memset(dst + hdr_size + byte_cnt, 0, |
311 | XFS_LBSIZE(mp) - hdr_size - byte_cnt); | 314 | blksize - hdr_size - byte_cnt); |
312 | } | 315 | } |
313 | 316 | ||
314 | /* roll buffer forwards */ | 317 | /* roll buffer forwards */ |
315 | len -= XFS_LBSIZE(mp); | 318 | len -= blksize; |
316 | dst += XFS_LBSIZE(mp); | 319 | dst += blksize; |
317 | bno += mp->m_bsize; | 320 | bno += BTOBB(blksize); |
318 | 321 | ||
319 | /* roll attribute data forwards */ | 322 | /* roll attribute data forwards */ |
320 | *valuelen -= byte_cnt; | 323 | *valuelen -= byte_cnt; |