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
Unknown Object (File)
Wed, Mar 20, 8:49 AM
Unknown Object (File)
Mar 9 2024, 1:06 AM
Unknown Object (File)
Mar 9 2024, 1:03 AM
Unknown Object (File)
Mar 9 2024, 1:03 AM
Unknown Object (File)
Mar 9 2024, 12:55 AM
Unknown Object (File)
Mar 9 2024, 12:55 AM
Unknown Object (File)
Mar 9 2024, 12:54 AM
Unknown Object (File)
Mar 9 2024, 12:54 AM
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 30727
Build 28455: 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
761–762

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

delphij added inline comments.
sbin/newfs_msdos/mkfs_msdos.c
761–762

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