1. 25 Jan, 2020 11 commits
  2. 23 Jan, 2020 1 commit
    • Dmitry Monakhov's avatar
      ext4: fix extent_status fragmentation for plain files · 4068664e
      Dmitry Monakhov authored
      Extents are cached in read_extent_tree_block(); as a result, extents
      are not cached for inodes with depth == 0 when we try to find the
      extent using ext4_find_extent().  The result of the lookup is cached
      in ext4_map_blocks() but is only a subset of the extent on disk.  As a
      result, the contents of extents status cache can get very badly
      fragmented for certain workloads, such as a random 4k read workload.
      
      File size of /mnt/test is 33554432 (8192 blocks of 4096 bytes)
       ext:     logical_offset:        physical_offset: length:   expected: flags:
         0:        0..    8191:      40960..     49151:   8192:             last,eof
      
      $ perf record -e 'ext4:ext4_es_*' /root/bin/fio --name=t --direct=0 --rw=randread --bs=4k --filesize=32M --size=32M --filename=/mnt/test
      $ perf script | grep ext4_es_insert_extent | head -n 10
                   fio   131 [000]    13.975421:           ext4:ext4_es_insert_extent: dev 253,0 ino 12 es [494/1) mapped 41454 status W
                   fio   131 [000]    13.975939:           ext4:ext4_es_insert_extent: dev 253,0 ino 12 es [6064/1) mapped 47024 status W
                   fio   131 [000]    13.976467:           ext4:ext4_es_insert_extent: dev 253,0 ino 12 es [6907/1) mapped 47867 status W
                   fio   131 [000]    13.976937:           ext4:ext4_es_insert_extent: dev 253,0 ino 12 es [3850/1) mapped 44810 status W
                   fio   131 [000]    13.977440:           ext4:ext4_es_insert_extent: dev 253,0 ino 12 es [3292/1) mapped 44252 status W
                   fio   131 [000]    13.977931:           ext4:ext4_es_insert_extent: dev 253,0 ino 12 es [6882/1) mapped 47842 status W
                   fio   131 [000]    13.978376:           ext4:ext4_es_insert_extent: dev 253,0 ino 12 es [3117/1) mapped 44077 status W
                   fio   131 [000]    13.978957:           ext4:ext4_es_insert_extent: dev 253,0 ino 12 es [2896/1) mapped 43856 status W
                   fio   131 [000]    13.979474:           ext4:ext4_es_insert_extent: dev 253,0 ino 12 es [7479/1) mapped 48439 status W
      
      Fix this by caching the extents for inodes with depth == 0 in
      ext4_find_extent().
      
      [ Renamed ext4_es_cache_extents() to ext4_cache_extents() since this
        newly added function is not in extents_cache.c, and to avoid
        potential visual confusion with ext4_es_cache_extent().  -TYT ]
      Signed-off-by: default avatarDmitry Monakhov <dmonakhov@gmail.com>
      Link: https://lore.kernel.org/r/20191106122502.19986-1-dmonakhov@gmail.comSigned-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      4068664e
  3. 17 Jan, 2020 27 commits
  4. 26 Dec, 2019 1 commit
    • Jan Kara's avatar
      ext4: Optimize ext4 DIO overwrites · 8cd115bd
      Jan Kara authored
      Currently we start transaction for mapping every extent for writing
      using direct IO. This is unnecessary when we know we are overwriting
      already allocated blocks and the overhead of starting a transaction can
      be significant especially for multithreaded workloads doing small writes.
      Use iomap operations that avoid starting a transaction for direct IO
      overwrites.
      
      This improves throughput of 4k random writes - fio jobfile:
      [global]
      rw=randrw
      norandommap=1
      invalidate=0
      bs=4k
      numjobs=16
      time_based=1
      ramp_time=30
      runtime=120
      group_reporting=1
      ioengine=psync
      direct=1
      size=16G
      filename=file1.0.0:file1.0.1:file1.0.2:file1.0.3:file1.0.4:file1.0.5:file1.0.6:file1.0.7:file1.0.8:file1.0.9:file1.0.10:file1.0.11:file1.0.12:file1.0.13:file1.0.14:file1.0.15:file1.0.16:file1.0.17:file1.0.18:file1.0.19:file1.0.20:file1.0.21:file1.0.22:file1.0.23:file1.0.24:file1.0.25:file1.0.26:file1.0.27:file1.0.28:file1.0.29:file1.0.30:file1.0.31
      file_service_type=random
      nrfiles=32
      
      from 3018MB/s to 4059MB/s in my test VM running test against simulated
      pmem device (note that before iomap conversion, this workload was able
      to achieve 3708MB/s because old direct IO path avoided transaction start
      for overwrites as well). For dax, the win is even larger improving
      throughput from 3042MB/s to 4311MB/s.
      Reported-by: default avatarDan Williams <dan.j.williams@intel.com>
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Link: https://lore.kernel.org/r/20191218174433.19380-1-jack@suse.czSigned-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      8cd115bd