Page MenuHomeFreeBSD

Gather writes to larger chunks (MAXPHYS) instead of issuing them in sectors.
ClosedPublic

Authored by delphij on Apr 20 2020, 12:01 AM.
Tags
None
Referenced Files
F102688269: D24508.diff
Fri, Nov 15, 9:36 PM
Unknown Object (File)
Mon, Nov 11, 8:44 PM
Unknown Object (File)
Wed, Nov 6, 5:00 AM
Unknown Object (File)
Thu, Oct 24, 11:25 PM
Unknown Object (File)
Mon, Oct 21, 9:54 PM
Unknown Object (File)
Sat, Oct 19, 5:24 AM
Unknown Object (File)
Sat, Oct 19, 1:00 AM
Unknown Object (File)
Oct 2 2024, 5:25 PM
Subscribers

Details

Summary

Gather writes to larger chunks (MAXPHYS) instead of issuing them in
sectors.

On my SanDisk Cruzer Blade 16GB USB stick this made formatting much faster:

x before
+ after
+--------------------------------------------------------------------------+
|+                                                                         |
|+                                                                      x  |
|+                                                                      x x|
|A                                                                      MA||
+--------------------------------------------------------------------------+
    N           Min           Max        Median           Avg        Stddev
x   3         15.89         16.38            16         16.09     0.2570992
+   3          0.32          0.37          0.35    0.34666667   0.025166115
Difference at 95.0% confidence
        -15.7433 +/- 0.414029
        -97.8455% +/- 0.25668%
        (Student's t, pooled s = 0.182665)

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 32131
Build 29642: arc lint + arc unit

Event Timeline

Tested on a hard drive; this reduced the time for format by 2/3:

x before
+ after
+------------------------------------------------------------+
|+++                                                       xx|
||A|                                                       AM|
+------------------------------------------------------------+
    N           Min           Max        Median           Avg        Stddev
x   3          7.24          7.33          7.29     7.2866667   0.045092498
+   3          2.36          2.49           2.4     2.4166667   0.066583281
Difference at 95.0% confidence
	-4.87 +/- 0.128884
	-66.8344% +/- 1.50101%
	(Student's t, pooled s = 0.0568624)
sbin/newfs_msdos/mkfs_msdos.c
776–777

This requires that MAXPHYS % bpb.bpbBytesPerSec == 0 right? Do we check that anywhere?

delphij added inline comments.
sbin/newfs_msdos/mkfs_msdos.c
776–777

No, but bpbBytesPerSec has to be greater than the buffer size (I don't think that would ever happen, though).

delphij marked an inline comment as done.

Round down chunksize if it's not fully aligned.

Instead of padding the buffer, assert that they always fit as the specification requires
sector size to be one of 512, 1024, 2048 or 4096 bytes.

ministat graph for time savings.

x before
+ after
+--------------------------------------------------------------------------+
|+                                                                         |
|+                                                                      x  |
|+                                                                      x x|
|A                                                                      MA||
+--------------------------------------------------------------------------+
    N           Min           Max        Median           Avg        Stddev
x   3         15.89         16.38            16         16.09     0.2570992
+   3          0.32          0.37          0.35    0.34666667   0.025166115
Difference at 95.0% confidence
	-15.7433 +/- 0.414029
	-97.8455% +/- 0.25668%
	(Student's t, pooled s = 0.182665)
This revision is now accepted and ready to land.Jul 4 2020, 3:22 PM