• Kent Overstreet's avatar
    bcachefs: __bch2_read(): call trans_begin() on every loop iter · 1d18b5ca
    Kent Overstreet authored
    perusal of /sys/kernel/debug/bcachefs/*/btree_transaction_stats shows
    that the read path has been acculumalating unneeded paths on the reflink
    btree, which we don't want.
    
    The solution is to call bch2_trans_begin(), which drops paths not used
    on previous loop iteration.
    
    bch2_readahead:
      Max mem used: 0
      Transaction duration:
        count:      194235
                               since mount        recent
        duration of events
          min:                      150 ns
          max:                        9 ms
          total:                    838 ms
          mean:                       4 us          6 us
          stddev:                    34 us          7 us
        time between events
          min:                       10 ns
          max:                       15 h
          mean:                       2 s          12 s
          stddev:                     2 s           3 ms
      Maximum allocated btree paths (193):
        path: idx  2 ref 0:0 P   btree=extents l=0 pos 270943112:392:U32_MAX locks 0
        path: idx  3 ref 1:0   S btree=extents l=0 pos 270943112:24578:U32_MAX locks 1
        path: idx  4 ref 0:0 P   btree=reflink l=0 pos 0:24773509:0 locks 0
        path: idx  5 ref 0:0 P S btree=reflink l=0 pos 0:24773631:0 locks 1
        path: idx  6 ref 0:0 P S btree=reflink l=0 pos 0:24773759:0 locks 1
        path: idx  7 ref 0:0 P S btree=reflink l=0 pos 0:24773887:0 locks 1
        path: idx  8 ref 0:0 P S btree=reflink l=0 pos 0:24774015:0 locks 1
        path: idx  9 ref 0:0 P S btree=reflink l=0 pos 0:24774143:0 locks 1
        path: idx 10 ref 0:0 P S btree=reflink l=0 pos 0:24774271:0 locks 1
    <many more reflink paths>
    Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
    1d18b5ca
io_read.c 31.5 KB