aboutsummaryrefslogtreecommitdiff
path: root/fs/btrfs/btrfs.h
AgeCommit message (Collapse)Author
2022-07-21treewide: Fix Marek's name and change my e-mail addressMarek Behún
Fix diacritics in some instances of my name and change my e-mail address to kabel@kernel.org. Add corresponding .mailmap entries. Signed-off-by: Marek Behún <kabel@kernel.org> Reviewed-by: Stefan Roese <sr@denx.de>
2022-04-19btrfs: Fix compilation on big endian systemsPali Rohár
Fix following two compile errors on big endian systems: CC fs/btrfs/btrfs.o In file included from include/linux/byteorder/big_endian.h:107, from ./arch/powerpc/include/asm/byteorder.h:82, from ./arch/powerpc/include/asm/bitops.h:8, from include/linux/bitops.h:152, from include/uuid.h:9, from fs/btrfs/btrfs.c:10: fs/btrfs/conv-funcs.h: In function ‘btrfs_key_to_disk’: include/linux/byteorder/generic.h:90:21: error: ‘__cpu_to_le16’ undeclared (first use in this function); did you mean ‘__cpu_to_le16p’? #define cpu_to_le16 __cpu_to_le16 ^~~~~~~~~~~~~ fs/btrfs/conv-funcs.h:79:10: note: in expansion of macro ‘cpu_to_le16’ __u16: cpu_to_le16, \ ^~~~~~~~~~~ CC fs/btrfs/compression.o In file included from ./arch/powerpc/include/asm/unaligned.h:9, from fs/btrfs/compression.c:16: include/linux/unaligned/access_ok.h:6:19: error: redefinition of ‘get_unaligned_le16’ static inline u16 get_unaligned_le16(const void *p) ^~~~~~~~~~~~~~~~~~ In file included from fs/btrfs/ctree.h:16, from fs/btrfs/btrfs.h:12, from fs/btrfs/compression.c:8: include/linux/unaligned/le_byteshift.h:40:19: note: previous definition of ‘get_unaligned_le16’ was here static inline u16 get_unaligned_le16(const void *p) ^~~~~~~~~~~~~~~~~~ Include file asm/unaligned.h contains arch specific macros and functions for unaligned access as opposite to linux/unaligned le_byteshift.h which contains macros and functions specific to little endian systems only. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Qu Wenruo <wqu@suse.com>
2020-09-07fs: btrfs: Cleanup the old implementationQu Wenruo
This cleans up the now unneeded code from the old btrfs implementation. Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Marek Behún <marek.behun@nic.cz>
2020-09-07fs: btrfs: Implement btrfs_file_read()Qu Wenruo
This version of btrfs_file_read() has the following new features: - Tries all mirrors - More handling on unaligned size - Better compressed extent handling The old implementation doesn't handle compressed extent with offset properly: we need to read out the whole compressed extent, then decompress the whole extent, and only then copy the requested part. Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Marek Behún <marek.behun@nic.cz>
2020-09-07fs: btrfs: Rename btrfs_file_read() and its callees to avoid name conflictsQu Wenruo
Rename btrfs_file_read() and its callees to avoid name conflicts with the incoming new code. Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Marek Behún <marek.behun@nic.cz>
2020-09-07fs: btrfs: Use btrfs_iter_dir() to replace btrfs_readdir()Qu Wenruo
Use extent buffer based infrastructure to re-implement btrfs_readdir(). Along this rework, some small corner cases fixed: - Subvolume tree mtime Mtime of a subvolume tree is recorded in its root item, since there is no INODE_ITEM for it. This needs extra search from tree root. - Output the unknown type If the DIR_ITEM is corrupted, at least don't try to access the memory out of boundary. Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Marek Behún <marek.behun@nic.cz>
2020-09-07fs: btrfs: Use btrfs_readlink() to implement __btrfs_readlink()Qu Wenruo
The existing __btrfs_readlink() can be easily re-implemented using the extent buffer based btrfs_readlink(). This is the first step to re-implement U-Boot's btrfs code. Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Marek Behún <marek.behun@nic.cz>
2020-09-07fs: btrfs: Rename path resolve related functions to avoid name conflictsQu Wenruo
Since the old code is using __btrfs_path/__btrfs_root which is different from the regular extent buffer based one, we add "__" prefix for the old implementation to avoid name conflicts for the incoming crossport. Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Marek Behún <marek.behun@nic.cz>
2020-09-07fs: btrfs: Crossport open_ctree_fs_info() from btrfs-progsQu Wenruo
open_ctree_fs_info() is the main entry point to open btrfs. This version is a simplfied version of __open_ctree_fd() of btrfs-progs, the main differences are: - Parameters on how to specify a block device Instead of @fd and @path, U-Boot uses blk_desc and disk_partition_t. - Remove open_ctree flags There won't be multiple open ctree modes in U-Boot. Otherwise functions structures are all kept the same. With open_ctree_fs_info() implemented, also introduce the global current_fs_info pointer to show the current opened btrfs. Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Marek Behún <marek.behun@nic.cz>
2020-09-07fs: btrfs: Crossport btrfs_read_sys_array() and btrfs_read_chunk_tree()Qu Wenruo
These two functions play a big role in btrfs bootstrap. The following function is removed: - Seed device support Although in theory we can still support multiple devices, we don't have a facility in U-Boot to do device scan without opening them. Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Marek Behún <marek.behun@nic.cz>
2020-09-07fs: btrfs: Rename btrfs_root to __btrfs_rootQu Wenruo
This is to avoid naming conflicts between extent buffer based btrfs_root. Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Marek Behún <marek.behun@nic.cz>
2020-09-07fs: btrfs: Rename struct btrfs_path to struct __btrfs_pathQu Wenruo
To avoid name conflicting between the extent buffer based btrfs_path from btrfs-progs, rename struct btrfs_path to struct __btrfs_path. Also rename btrfs_free_path() to __btrfs_free_path() to avoid conflicts. Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Marek Behún <marek.behun@nic.cz>
2020-09-07fs: btrfs: Add more checksum algorithmsQu Wenruo
This mostly crossports crypto/hash.[ch] from btrfs-progs. The differences are: - No blake2 support No blake2 related library in U-Boot yet. - Use uboot xxhash/sha256 directly No need to implement the code as U-Boot has already provided the interface. This adds the support for the following csums: - SHA256 - XXHASH Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Marek Behún <marek.behun@nic.cz>
2020-05-18part: Drop disk_partition_t typedefSimon Glass
We should not be using typedefs and these make it harder to use forward declarations (to reduce header file inclusions). Drop the typedef. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-06-18fs: btrfs: Do not fail when all root_backups are emptyYevgeny Popovych
This is the case when reading freshly created filesystem. The error message is like the following: btrfs_read_superblock: No valid root_backup found! Since the data from super_roots/root_backups is not actually used - decided to rework btrfs_newest_root_backup() into btrfs_check_super_roots() that will only check if super_roots array is valid and correctly handle empty scenario. As a result: * btrfs_read_superblock() now only checks if super_roots array is valid; the case when it is empty is considered OK. * removed root_backup pointer from btrfs_info, which would be NULL in case of empty super_roots. * btrfs_read_superblock() verifies number of devices from the superblock itself, not newest root_backup. Signed-off-by: Yevgeny Popovych <yevgenyp@pointgrab.com> Cc: Marek Behun <marek.behun@nic.cz> Cc: Sergey Struzh <sergeys@pointgrab.com>
2018-05-07SPDX: Convert all of our single license tags to Linux Kernel styleTom Rini
When U-Boot started using SPDX tags we were among the early adopters and there weren't a lot of other examples to borrow from. So we picked the area of the file that usually had a full license text and replaced it with an appropriate SPDX-License-Identifier: entry. Since then, the Linux Kernel has adopted SPDX tags and they place it as the very first line in a file (except where shebangs are used, then it's second line) and with slightly different comment styles than us. In part due to community overlap, in part due to better tag visibility and in part for other minor reasons, switch over to that style. This commit changes all instances where we have a single declared license in the tag as both the before and after are identical in tag contents. There's also a few places where I found we did not have a tag and have introduced one. Signed-off-by: Tom Rini <trini@konsulko.com>
2017-10-02fs: btrfs: Add single-device read-only BTRFS implementationMarek Behún
This adds the proper implementation for the BTRFS filesystem. The implementation currently supports only read-only mode and the filesystem can be only on a single device. Checksums of data chunks is unimplemented. Compression is implemented (ZLIB + LZO). Signed-off-by: Marek Behun <marek.behun@nic.cz> create mode 100644 fs/btrfs/btrfs.h create mode 100644 fs/btrfs/chunk-map.c create mode 100644 fs/btrfs/compression.c create mode 100644 fs/btrfs/ctree.c create mode 100644 fs/btrfs/dev.c create mode 100644 fs/btrfs/dir-item.c create mode 100644 fs/btrfs/extent-io.c create mode 100644 fs/btrfs/hash.c create mode 100644 fs/btrfs/inode.c create mode 100644 fs/btrfs/root.c create mode 100644 fs/btrfs/subvolume.c create mode 100644 fs/btrfs/super.c