@@ -103,7 +103,6 @@ xfs_rtfind_back(
103103 int bit ; /* bit number in the word */
104104 xfs_fileoff_t block ; /* bitmap block number */
105105 struct xfs_buf * bp ; /* buf for the block */
106- xfs_rtword_t * bufp ; /* starting word in buffer */
107106 int error ; /* error value */
108107 xfs_rtxnum_t firstbit ; /* first useful bit in the word */
109108 xfs_rtxnum_t i ; /* current bit number rel. to start */
@@ -121,12 +120,12 @@ xfs_rtfind_back(
121120 if (error ) {
122121 return error ;
123122 }
124- bufp = bp -> b_addr ;
123+
125124 /*
126125 * Get the first word's index & point to it.
127126 */
128127 word = xfs_rtx_to_rbmword (mp , start );
129- b = & bufp [ word ] ;
128+ b = xfs_rbmblock_wordptr ( bp , word ) ;
130129 bit = (int )(start & (XFS_NBWORD - 1 ));
131130 len = start - limit + 1 ;
132131 /*
@@ -173,9 +172,9 @@ xfs_rtfind_back(
173172 if (error ) {
174173 return error ;
175174 }
176- bufp = bp -> b_addr ;
175+
177176 word = mp -> m_blockwsize - 1 ;
178- b = & bufp [ word ] ;
177+ b = xfs_rbmblock_wordptr ( bp , word ) ;
179178 } else {
180179 /*
181180 * Go on to the previous word in the buffer.
@@ -219,9 +218,9 @@ xfs_rtfind_back(
219218 if (error ) {
220219 return error ;
221220 }
222- bufp = bp -> b_addr ;
221+
223222 word = mp -> m_blockwsize - 1 ;
224- b = & bufp [ word ] ;
223+ b = xfs_rbmblock_wordptr ( bp , word ) ;
225224 } else {
226225 /*
227226 * Go on to the previous word in the buffer.
@@ -278,7 +277,6 @@ xfs_rtfind_forw(
278277 int bit ; /* bit number in the word */
279278 xfs_fileoff_t block ; /* bitmap block number */
280279 struct xfs_buf * bp ; /* buf for the block */
281- xfs_rtword_t * bufp ; /* starting word in buffer */
282280 int error ; /* error value */
283281 xfs_rtxnum_t i ; /* current bit number rel. to start */
284282 xfs_rtxnum_t lastbit ; /* last useful bit in the word */
@@ -296,12 +294,12 @@ xfs_rtfind_forw(
296294 if (error ) {
297295 return error ;
298296 }
299- bufp = bp -> b_addr ;
297+
300298 /*
301299 * Get the first word's index & point to it.
302300 */
303301 word = xfs_rtx_to_rbmword (mp , start );
304- b = & bufp [ word ] ;
302+ b = xfs_rbmblock_wordptr ( bp , word ) ;
305303 bit = (int )(start & (XFS_NBWORD - 1 ));
306304 len = limit - start + 1 ;
307305 /*
@@ -347,8 +345,9 @@ xfs_rtfind_forw(
347345 if (error ) {
348346 return error ;
349347 }
350- b = bufp = bp -> b_addr ;
348+
351349 word = 0 ;
350+ b = xfs_rbmblock_wordptr (bp , word );
352351 } else {
353352 /*
354353 * Go on to the previous word in the buffer.
@@ -392,8 +391,9 @@ xfs_rtfind_forw(
392391 if (error ) {
393392 return error ;
394393 }
395- b = bufp = bp -> b_addr ;
394+
396395 word = 0 ;
396+ b = xfs_rbmblock_wordptr (bp , word );
397397 } else {
398398 /*
399399 * Go on to the next word in the buffer.
@@ -541,7 +541,6 @@ xfs_rtmodify_range(
541541 int bit ; /* bit number in the word */
542542 xfs_fileoff_t block ; /* bitmap block number */
543543 struct xfs_buf * bp ; /* buf for the block */
544- xfs_rtword_t * bufp ; /* starting word in buffer */
545544 int error ; /* error value */
546545 xfs_rtword_t * first ; /* first used word in the buffer */
547546 int i ; /* current bit number rel. to start */
@@ -560,12 +559,12 @@ xfs_rtmodify_range(
560559 if (error ) {
561560 return error ;
562561 }
563- bufp = bp -> b_addr ;
562+
564563 /*
565564 * Compute the starting word's address, and starting bit.
566565 */
567566 word = xfs_rtx_to_rbmword (mp , start );
568- first = b = & bufp [ word ] ;
567+ first = b = xfs_rbmblock_wordptr ( bp , word ) ;
569568 bit = (int )(start & (XFS_NBWORD - 1 ));
570569 /*
571570 * 0 (allocated) => all zeroes; 1 (free) => all ones.
@@ -599,14 +598,15 @@ xfs_rtmodify_range(
599598 * Get the next one.
600599 */
601600 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 ));
604603 error = xfs_rtbuf_get (mp , tp , ++ block , 0 , & bp );
605604 if (error ) {
606605 return error ;
607606 }
608- first = b = bufp = bp -> b_addr ;
607+
609608 word = 0 ;
609+ first = b = xfs_rbmblock_wordptr (bp , word );
610610 } else {
611611 /*
612612 * Go on to the next word in the buffer
@@ -639,14 +639,15 @@ xfs_rtmodify_range(
639639 * Get the next one.
640640 */
641641 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 ));
644644 error = xfs_rtbuf_get (mp , tp , ++ block , 0 , & bp );
645645 if (error ) {
646646 return error ;
647647 }
648- first = b = bufp = bp -> b_addr ;
648+
649649 word = 0 ;
650+ first = b = xfs_rbmblock_wordptr (bp , word );
650651 } else {
651652 /*
652653 * Go on to the next word in the buffer
@@ -676,8 +677,9 @@ xfs_rtmodify_range(
676677 * Log any remaining changed bytes.
677678 */
678679 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 ));
681683 return 0 ;
682684}
683685
@@ -775,7 +777,6 @@ xfs_rtcheck_range(
775777 int bit ; /* bit number in the word */
776778 xfs_fileoff_t block ; /* bitmap block number */
777779 struct xfs_buf * bp ; /* buf for the block */
778- xfs_rtword_t * bufp ; /* starting word in buffer */
779780 int error ; /* error value */
780781 xfs_rtxnum_t i ; /* current bit number rel. to start */
781782 xfs_rtxnum_t lastbit ; /* last useful bit in word */
@@ -794,12 +795,12 @@ xfs_rtcheck_range(
794795 if (error ) {
795796 return error ;
796797 }
797- bufp = bp -> b_addr ;
798+
798799 /*
799800 * Compute the starting word's address, and starting bit.
800801 */
801802 word = xfs_rtx_to_rbmword (mp , start );
802- b = & bufp [ word ] ;
803+ b = xfs_rbmblock_wordptr ( bp , word ) ;
803804 bit = (int )(start & (XFS_NBWORD - 1 ));
804805 /*
805806 * 0 (allocated) => all zero's; 1 (free) => all one's.
@@ -845,8 +846,9 @@ xfs_rtcheck_range(
845846 if (error ) {
846847 return error ;
847848 }
848- b = bufp = bp -> b_addr ;
849+
849850 word = 0 ;
851+ b = xfs_rbmblock_wordptr (bp , word );
850852 } else {
851853 /*
852854 * Go on to the next word in the buffer.
@@ -891,8 +893,9 @@ xfs_rtcheck_range(
891893 if (error ) {
892894 return error ;
893895 }
894- b = bufp = bp -> b_addr ;
896+
895897 word = 0 ;
898+ b = xfs_rbmblock_wordptr (bp , word );
896899 } else {
897900 /*
898901 * Go on to the next word in the buffer.
0 commit comments