Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

bcachefs: Fixes for building in userspace

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>

+27 -2
+20
fs/bcachefs/checksum.c
··· 559 559 return ret; 560 560 } 561 561 562 + #ifndef __KERNEL__ 563 + int bch2_revoke_key(struct bch_sb *sb) 564 + { 565 + key_serial_t key_id; 566 + struct printbuf key_description = PRINTBUF; 567 + 568 + prt_printf(&key_description, "bcachefs:"); 569 + pr_uuid(&key_description, sb->user_uuid.b); 570 + 571 + key_id = request_key("user", key_description.buf, NULL, KEY_SPEC_USER_KEYRING); 572 + printbuf_exit(&key_description); 573 + if (key_id < 0) 574 + return errno; 575 + 576 + keyctl_revoke(key_id); 577 + 578 + return 0; 579 + } 580 + #endif 581 + 562 582 int bch2_decrypt_sb_key(struct bch_fs *c, 563 583 struct bch_sb_field_crypt *crypt, 564 584 struct bch_key *key)
+3
fs/bcachefs/checksum.h
··· 47 47 48 48 int bch2_chacha_encrypt_key(struct bch_key *, struct nonce, void *, size_t); 49 49 int bch2_request_key(struct bch_sb *, struct bch_key *); 50 + #ifndef __KERNEL__ 51 + int bch2_revoke_key(struct bch_sb *); 52 + #endif 50 53 51 54 int bch2_encrypt(struct bch_fs *, unsigned, struct nonce, 52 55 void *data, size_t);
+1 -1
fs/bcachefs/fs.h
··· 197 197 198 198 #else 199 199 200 - #define bch2_inode_update_after_write(_trans, _inode, _inode_u, _fields) do {} while (0) 200 + #define bch2_inode_update_after_write(_trans, _inode, _inode_u, _fields) ({ do {} while (0); }) 201 201 202 202 static inline void bch2_evict_subvolume_inodes(struct bch_fs *c, 203 203 snapshot_id_list *s) {}
+2
fs/bcachefs/io_read.c
··· 24 24 #include "subvolume.h" 25 25 #include "trace.h" 26 26 27 + #include <linux/sched/mm.h> 28 + 27 29 #ifndef CONFIG_BCACHEFS_NO_LATENCY_ACCT 28 30 29 31 static bool bch2_target_congested(struct bch_fs *c, u16 target)
+1 -1
fs/bcachefs/super-io.c
··· 675 675 676 676 #ifndef __KERNEL__ 677 677 if (opt_get(*opts, direct_io) == false) 678 - sb->mode |= FMODE_BUFFERED; 678 + sb->mode |= BLK_OPEN_BUFFERED; 679 679 #endif 680 680 681 681 if (!opt_get(*opts, noexcl))