@@ -103,7 +103,6 @@ xfs_rtfind_back(
103
103
int bit ; /* bit number in the word */
104
104
xfs_fileoff_t block ; /* bitmap block number */
105
105
struct xfs_buf * bp ; /* buf for the block */
106
- xfs_rtword_t * bufp ; /* starting word in buffer */
107
106
int error ; /* error value */
108
107
xfs_rtxnum_t firstbit ; /* first useful bit in the word */
109
108
xfs_rtxnum_t i ; /* current bit number rel. to start */
@@ -121,12 +120,12 @@ xfs_rtfind_back(
121
120
if (error ) {
122
121
return error ;
123
122
}
124
- bufp = bp -> b_addr ;
123
+
125
124
/*
126
125
* Get the first word's index & point to it.
127
126
*/
128
127
word = xfs_rtx_to_rbmword (mp , start );
129
- b = & bufp [ word ] ;
128
+ b = xfs_rbmblock_wordptr ( bp , word ) ;
130
129
bit = (int )(start & (XFS_NBWORD - 1 ));
131
130
len = start - limit + 1 ;
132
131
/*
@@ -173,9 +172,9 @@ xfs_rtfind_back(
173
172
if (error ) {
174
173
return error ;
175
174
}
176
- bufp = bp -> b_addr ;
175
+
177
176
word = mp -> m_blockwsize - 1 ;
178
- b = & bufp [ word ] ;
177
+ b = xfs_rbmblock_wordptr ( bp , word ) ;
179
178
} else {
180
179
/*
181
180
* Go on to the previous word in the buffer.
@@ -219,9 +218,9 @@ xfs_rtfind_back(
219
218
if (error ) {
220
219
return error ;
221
220
}
222
- bufp = bp -> b_addr ;
221
+
223
222
word = mp -> m_blockwsize - 1 ;
224
- b = & bufp [ word ] ;
223
+ b = xfs_rbmblock_wordptr ( bp , word ) ;
225
224
} else {
226
225
/*
227
226
* Go on to the previous word in the buffer.
@@ -278,7 +277,6 @@ xfs_rtfind_forw(
278
277
int bit ; /* bit number in the word */
279
278
xfs_fileoff_t block ; /* bitmap block number */
280
279
struct xfs_buf * bp ; /* buf for the block */
281
- xfs_rtword_t * bufp ; /* starting word in buffer */
282
280
int error ; /* error value */
283
281
xfs_rtxnum_t i ; /* current bit number rel. to start */
284
282
xfs_rtxnum_t lastbit ; /* last useful bit in the word */
@@ -296,12 +294,12 @@ xfs_rtfind_forw(
296
294
if (error ) {
297
295
return error ;
298
296
}
299
- bufp = bp -> b_addr ;
297
+
300
298
/*
301
299
* Get the first word's index & point to it.
302
300
*/
303
301
word = xfs_rtx_to_rbmword (mp , start );
304
- b = & bufp [ word ] ;
302
+ b = xfs_rbmblock_wordptr ( bp , word ) ;
305
303
bit = (int )(start & (XFS_NBWORD - 1 ));
306
304
len = limit - start + 1 ;
307
305
/*
@@ -347,8 +345,9 @@ xfs_rtfind_forw(
347
345
if (error ) {
348
346
return error ;
349
347
}
350
- b = bufp = bp -> b_addr ;
348
+
351
349
word = 0 ;
350
+ b = xfs_rbmblock_wordptr (bp , word );
352
351
} else {
353
352
/*
354
353
* Go on to the previous word in the buffer.
@@ -392,8 +391,9 @@ xfs_rtfind_forw(
392
391
if (error ) {
393
392
return error ;
394
393
}
395
- b = bufp = bp -> b_addr ;
394
+
396
395
word = 0 ;
396
+ b = xfs_rbmblock_wordptr (bp , word );
397
397
} else {
398
398
/*
399
399
* Go on to the next word in the buffer.
@@ -541,7 +541,6 @@ xfs_rtmodify_range(
541
541
int bit ; /* bit number in the word */
542
542
xfs_fileoff_t block ; /* bitmap block number */
543
543
struct xfs_buf * bp ; /* buf for the block */
544
- xfs_rtword_t * bufp ; /* starting word in buffer */
545
544
int error ; /* error value */
546
545
xfs_rtword_t * first ; /* first used word in the buffer */
547
546
int i ; /* current bit number rel. to start */
@@ -560,12 +559,12 @@ xfs_rtmodify_range(
560
559
if (error ) {
561
560
return error ;
562
561
}
563
- bufp = bp -> b_addr ;
562
+
564
563
/*
565
564
* Compute the starting word's address, and starting bit.
566
565
*/
567
566
word = xfs_rtx_to_rbmword (mp , start );
568
- first = b = & bufp [ word ] ;
567
+ first = b = xfs_rbmblock_wordptr ( bp , word ) ;
569
568
bit = (int )(start & (XFS_NBWORD - 1 ));
570
569
/*
571
570
* 0 (allocated) => all zeroes; 1 (free) => all ones.
@@ -599,14 +598,15 @@ xfs_rtmodify_range(
599
598
* Get the next one.
600
599
*/
601
600
xfs_trans_log_buf (tp , bp ,
602
- (uint )((char * )first - (char * )bufp ),
603
- (uint )((char * )b - (char * )bufp ));
601
+ (uint )((char * )first - (char * )bp -> b_addr ),
602
+ (uint )((char * )b - (char * )bp -> b_addr ));
604
603
error = xfs_rtbuf_get (mp , tp , ++ block , 0 , & bp );
605
604
if (error ) {
606
605
return error ;
607
606
}
608
- first = b = bufp = bp -> b_addr ;
607
+
609
608
word = 0 ;
609
+ first = b = xfs_rbmblock_wordptr (bp , word );
610
610
} else {
611
611
/*
612
612
* Go on to the next word in the buffer
@@ -639,14 +639,15 @@ xfs_rtmodify_range(
639
639
* Get the next one.
640
640
*/
641
641
xfs_trans_log_buf (tp , bp ,
642
- (uint )((char * )first - (char * )bufp ),
643
- (uint )((char * )b - (char * )bufp ));
642
+ (uint )((char * )first - (char * )bp -> b_addr ),
643
+ (uint )((char * )b - (char * )bp -> b_addr ));
644
644
error = xfs_rtbuf_get (mp , tp , ++ block , 0 , & bp );
645
645
if (error ) {
646
646
return error ;
647
647
}
648
- first = b = bufp = bp -> b_addr ;
648
+
649
649
word = 0 ;
650
+ first = b = xfs_rbmblock_wordptr (bp , word );
650
651
} else {
651
652
/*
652
653
* Go on to the next word in the buffer
@@ -676,8 +677,9 @@ xfs_rtmodify_range(
676
677
* Log any remaining changed bytes.
677
678
*/
678
679
if (b > first )
679
- xfs_trans_log_buf (tp , bp , (uint )((char * )first - (char * )bufp ),
680
- (uint )((char * )b - (char * )bufp - 1 ));
680
+ xfs_trans_log_buf (tp , bp ,
681
+ (uint )((char * )first - (char * )bp -> b_addr ),
682
+ (uint )((char * )b - (char * )bp -> b_addr - 1 ));
681
683
return 0 ;
682
684
}
683
685
@@ -775,7 +777,6 @@ xfs_rtcheck_range(
775
777
int bit ; /* bit number in the word */
776
778
xfs_fileoff_t block ; /* bitmap block number */
777
779
struct xfs_buf * bp ; /* buf for the block */
778
- xfs_rtword_t * bufp ; /* starting word in buffer */
779
780
int error ; /* error value */
780
781
xfs_rtxnum_t i ; /* current bit number rel. to start */
781
782
xfs_rtxnum_t lastbit ; /* last useful bit in word */
@@ -794,12 +795,12 @@ xfs_rtcheck_range(
794
795
if (error ) {
795
796
return error ;
796
797
}
797
- bufp = bp -> b_addr ;
798
+
798
799
/*
799
800
* Compute the starting word's address, and starting bit.
800
801
*/
801
802
word = xfs_rtx_to_rbmword (mp , start );
802
- b = & bufp [ word ] ;
803
+ b = xfs_rbmblock_wordptr ( bp , word ) ;
803
804
bit = (int )(start & (XFS_NBWORD - 1 ));
804
805
/*
805
806
* 0 (allocated) => all zero's; 1 (free) => all one's.
@@ -845,8 +846,9 @@ xfs_rtcheck_range(
845
846
if (error ) {
846
847
return error ;
847
848
}
848
- b = bufp = bp -> b_addr ;
849
+
849
850
word = 0 ;
851
+ b = xfs_rbmblock_wordptr (bp , word );
850
852
} else {
851
853
/*
852
854
* Go on to the next word in the buffer.
@@ -891,8 +893,9 @@ xfs_rtcheck_range(
891
893
if (error ) {
892
894
return error ;
893
895
}
894
- b = bufp = bp -> b_addr ;
896
+
895
897
word = 0 ;
898
+ b = xfs_rbmblock_wordptr (bp , word );
896
899
} else {
897
900
/*
898
901
* Go on to the next word in the buffer.
0 commit comments