Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Integrate ISA-L & Generalised Erasure Coding. #80

Draft
wants to merge 367 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
367 commits
Select commit Hold shift + click to select a range
4a54b14
bcachefs: kill page_state_cmpxchg
koverstreet Jul 2, 2019
14aba43
bcachefs: track dirtyness at sector level, not page
koverstreet Jul 3, 2019
65b3579
bcachefs: Don't try to delete stripes when RO
koverstreet Jul 10, 2019
3e2dbfb
XArray: Fix xas_next() with a single entry at 0
Jul 1, 2019
80d5ace
bcachefs: Fix stripe_idx_to_delete()
koverstreet Jul 11, 2019
2e578ea
bcachefs: Fix ec_stripes_read()
koverstreet Jul 12, 2019
6415eed
bcachefs: Convert some assertions to fsck errors
koverstreet Jul 13, 2019
c75df65
bcachefs: Don't overflow trans with iters from triggers
koverstreet Jul 16, 2019
5987286
bcachefs: Print out name of bkey type
koverstreet Jul 16, 2019
01f65f1
bcachefs: Add offset_into_extent param to bch2_read_extent()
koverstreet Jul 9, 2019
179d885
bcachefs: add missing bch2_trans_begin() call
koverstreet Jul 23, 2019
e4774ff
bcachefs: Don't unlink iters on unsuccessful commit
koverstreet Jul 18, 2019
fee0227
bcachefs: Dont't call bch2_trans_begin_updates() in bch2_extent_update()
koverstreet Jul 18, 2019
72dad76
bcachefs: Refactor __bch2_cut_front()
koverstreet Jul 18, 2019
c7aa700
bcachefs: Refactor various code to not be extent specific
koverstreet Jul 25, 2019
7ade0fb
bcachefs: Fix bch2_seek_data()
koverstreet Jul 30, 2019
809926c
bcachefs: Change __bch2_writepage() to not write to holes
koverstreet Jul 29, 2019
9967ab5
bcachefs: Change buffered write path to write to partial pages
koverstreet Jul 29, 2019
bc8de43
bcachefs: Handle partial pages in seek data/hole
koverstreet Jul 30, 2019
ed3a627
bcachefs: Count reserved extents as holes
koverstreet Jul 30, 2019
11381cd
bcachefs: Truncate/fpunch now works on block boundaries, not page
koverstreet Aug 6, 2019
1543b9c
bcachefs: Export correct blocksize to vfs
koverstreet Jun 29, 2019
5107bb5
bcachefs: trans_get_key() now works correctly for extents
koverstreet Aug 7, 2019
7e58452
bcachefs: fix for_each_btree_key()
koverstreet Aug 9, 2019
4f0a3ff
bcachefs: Ensure bch2_trans_get_iter() returns iters with correct locks
koverstreet Aug 12, 2019
acc145f
bcachefs: Mark space as unallocated on write failure
koverstreet Aug 13, 2019
a931021
bcachefs: Rework calling convention for marking overwrites
koverstreet Aug 9, 2019
9877d9d
bcachefs: Improved debug checks
koverstreet Aug 17, 2019
1559231
bcachefs: Fix __bch2_btree_iter_peek_slot_extents()
koverstreet Aug 17, 2019
7d6a123
bcachefs: Fix bch2_btree_node_iter_prev_filter()
koverstreet Aug 19, 2019
d4071ac
bcachefs: Fix bch2_btree_node_iter_fix()
koverstreet Aug 20, 2019
94e509a
bcachefs: Move node iterator fixup to extent_bset_insert()
koverstreet Aug 20, 2019
6e765f5
bcachefs: Refactor bch2_extent_trim_atomic() for reflink
koverstreet Aug 16, 2019
68db280
bcachefs: Reflink
koverstreet Aug 16, 2019
b8db8b4
bcachefs: Fix bch2_sort_repack_merge()
koverstreet Aug 21, 2019
6c8293f
bcachefs: Fix bch2_bkey_narrow_crcs()
koverstreet Aug 21, 2019
5bf00e3
bcachefs: Fix faulty assertion
koverstreet Aug 22, 2019
7dbd649
bcachefs: Check alignment in write path
koverstreet Aug 22, 2019
0d34165
bcachefs: Re-enable bkey_debugcheck() in the extent update path
koverstreet Aug 22, 2019
365f641
bcachefs: Update more code for KEY_TYPE_reflink_v
koverstreet Aug 22, 2019
f0a3f75
bcachefs: Handle ec_buf not being page aligned when allocating bio
koverstreet Aug 22, 2019
a7d4900
bcachefs: Fix a spurious gcc warning
koverstreet Aug 22, 2019
f23d263
bcachefs: Don't flush journal from bch2_vfs_write_inode()
koverstreet Aug 22, 2019
5aeedbd
bcachefs: Inline some fast paths
koverstreet Aug 22, 2019
ca3606f
bcachefs: Add a hint for allocating new stripes
koverstreet Aug 22, 2019
511fbc2
bcachefs: Optimize fiemap
koverstreet Aug 22, 2019
0b46700
bcachefs: Trust in memory bucket mark
koverstreet Aug 27, 2019
32e8e27
bcachefs: Refactor bch2_alloc_write()
koverstreet Aug 27, 2019
587e8c2
bcachefs: Fixes for replicas tracking
koverstreet Aug 22, 2019
600bd44
bcachefs: Reflink pointers also have to be remarked if split in journ…
koverstreet Aug 28, 2019
37587ee
bcachefs: Fix error message on bucket overflow
koverstreet Aug 28, 2019
7a1b3e0
bcachefs: Fix fiemap (again)
koverstreet Aug 28, 2019
53b05f6
bcachefs: Switch reconstruct_alloc to a mount option
koverstreet Aug 28, 2019
6c5eb51
bcachefs: Improve pointer marking checks and error messages
koverstreet Aug 29, 2019
4522800
bcachefs: Fix BTREE_INSERT_NOMARK_OVERWRITES
koverstreet Aug 29, 2019
54bd693
bcachefs: Kill BTREE_INSERT_NOMARK_INSERT
koverstreet Sep 5, 2019
c684d8c
bcachefs: Rebalance now adds replicas if needed
koverstreet Sep 7, 2019
20e36ec
bcachefs: Flush fsck errors when looping in btree gc
koverstreet Sep 7, 2019
c0a2303
bcachefs: Fix a null ptr deref
koverstreet Sep 7, 2019
52cda6d
bcachefs: data move path should not be trying to move reflink_p keys
koverstreet Sep 7, 2019
43a2abd
bcachefs: Drop trans arg to bch2_extent_atomic_end()
koverstreet Sep 7, 2019
d2fcf65
bcachefs: Do updates in order they were queued up in
koverstreet Sep 7, 2019
097edf3
bcachefs: __bch2_btree_node_iter_fix() improvements
koverstreet Sep 7, 2019
bb0fbfc
bcachefs: Improved bch2_fcollapse()
koverstreet Jul 22, 2019
6b83a53
bcachefs: Fix a typo
koverstreet Sep 13, 2019
3b690da
bcachefs: Optimize calls to bch2_btree_iter_traverse()
koverstreet Sep 8, 2019
64862e1
bcachefs: Add missing bch2_btree_node_iter_fix() calls
koverstreet Sep 14, 2019
0251aa6
bcachefs: Debug code improvements
koverstreet Sep 14, 2019
66ca373
bcachefs: Improve btree_iter_pos_in_node()
koverstreet Sep 13, 2019
2fbd77d
bcachefs: More btree iter improvements
koverstreet Sep 7, 2019
491e269
bcachefs: Avoid deadlocking on the allocator
koverstreet Sep 18, 2019
ea560e2
bcachefs: Add missing bch2_btree_node_iter_fix() call
koverstreet Sep 19, 2019
18856d7
bcachefs: Debug assertion improvements
koverstreet Sep 19, 2019
c491013
bcachefs: Check for extents past eof correctly
koverstreet Sep 19, 2019
d15fdbc
bcachefs: Don't write past eof
koverstreet Sep 19, 2019
accba98
bcachefs: bch2_btree_iter_peek_prev()
koverstreet Sep 7, 2019
ce2586e
bcachefs: Add support for FALLOC_FL_INSERT_RANGE
koverstreet Sep 7, 2019
c47224d
bcachefs: Fix validation of replicas entries
koverstreet Sep 20, 2019
c7f562b
bcachefs: Drop unused arg to bch2_open_buckets_stop_dev()
koverstreet Sep 20, 2019
2bd4dee
bcachefs: Handle bio_iov_iter_get_pages() returning unaligned bio
koverstreet Sep 22, 2019
e4251df
bcachefs: Update path microoptimizations
koverstreet Sep 21, 2019
c5b7bb3
bcachefs: Drop unnecessary rcu_read_lock()
koverstreet Sep 21, 2019
19e0379
bcachefs: Count iterators for reflink_p overwrites correctly
koverstreet Sep 22, 2019
d40966c
Fix flush_dcache_page in filemap.c
smuenzel Sep 21, 2019
313e2a2
bcachefs: Convert a BUG_ON() to a warning
koverstreet Sep 24, 2019
ece9b3d
bcachefs: Trivial cleanup
koverstreet Sep 25, 2019
3e984d6
bcachefs: Cleanup i_nlink handling
koverstreet Sep 25, 2019
7e6c3e5
bcachefs: Improve error handling for for_each_btree_key_continue()
koverstreet Sep 25, 2019
3554ccb
bcachefs: BTREE_ITER_SLOTS isn't a type of btree iter
koverstreet Sep 22, 2019
4f4d823
bcachefs: Fix for partial buffered writes
koverstreet Sep 26, 2019
090f829
bcachefs: Kill deferred btree updates
koverstreet Sep 22, 2019
6a87ea1
bcachefs: Rework btree iterator lifetimes
koverstreet Sep 27, 2019
8c16ec3
bcachefs: Fix counting iterators for reflink pointers
koverstreet Oct 1, 2019
2b8f388
bcachefs: Trust inode in btree over bch_inode_info
koverstreet Sep 26, 2019
8d6bf3f
bcachefs: Fix __bch2_buffered_write() returning -ENOMEM
koverstreet Oct 1, 2019
b6ec398
mm: Fix missing xas_nomem() call
koverstreet Oct 2, 2019
2514246
bcachefs: Fix an error path
koverstreet Oct 2, 2019
a900638
bcachefs: Fix undefined behaviour
koverstreet Oct 2, 2019
2823c45
bcachefs: bch2_inode_peek()/bch2_inode_write()
koverstreet Oct 1, 2019
0cd9de1
bcachefs: Fix deref of error pointer
koverstreet Oct 4, 2019
d17f598
bcachefs: Only look up inode io opts in extents btree
koverstreet Oct 4, 2019
9ba2ff4
bcachefs: Don't use sha256 for siphash str hash key
koverstreet Oct 4, 2019
0bfd004
bcachefs: Factor out fs-common.c
koverstreet Oct 2, 2019
e91e451
bcachefs: bch2_extent_atomic_end() now traverses iter
koverstreet Oct 4, 2019
033bdd9
bcachefs: Don't allocate memory under mark_lock
koverstreet Oct 4, 2019
f5601e2
bcachefs: Can't be holding read locks while taking write locks
koverstreet Oct 5, 2019
f0017a0
bcachefs: Fix incorrect use of bch2_extent_atomic_end()
koverstreet Oct 7, 2019
f74a7fc
bcachefs: Fix uninitialized data in bch2_gc_btree()
nadalle Oct 9, 2019
6bd631c
bcachefs: Initialize journal pad data in bch_replica_entry objects.
nadalle Oct 9, 2019
f21ba97
bcachefs: Add a missing __GFP_NOWARN
koverstreet Oct 9, 2019
cfe2fe5
bcachefs: Fix bch2_mark_extent()
koverstreet Oct 9, 2019
e07071f
bcachefs: Fix bch2_extent_ptr_durability()
koverstreet Oct 7, 2019
979aec7
bcachefs: Limit pointers to being in only one stripe
koverstreet Oct 8, 2019
0e3ca59
bcachefs: Fix ec_stripes_read()
koverstreet Oct 9, 2019
87fc584
bcachefs: Fix erasure coding disk space accounting
koverstreet Oct 7, 2019
b8570a0
bcachefs: Add a lock to bch_page_state
koverstreet Oct 9, 2019
143ebfb
bcachefs: Refactor bch2_readdir() a bit
koverstreet Oct 9, 2019
91e184f
bcachefs: Fix bch2_btree_iter_next() after peek_slot()
koverstreet Oct 9, 2019
8dca422
bcachefs: Check if extending inode differently
koverstreet Oct 9, 2019
4147a5c
bcachefs: Kill some dependencies on ei_inode
koverstreet Oct 9, 2019
f0e5eab
bcachefs: Split out bchfs_extent_update()
koverstreet Oct 9, 2019
1e0013c
bcachefs: Convert bch2_fpunch to bch2_extent_update()
koverstreet Oct 10, 2019
3c9d1f2
bcachefs: Kill bchfs_extent_update()
koverstreet Oct 9, 2019
a00b0dd
bcachefs: Fix a subtle race in the btree split path
koverstreet Oct 11, 2019
3abaa8e
bcachefs: Fix creation of lost+found
koverstreet Oct 11, 2019
7a7c4c6
bcachefs: Switch to .iterate_shared for readdir
koverstreet Oct 11, 2019
561c883
bcachefs: Fix a debug assertion
koverstreet Oct 12, 2019
462b859
bcachefs: Fix iterator counting for reflink pointers (again)
koverstreet Oct 12, 2019
5b5032a
bcachefs: Fix flushing held btree writes when there's a fs error
koverstreet Oct 12, 2019
1be194c
bcachefs: Fix an iterator counting bug
koverstreet Oct 16, 2019
5802cce
bcachefs: Limit bios in writepages path to 256M
koverstreet Oct 20, 2019
1b1855f
bcachefs: Drop old CONFIG_LBDAF requirement
koverstreet Oct 21, 2019
66ccdfc
bcachefs: Drop bch_write_op->io_wq
koverstreet Oct 22, 2019
6484962
bcachefs: Don't submit bio in write path under lock
koverstreet Oct 21, 2019
357cfb5
bcachefs: Make replicas_delta_list smaller
koverstreet Oct 20, 2019
565f537
bcachefs: Make btree_node_type_needs_gc() cheaper
koverstreet Oct 20, 2019
38b1010
bcachefs: Refactor bch2_trans_commit() path
koverstreet Oct 19, 2019
71efedf
bcachefs: Don't use FUA unnecessarily
koverstreet Oct 21, 2019
e3c375f
bcachefs: kill bch2_extent_merge_inline()
koverstreet Oct 22, 2019
387c421
bcachefs: Avoid calling iter_prev() in extent update path
koverstreet Oct 22, 2019
e30c6d1
bcachefs: Don't use rep movsq for small memcopies
koverstreet Oct 22, 2019
54abc2c
bcachefs: Don't reuse bio in retry path
koverstreet Oct 24, 2019
0aeb4c7
bcachefs: Fix an error path race
koverstreet Oct 25, 2019
2d32916
bcachefs: Add missing error checking in bch2_find_by_inum_trans()
koverstreet Oct 25, 2019
7323312
bcachefs: Initialize padding space after alloc bkey
nadalle Oct 12, 2019
3ae8749
bcachefs: Further padding fixes in bch2_journal_super_entries_add_com…
nadalle Oct 12, 2019
1744f4b
bcachefs: Initialize btree_node flags field in bch2_btree_root_alloc.
nadalle Oct 12, 2019
d3d5f88
bcachefs: More bset.c microoptimization
koverstreet Oct 23, 2019
07b5e57
bcachefs: Trust btree alloc info at runtime
koverstreet Oct 28, 2019
315507a
bcachefs: Inline more of bch2_trans_commit hot path
koverstreet Oct 28, 2019
0df8ddc
bcachefs: bch2_btree_iter_fix_key_modified()
koverstreet Oct 2, 2019
adfd2b5
bcachefs: Don't use extent_ptr_decoded_append() in write path
koverstreet Oct 29, 2019
9ec7cbc
bcachefs: Avoid atomics in write fast path
koverstreet Nov 2, 2019
bd7a8da
bcachefs: Don't hold inode lock longer than necessary in dio write path
koverstreet Nov 2, 2019
0c05b4b
bcachefs: Fix uninitialized field in hash_check_init()
nadalle Nov 4, 2019
20ebb1f
mm: Add a mechanism to disable faults for a specific mapping
koverstreet Oct 16, 2019
d9e51e1
bcachefs: Add pagecache_add lock to buffered IO path, fault path
koverstreet Oct 18, 2019
7016367
bcachefs: Move pagecache add lock to bcachefs code
koverstreet Nov 4, 2019
a5f0688
bcachefs: Fix setting of attributes mask in getattr
koverstreet Nov 6, 2019
1df448c
bcachefs: Some reflink fixes
koverstreet Nov 5, 2019
086873d
bcachefs: Don't BUG_ON() sector count overflow
koverstreet Oct 26, 2019
b8cb41a
bcachefs: Add an option for fsck error ratelimiting
koverstreet Nov 6, 2019
84b128c
bcachefs: Avoid calling bch2_btree_iter_relock() in bch2_btree_iter_t…
koverstreet Nov 4, 2019
ef13d78
bcachefs: Inline fast path of bch2_increment_clock()
koverstreet Nov 7, 2019
034bc02
bcachefs: Make __bch2_bkey_cmp_packed() smaller
koverstreet Nov 7, 2019
7fd8cc1
bcachefs: Pipeline binary searches and linear searches
koverstreet Nov 7, 2019
86fab90
bcachefs: bch2_read_extent() microoptimizations
koverstreet Nov 7, 2019
7772dfa
bcachefs: kill BFLOAT_FAILED_PREV
koverstreet Nov 6, 2019
a145330
bcachefs: Fall back to slowpath on exact comparison
koverstreet Oct 23, 2019
77cb6ed
bcachefs: Go back to 16 bit mantissa bkey floats
koverstreet Nov 7, 2019
b71a582
bcachefs: Remove some BKEY_PADDED uses
koverstreet Nov 8, 2019
dff8d06
bcachefs: Be slightly less tricky with union usage
koverstreet Nov 9, 2019
7329c3e
bcachefs: Set lost+found mode to 0700
nadalle Nov 10, 2019
468fd6c
bcachefs: Fix erorr path in bch2_write()
koverstreet Nov 11, 2019
585049d
bcachefs: Use wbc_to_write_flags()
koverstreet Nov 14, 2019
e56ca95
bcachefs: Make memcpy_to_bio() param const
koverstreet Nov 14, 2019
811e1ea
bcachefs: bkey_on_stack
koverstreet Nov 9, 2019
17dfc1c
bcachefs: kill bch2_extent_has_device()
koverstreet Nov 16, 2019
788941d
bcachefs: bkey noops
koverstreet Nov 10, 2019
139de9f
bcachefs: Rework of cut_front & cut_back
koverstreet Nov 10, 2019
92573e6
bcachefs: Split out extent_update.c
koverstreet Nov 15, 2019
9635e63
bcachefs: Inline data extents
koverstreet Nov 9, 2019
290c075
bcachefs: Reorganize extents.c
koverstreet Nov 16, 2019
71382a9
bcachefs: splice_write is currently busted
koverstreet Nov 18, 2019
7eed9ae
bcachefs: kill ca->freelist_lock
koverstreet Nov 20, 2019
ebccf16
bcachefs: bkey_on_stack_reassemble()
koverstreet Nov 20, 2019
702e69f
bcachefs: Switch to macro for bkey_ops
koverstreet Nov 26, 2019
da51bc8
bcachefs: bch2_check_set_feature()
koverstreet Nov 29, 2019
776b95f
bcachefs: Put inline data behind a mount option for now
koverstreet Nov 29, 2019
3d16f5d
bcachefs: Fix bch2_verify_insert_pos()
koverstreet Nov 26, 2019
d5de6f5
bcachefs: Always emit new extents on partial overwrite
koverstreet Nov 20, 2019
9c450a5
bcachefs: Whiteout changes
koverstreet Nov 29, 2019
f31f9b8
bcachefs: Refactor whiteouts compaction
koverstreet Dec 13, 2019
52621fe
bcachefs: Use one buffer for sorting whiteouts
koverstreet Dec 14, 2019
fbb669e
bcachefs: Kill btree_node_iter_large
koverstreet Dec 14, 2019
cac35a8
bcachefs: Fix a null ptr deref in btree_iter_traverse_one()
koverstreet Dec 16, 2019
adfbb84
fixup! bcachefs: Fix bch2_verify_insert_pos()
koverstreet Dec 16, 2019
bb26812
bcachefs: Fix for an assertion on filesystem error
koverstreet Dec 18, 2019
a8faf24
bcachefs: Update directory timestamps during link
nadalle Nov 12, 2019
5d7142b
bcachefs: Redo filesystem usage ioctls
koverstreet Dec 16, 2019
2f27964
bcachefs: Fix a memory splat
koverstreet Dec 18, 2019
6d7bf56
bcachefs: Add __GFP_NOWARN to a GFP_NOWAIT allocation
koverstreet Dec 18, 2019
b1c799a
bcachefs: Make io timers less buggy
koverstreet Dec 19, 2019
f964e39
bcachefs: Redo copygc throttling
koverstreet Dec 20, 2019
4479ff2
bcaches: Drop a faulty assertion
koverstreet Dec 20, 2019
5cc7cce
bcachefs: bch2_trans_reset() calls should be at the tops of loops
koverstreet Dec 20, 2019
d448924
bcachefs: Convert all bch2_trans_commit() users to BTREE_INSERT_ATOMIC
koverstreet Dec 23, 2019
743c5f9
bcachefs: Kill BTREE_INSERT_ATOMIC
koverstreet Dec 23, 2019
b0519a5
bcachefs: Don't reexecute triggers when retrying transaction commit
koverstreet Dec 24, 2019
8e4aafd
bcachefs: Don't export __bch2_fs_read_write
koverstreet Dec 26, 2019
0eb8f7f
bcachefs: Fix a use after free
koverstreet Dec 27, 2019
cfb41d2
bcachefs: Add an assertion to track down a heisenbug
koverstreet Dec 28, 2019
5481b79
bcachefs: Convert some enums to x-macros
koverstreet Dec 29, 2019
aae76fb
bcachefs: Use KEY_TYPE_deleted whitouts for extents
koverstreet Nov 26, 2019
07263ac
Integrate ISAL CRC64 ECMA and benchmarks.
Nov 27, 2019
0c3d8ee
Removed unused ISAL CRC code.
BlamKiwi Dec 3, 2019
46c4b89
Added ISAL Erasure Code implementation files
BlamKiwi Dec 3, 2019
821fa14
Fix C flags for ISA-L C files.
BlamKiwi Dec 3, 2019
42d860a
Replace MD-RAID with Cauchy RS
BlamKiwi Dec 4, 2019
9368e4f
Add test vectors for CRC64
BlamKiwi Dec 9, 2019
92ee442
Ported CRC64 Fold 8 to GAS
BlamKiwi Dec 16, 2019
bf023a5
Ported CRC64 Fold 16 to GAS
BlamKiwi Dec 17, 2019
4e9c58c
Update CRC64 call site to remove bit inversion to match Linux behaviour.
BlamKiwi Dec 17, 2019
0293dec
Removed unused CRC64 code.
BlamKiwi Dec 18, 2019
280df4f
Update CRC64 base to match Linux state initialization
BlamKiwi Dec 18, 2019
f33c272
Port gf_5vect_mad_sse to GAS
BlamKiwi Dec 19, 2019
7bfcbdb
Modify C files to be more suited to KBuild
BlamKiwi Dec 19, 2019
fc4425f
Change large EC tables switch to use KBuild compatible defines
BlamKiwi Dec 19, 2019
3064263
Ported gf_vect_dot_prod_avx2 to GAS
BlamKiwi Dec 22, 2019
839f135
Ported SSE functions to GAS
BlamKiwi Dec 22, 2019
741a8e0
Ported AVX functions to GAS
BlamKiwi Dec 27, 2019
7a6315f
Ported AVX2 functions to GAS
BlamKiwi Dec 28, 2019
378996c
Ported AVX512 functions to GAS
BlamKiwi Dec 28, 2019
e029f01
Add Cauchy generation better suited for implementing RAID
BlamKiwi Dec 28, 2019
8326447
Fixed accidental code modifications in GAS ports
BlamKiwi Dec 29, 2019
f99d4bf
Remove unused accel code
BlamKiwi Dec 30, 2019
c564345
Change default matrix type to Vandermonde
BlamKiwi Dec 30, 2019
fd85337
Added crypto dispatch for CRC64
BlamKiwi Jan 1, 2020
d6d8742
Moved CRC64 SIMD code to crypto libraries
BlamKiwi Jan 1, 2020
f950e91
Updated license information and SPDX headers
BlamKiwi Jan 1, 2020
f0eb816
Remove accidental character insertion CRC32
BlamKiwi Jan 1, 2020
10a5d3d
Remove unused ARM64 erausre code implementations.
BlamKiwi Jan 1, 2020
d52d27e
Revert ASM license to BSD only
BlamKiwi Jan 1, 2020
7941394
Restore authors in copyright for copy-paste files
BlamKiwi Jan 1, 2020
9998b38
Fix CRC64 bug and EC build issues
BlamKiwi Jan 1, 2020
f1e70d9
Create public API for erasure coding library
BlamKiwi Jan 3, 2020
cb036e8
Change geometry detection to use get_opt
BlamKiwi Jan 3, 2020
7df7504
Stripe geometry detection now respects EC_STRIPE_MAX
BlamKiwi Jan 3, 2020
e79a38c
Change error code detection to same style as rest of file
BlamKiwi Jan 3, 2020
a7c4904
Erasure Code build files
BlamKiwi Jan 11, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions arch/x86/crypto/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ obj-$(CONFIG_CRYPTO_SHA256_SSSE3) += sha256-ssse3.o
obj-$(CONFIG_CRYPTO_SHA512_SSSE3) += sha512-ssse3.o
obj-$(CONFIG_CRYPTO_CRCT10DIF_PCLMUL) += crct10dif-pclmul.o
obj-$(CONFIG_CRYPTO_POLY1305_X86_64) += poly1305-x86_64.o
obj-$(CONFIG_CRYPTO_CRC64_PCLMUL) += crc64-pclmul.o

