Beispiel #1
0
 def execute(self, args: argparse.Namespace) -> None:
     if args.d:
         print("{:^5} {:^16} {:^10} {:^16} {:^5} {:^5} {:^5} {:^5}".format(
             "MAJOR", "GENDISK", "NAME", "REQUEST_QUEUE", "TOTAL", "ASYNC",
             "SYNC", "DRV"))
         for disk in for_each_disk():
             stats = queue_request_stats(disk['queue'])
             print("{:5d} {:016x} {:<10} {:016x} {:5d} {:5d} {:5d} {:5d}".
                   format(int(disk['major']), int(disk.address),
                          gendisk_name(disk), int(disk['queue']),
                          stats[0] + stats[1], stats[0], stats[1],
                          stats[2] + stats[3]))
Beispiel #2
0
 def test_for_each_disk(self):
     for bdev in storage.for_each_disk():
         self.assertTrue(type(bdev) is gdb.Value)
         self.assertTrue(bdev.type == storage.types.gendisk_type)
# This script dumps stuck requests for every disk on the system

from crash.subsystem.storage import for_each_disk
from crash.subsystem.storage.decoders import for_each_bio_in_stack
from crash.subsystem.storage import gendisk_name
from crash.subsystem.storage.block import for_each_request_in_queue
from crash.types.list import list_for_each_entry
from crash.util import get_symbol_value
from crash.cache.syscache import kernel, jiffies_to_msec

empty = []

flush_end_io = get_symbol_value('flush_end_io')

for b in for_each_disk():
    name = gendisk_name(b)
    count = 0
    for r in for_each_request_in_queue(b['queue']):
        age_in_jiffies = kernel.jiffies - r['start_time']
        age = float(int(kernel.jiffies_to_msec(age_in_jiffies))) / 1000
        if count == 0:
            print name
        if r['bio']:
            print "{}: {:x} request: age={}s, bio chain".format(
                count, int(r.address), age, int(r['bio']))
            n = 0
            for entry in for_each_bio_in_stack(r['bio']):
                print "  {}: {}".format(n, entry['description'])
                n += 1
        else: