72
72
xfs_rtbuf_get (
73
73
struct xfs_rtalloc_args * args ,
74
74
xfs_fileoff_t block , /* block number in bitmap or summary */
75
- int issum , /* is summary not bitmap */
76
- struct xfs_buf * * bpp ) /* output: buffer for the block */
75
+ int issum ) /* is summary not bitmap */
77
76
{
78
77
struct xfs_mount * mp = args -> mp ;
79
78
struct xfs_buf * * cbpp ; /* cached block buffer */
@@ -100,10 +99,9 @@ xfs_rtbuf_get(
100
99
/*
101
100
* If we have a cached buffer, and the block number matches, use that.
102
101
*/
103
- if (* cbpp && * coffp == block ) {
104
- * bpp = * cbpp ;
102
+ if (* cbpp && * coffp == block )
105
103
return 0 ;
106
- }
104
+
107
105
/*
108
106
* Otherwise we have to have to get the buffer. If there was an old
109
107
* one, get rid of it first.
@@ -128,7 +126,7 @@ xfs_rtbuf_get(
128
126
return error ;
129
127
130
128
xfs_trans_buf_set_type (args -> tp , bp , type );
131
- * cbpp = * bpp = bp ;
129
+ * cbpp = bp ;
132
130
* coffp = block ;
133
131
return 0 ;
134
132
}
@@ -147,7 +145,6 @@ xfs_rtfind_back(
147
145
struct xfs_mount * mp = args -> mp ;
148
146
int bit ; /* bit number in the word */
149
147
xfs_fileoff_t block ; /* bitmap block number */
150
- struct xfs_buf * bp ; /* buf for the block */
151
148
int error ; /* error value */
152
149
xfs_rtxnum_t firstbit ; /* first useful bit in the word */
153
150
xfs_rtxnum_t i ; /* current bit number rel. to start */
@@ -162,10 +159,9 @@ xfs_rtfind_back(
162
159
* Compute and read in starting bitmap block for starting block.
163
160
*/
164
161
block = xfs_rtx_to_rbmblock (mp , start );
165
- error = xfs_rtbuf_get (args , block , 0 , & bp );
166
- if (error ) {
162
+ error = xfs_rtbitmap_read_buf (args , block );
163
+ if (error )
167
164
return error ;
168
- }
169
165
170
166
/*
171
167
* Get the first word's index & point to it.
@@ -177,7 +173,7 @@ xfs_rtfind_back(
177
173
* Compute match value, based on the bit at start: if 1 (free)
178
174
* then all-ones, else all-zeroes.
179
175
*/
180
- incore = xfs_rtbitmap_getword (bp , word );
176
+ incore = xfs_rtbitmap_getword (args -> rbmbp , word );
181
177
want = (incore & ((xfs_rtword_t )1 << bit )) ? -1 : 0 ;
182
178
/*
183
179
* If the starting position is not word-aligned, deal with the
@@ -212,10 +208,9 @@ xfs_rtfind_back(
212
208
/*
213
209
* If done with this block, get the previous one.
214
210
*/
215
- error = xfs_rtbuf_get (args , -- block , 0 , & bp );
216
- if (error ) {
211
+ error = xfs_rtbitmap_read_buf (args , -- block );
212
+ if (error )
217
213
return error ;
218
- }
219
214
220
215
word = mp -> m_blockwsize - 1 ;
221
216
}
@@ -233,7 +228,7 @@ xfs_rtfind_back(
233
228
/*
234
229
* Compute difference between actual and desired value.
235
230
*/
236
- incore = xfs_rtbitmap_getword (bp , word );
231
+ incore = xfs_rtbitmap_getword (args -> rbmbp , word );
237
232
if ((wdiff = incore ^ want )) {
238
233
/*
239
234
* Different, mark where we are and return.
@@ -251,10 +246,9 @@ xfs_rtfind_back(
251
246
/*
252
247
* If done with this block, get the previous one.
253
248
*/
254
- error = xfs_rtbuf_get (args , -- block , 0 , & bp );
255
- if (error ) {
249
+ error = xfs_rtbitmap_read_buf (args , -- block );
250
+ if (error )
256
251
return error ;
257
- }
258
252
259
253
word = mp -> m_blockwsize - 1 ;
260
254
}
@@ -273,7 +267,7 @@ xfs_rtfind_back(
273
267
/*
274
268
* Compute difference between actual and desired value.
275
269
*/
276
- incore = xfs_rtbitmap_getword (bp , word );
270
+ incore = xfs_rtbitmap_getword (args -> rbmbp , word );
277
271
if ((wdiff = (incore ^ want ) & mask )) {
278
272
/*
279
273
* Different, mark where we are and return.
@@ -305,7 +299,6 @@ xfs_rtfind_forw(
305
299
struct xfs_mount * mp = args -> mp ;
306
300
int bit ; /* bit number in the word */
307
301
xfs_fileoff_t block ; /* bitmap block number */
308
- struct xfs_buf * bp ; /* buf for the block */
309
302
int error ;
310
303
xfs_rtxnum_t i ; /* current bit number rel. to start */
311
304
xfs_rtxnum_t lastbit ;/* last useful bit in the word */
@@ -320,10 +313,9 @@ xfs_rtfind_forw(
320
313
* Compute and read in starting bitmap block for starting block.
321
314
*/
322
315
block = xfs_rtx_to_rbmblock (mp , start );
323
- error = xfs_rtbuf_get (args , block , 0 , & bp );
324
- if (error ) {
316
+ error = xfs_rtbitmap_read_buf (args , block );
317
+ if (error )
325
318
return error ;
326
- }
327
319
328
320
/*
329
321
* Get the first word's index & point to it.
@@ -335,7 +327,7 @@ xfs_rtfind_forw(
335
327
* Compute match value, based on the bit at start: if 1 (free)
336
328
* then all-ones, else all-zeroes.
337
329
*/
338
- incore = xfs_rtbitmap_getword (bp , word );
330
+ incore = xfs_rtbitmap_getword (args -> rbmbp , word );
339
331
want = (incore & ((xfs_rtword_t )1 << bit )) ? -1 : 0 ;
340
332
/*
341
333
* If the starting position is not word-aligned, deal with the
@@ -369,10 +361,9 @@ xfs_rtfind_forw(
369
361
/*
370
362
* If done with this block, get the previous one.
371
363
*/
372
- error = xfs_rtbuf_get (args , ++ block , 0 , & bp );
373
- if (error ) {
364
+ error = xfs_rtbitmap_read_buf (args , ++ block );
365
+ if (error )
374
366
return error ;
375
- }
376
367
377
368
word = 0 ;
378
369
}
@@ -390,7 +381,7 @@ xfs_rtfind_forw(
390
381
/*
391
382
* Compute difference between actual and desired value.
392
383
*/
393
- incore = xfs_rtbitmap_getword (bp , word );
384
+ incore = xfs_rtbitmap_getword (args -> rbmbp , word );
394
385
if ((wdiff = incore ^ want )) {
395
386
/*
396
387
* Different, mark where we are and return.
@@ -408,10 +399,9 @@ xfs_rtfind_forw(
408
399
/*
409
400
* If done with this block, get the next one.
410
401
*/
411
- error = xfs_rtbuf_get (args , ++ block , 0 , & bp );
412
- if (error ) {
402
+ error = xfs_rtbitmap_read_buf (args , ++ block );
403
+ if (error )
413
404
return error ;
414
- }
415
405
416
406
word = 0 ;
417
407
}
@@ -428,7 +418,7 @@ xfs_rtfind_forw(
428
418
/*
429
419
* Compute difference between actual and desired value.
430
420
*/
431
- incore = xfs_rtbitmap_getword (bp , word );
421
+ incore = xfs_rtbitmap_getword (args -> rbmbp , word );
432
422
if ((wdiff = (incore ^ want ) & mask )) {
433
423
/*
434
424
* Different, mark where we are and return.
@@ -479,7 +469,6 @@ xfs_rtmodify_summary_int(
479
469
xfs_suminfo_t * sum ) /* out: summary info for this block */
480
470
{
481
471
struct xfs_mount * mp = args -> mp ;
482
- struct xfs_buf * bp ; /* buffer for the summary block */
483
472
int error ;
484
473
xfs_fileoff_t sb ; /* summary fsblock */
485
474
xfs_rtsumoff_t so ; /* index into the summary file */
@@ -494,7 +483,7 @@ xfs_rtmodify_summary_int(
494
483
*/
495
484
sb = xfs_rtsumoffs_to_block (mp , so );
496
485
497
- error = xfs_rtbuf_get (args , sb , 1 , & bp );
486
+ error = xfs_rtsummary_read_buf (args , sb );
498
487
if (error )
499
488
return error ;
500
489
@@ -503,19 +492,20 @@ xfs_rtmodify_summary_int(
503
492
*/
504
493
infoword = xfs_rtsumoffs_to_infoword (mp , so );
505
494
if (delta ) {
506
- xfs_suminfo_t val = xfs_suminfo_add (bp , infoword , delta );
495
+ xfs_suminfo_t val = xfs_suminfo_add (args -> sumbp , infoword ,
496
+ delta );
507
497
508
498
if (mp -> m_rsum_cache ) {
509
499
if (val == 0 && log == mp -> m_rsum_cache [bbno ])
510
500
mp -> m_rsum_cache [bbno ]++ ;
511
501
if (val != 0 && log < mp -> m_rsum_cache [bbno ])
512
502
mp -> m_rsum_cache [bbno ] = log ;
513
503
}
514
- xfs_trans_log_rtsummary (args -> tp , bp , infoword );
504
+ xfs_trans_log_rtsummary (args -> tp , args -> sumbp , infoword );
515
505
if (sum )
516
506
* sum = val ;
517
507
} else if (sum ) {
518
- * sum = xfs_suminfo_get (bp , infoword );
508
+ * sum = xfs_suminfo_get (args -> sumbp , infoword );
519
509
}
520
510
return 0 ;
521
511
}
@@ -560,7 +550,6 @@ xfs_rtmodify_range(
560
550
struct xfs_mount * mp = args -> mp ;
561
551
int bit ; /* bit number in the word */
562
552
xfs_fileoff_t block ; /* bitmap block number */
563
- struct xfs_buf * bp ; /* buf for the block */
564
553
int error ;
565
554
int i ; /* current bit number rel. to start */
566
555
int lastbit ; /* last useful bit in word */
@@ -576,10 +565,9 @@ xfs_rtmodify_range(
576
565
/*
577
566
* Read the bitmap block, and point to its data.
578
567
*/
579
- error = xfs_rtbuf_get (args , block , 0 , & bp );
580
- if (error ) {
568
+ error = xfs_rtbitmap_read_buf (args , block );
569
+ if (error )
581
570
return error ;
582
- }
583
571
584
572
/*
585
573
* Compute the starting word's address, and starting bit.
@@ -603,12 +591,12 @@ xfs_rtmodify_range(
603
591
/*
604
592
* Set/clear the active bits.
605
593
*/
606
- incore = xfs_rtbitmap_getword (bp , word );
594
+ incore = xfs_rtbitmap_getword (args -> rbmbp , word );
607
595
if (val )
608
596
incore |= mask ;
609
597
else
610
598
incore &= ~mask ;
611
- xfs_rtbitmap_setword (bp , word , incore );
599
+ xfs_rtbitmap_setword (args -> rbmbp , word , incore );
612
600
i = lastbit - bit ;
613
601
/*
614
602
* Go on to the next block if that's where the next word is
@@ -619,12 +607,11 @@ xfs_rtmodify_range(
619
607
* Log the changed part of this block.
620
608
* Get the next one.
621
609
*/
622
- xfs_trans_log_rtbitmap (args -> tp , bp , firstword ,
610
+ xfs_trans_log_rtbitmap (args -> tp , args -> rbmbp , firstword ,
623
611
word );
624
- error = xfs_rtbuf_get (args , ++ block , 0 , & bp );
625
- if (error ) {
612
+ error = xfs_rtbitmap_read_buf (args , ++ block );
613
+ if (error )
626
614
return error ;
627
- }
628
615
629
616
firstword = word = 0 ;
630
617
}
@@ -642,7 +629,7 @@ xfs_rtmodify_range(
642
629
/*
643
630
* Set the word value correctly.
644
631
*/
645
- xfs_rtbitmap_setword (bp , word , val );
632
+ xfs_rtbitmap_setword (args -> rbmbp , word , val );
646
633
i += XFS_NBWORD ;
647
634
/*
648
635
* Go on to the next block if that's where the next word is
@@ -653,9 +640,9 @@ xfs_rtmodify_range(
653
640
* Log the changed part of this block.
654
641
* Get the next one.
655
642
*/
656
- xfs_trans_log_rtbitmap (args -> tp , bp , firstword ,
643
+ xfs_trans_log_rtbitmap (args -> tp , args -> rbmbp , firstword ,
657
644
word );
658
- error = xfs_rtbuf_get (args , ++ block , 0 , & bp );
645
+ error = xfs_rtbitmap_read_buf (args , ++ block );
659
646
if (error )
660
647
return error ;
661
648
@@ -674,19 +661,19 @@ xfs_rtmodify_range(
674
661
/*
675
662
* Set/clear the active bits.
676
663
*/
677
- incore = xfs_rtbitmap_getword (bp , word );
664
+ incore = xfs_rtbitmap_getword (args -> rbmbp , word );
678
665
if (val )
679
666
incore |= mask ;
680
667
else
681
668
incore &= ~mask ;
682
- xfs_rtbitmap_setword (bp , word , incore );
669
+ xfs_rtbitmap_setword (args -> rbmbp , word , incore );
683
670
word ++ ;
684
671
}
685
672
/*
686
673
* Log any remaining changed bytes.
687
674
*/
688
675
if (word > firstword )
689
- xfs_trans_log_rtbitmap (args -> tp , bp , firstword , word );
676
+ xfs_trans_log_rtbitmap (args -> tp , args -> rbmbp , firstword , word );
690
677
return 0 ;
691
678
}
692
679
@@ -779,7 +766,6 @@ xfs_rtcheck_range(
779
766
struct xfs_mount * mp = args -> mp ;
780
767
int bit ; /* bit number in the word */
781
768
xfs_fileoff_t block ; /* bitmap block number */
782
- struct xfs_buf * bp ; /* buf for the block */
783
769
int error ;
784
770
xfs_rtxnum_t i ; /* current bit number rel. to start */
785
771
xfs_rtxnum_t lastbit ; /* last useful bit in word */
@@ -795,10 +781,9 @@ xfs_rtcheck_range(
795
781
/*
796
782
* Read the bitmap block.
797
783
*/
798
- error = xfs_rtbuf_get (args , block , 0 , & bp );
799
- if (error ) {
784
+ error = xfs_rtbitmap_read_buf (args , block );
785
+ if (error )
800
786
return error ;
801
- }
802
787
803
788
/*
804
789
* Compute the starting word's address, and starting bit.
@@ -825,7 +810,7 @@ xfs_rtcheck_range(
825
810
/*
826
811
* Compute difference between actual and desired value.
827
812
*/
828
- incore = xfs_rtbitmap_getword (bp , word );
813
+ incore = xfs_rtbitmap_getword (args -> rbmbp , word );
829
814
if ((wdiff = (incore ^ val ) & mask )) {
830
815
/*
831
816
* Different, compute first wrong bit and return.
@@ -844,10 +829,9 @@ xfs_rtcheck_range(
844
829
/*
845
830
* If done with this block, get the next one.
846
831
*/
847
- error = xfs_rtbuf_get (args , ++ block , 0 , & bp );
848
- if (error ) {
832
+ error = xfs_rtbitmap_read_buf (args , ++ block );
833
+ if (error )
849
834
return error ;
850
- }
851
835
852
836
word = 0 ;
853
837
}
@@ -865,7 +849,7 @@ xfs_rtcheck_range(
865
849
/*
866
850
* Compute difference between actual and desired value.
867
851
*/
868
- incore = xfs_rtbitmap_getword (bp , word );
852
+ incore = xfs_rtbitmap_getword (args -> rbmbp , word );
869
853
if ((wdiff = incore ^ val )) {
870
854
/*
871
855
* Different, compute first wrong bit and return.
@@ -884,10 +868,9 @@ xfs_rtcheck_range(
884
868
/*
885
869
* If done with this block, get the next one.
886
870
*/
887
- error = xfs_rtbuf_get (args , ++ block , 0 , & bp );
888
- if (error ) {
871
+ error = xfs_rtbitmap_read_buf (args , ++ block );
872
+ if (error )
889
873
return error ;
890
- }
891
874
892
875
word = 0 ;
893
876
}
@@ -904,7 +887,7 @@ xfs_rtcheck_range(
904
887
/*
905
888
* Compute difference between actual and desired value.
906
889
*/
907
- incore = xfs_rtbitmap_getword (bp , word );
890
+ incore = xfs_rtbitmap_getword (args -> rbmbp , word );
908
891
if ((wdiff = (incore ^ val ) & mask )) {
909
892
/*
910
893
* Different, compute first wrong bit and return.
0 commit comments