obj-$(CONFIG_CRYPTO_AEGIS128_AESNI_SSE2) += aegis128-aesni.o
obj-$(CONFIG_CRYPTO_AEGIS128L_AESNI_SSE2) += aegis128l-aesni.o
Expand Down Expand Up @@ -113,6 +114,7 @@ endif

ifeq ($(avx512_supported),yes)
chacha-x86_64-y += chacha-avx512vl-x86_64.o
crc64-pclmul-$(CONFIG_64BIT) += crc64_ecma_norm_by16_10.o
endif

aesni-intel-y := aesni-intel_asm.o aesni-intel_glue.o
Expand All @@ -130,6 +132,7 @@ endif
crc32c-intel-y := crc32c-intel_glue.o
crc32c-intel-$(CONFIG_64BIT) += crc32c-pcl-intel-asm_64.o
crc32-pclmul-y := crc32-pclmul_asm.o crc32-pclmul_glue.o
crc64-pclmul-$(CONFIG_64BIT) += crc64-pclmul_glue.o crc64_ecma_norm_by8.o
sha256-ssse3-y := sha256-ssse3-asm.o sha256-avx-asm.o sha256-avx2-asm.o sha256_ssse3_glue.o
ifeq ($(sha256_ni_supported),yes)
sha256-ssse3-y += sha256_ni_asm.o
Expand Down
194 changes: 194 additions & 0 deletions arch/x86/crypto/crc64-pclmul_glue.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* CRC64 ECMA 182 Checksum
*
* Crypto API wrapper for hardware accelerated functions.
* This crypto module uses ASM implementations ported from Intel ISA-L.
*
* Copyright (c) 2004 Cisco Systems, Inc.
* Copyright (c) 2008 Herbert Xu <[email protected]>
* Copyright (c) 2020 Robbie Litchfield <[email protected]>
*/

#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/crc64.h>
#include <asm/unaligned.h>
#include <asm/cpufeatures.h>
#include <asm/simd.h>
#include <crypto/internal/hash.h>
#include <crypto/internal/simd.h>

extern u64 crc64_ecma_norm_by8(u64 crc, const void *data, size_t len );
extern u64 crc64_ecma_norm_by16_10(u64 crc, const void *data, size_t len );
static u64 (*impl)(u64, const void *, size_t ) = NULL;

static u64 dispatch_crc64(u64 crc, const void *data, size_t len ) {
u64 res;

// Kernel FPU has overhead, perform small csums using table based method
if(len < 256 || !crypto_simd_usable()) {
res = crc64_be(crc, data, len);
} else {
kernel_fpu_begin();
res = impl(crc, data, len);
kernel_fpu_end();
}

return res;
}

/*
* ECMA 182 does not define a byte endianness.
* Use host endianness.
*/
#define LOAD(p) get_unaligned((const u64*)p)
#define STORE(v, p) put_unaligned(v, (u64*)p)

struct crc64_csum_ctx {
u64 key;
};

struct crc64_csum_desc_ctx {
u64 state;
};

/*
* Setting the seed allows arbitrary accumulators and flexible XOR policy
* If your algorithm starts with ~0, then XOR with ~0 before you set
* the seed.
*/
static int crc64_csum_setkey(struct crypto_shash *tfm, const u8 *key,
unsigned int len)
{
struct crc64_csum_ctx *mctx = crypto_shash_ctx(tfm);

if (len != sizeof(u64)) {
crypto_shash_set_flags(tfm, CRYPTO_TFM_RES_BAD_KEY_LEN);
return -EINVAL;
}

mctx->key = LOAD(key);

return 0;
}

static int crc64_csum_update(struct shash_desc *desc, const u8 *data,
unsigned int len)
{
struct crc64_csum_desc_ctx *ctx = shash_desc_ctx(desc);

ctx->state = dispatch_crc64(ctx->state, data, len);

return 0;
}

static int crc64_csum_tail(u64 *state, const u8 *data, unsigned int len, u8 *out)
{
STORE(dispatch_crc64(*state, data, len), out);

return 0;
}

static int crc64_csum_digest(struct shash_desc *desc, const u8 *data,
unsigned int len, u8 *out)
{
struct crc64_csum_ctx *mctx = crypto_shash_ctx(desc->tfm);

return crc64_csum_tail(&mctx->key, data, len, out);
}

static int crc64_csum_finup(struct shash_desc *desc, const u8 *data,
unsigned int len, u8 *out)
{
struct crc64_csum_desc_ctx *ctx = shash_desc_ctx(desc);

return crc64_csum_tail(&ctx->state, data, len, out);
}

static int crc64_csum_final(struct shash_desc *desc, u8 *out)
{
struct crc64_csum_desc_ctx *ctx = shash_desc_ctx(desc);

STORE(ctx->state, out);

return 0;
}

static int crc64_csum_init(struct shash_desc *desc)
{
struct crc64_csum_ctx *mctx = crypto_shash_ctx(desc->tfm);
struct crc64_csum_desc_ctx *ctx = shash_desc_ctx(desc);

ctx->state = mctx->key;

return 0;
}

static int crc64_csum_cra_init(struct crypto_tfm *tfm)
{
struct crc64_csum_ctx *mctx = crypto_tfm_ctx(tfm);

mctx->key = 0;

return 0;
}

static struct shash_alg alg = {
.digestsize = sizeof(u64),
.descsize = sizeof(struct crc64_csum_desc_ctx),

.init = crc64_csum_init,
.setkey = crc64_csum_setkey,
.update = crc64_csum_update,
.digest = crc64_csum_digest,
.final = crc64_csum_final,
.finup = crc64_csum_finup,

.base = {
.cra_name = "crc64",
.cra_driver_name = "crc64-pclmul",
.cra_priority = 200,
.cra_flags = CRYPTO_ALG_OPTIONAL_KEY,
.cra_blocksize = sizeof(u8),
.cra_ctxsize = sizeof(struct crc64_csum_ctx),
.cra_module = THIS_MODULE,
.cra_init = crc64_csum_cra_init,
}
};

static int __init crc64_pclmul_mod_init(void)
{
if (!boot_cpu_has(X86_FEATURE_PCLMULQDQ)) {
pr_info("PCLMUL instructions are not avaiable");
return -ENODEV;
}

#if CONFIG_AS_AVX512
if (boot_cpu_has(X86_FEATURE_VPCLMULQDQ)) {
impl = &crc64_ecma_norm_by16_10;
} else {
impl = &crc64_ecma_norm_by8;
}
#else
impl = &crc64_ecma_norm_by8;
#endif

return crypto_register_shash(&alg);
}

static void __exit crc64_pclmul_mod_exit(void)
{
crypto_unregister_shash(&alg);
}

module_init(crc64_pclmul_mod_init);
module_exit(crc64_pclmul_mod_exit);

MODULE_AUTHOR("Robbie Litchfield <[email protected]>");
MODULE_LICENSE("GPL");

MODULE_ALIAS_CRYPTO("crc64");
MODULE_ALIAS_CRYPTO("crc64-pclmul");
MODULE_ALIAS_CRYPTO("crc64-ecma-182");
Loading