~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/fs/btrfs/bio.h

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 /*
  3  * Copyright (C) 2007 Oracle.  All rights reserved.
  4  * Copyright (C) 2022 Christoph Hellwig.
  5  */
  6 
  7 #ifndef BTRFS_BIO_H
  8 #define BTRFS_BIO_H
  9 
 10 #include <linux/types.h>
 11 #include <linux/bio.h>
 12 #include <linux/workqueue.h>
 13 #include "tree-checker.h"
 14 
 15 struct btrfs_bio;
 16 struct btrfs_fs_info;
 17 struct btrfs_inode;
 18 
 19 #define BTRFS_BIO_INLINE_CSUM_SIZE      64
 20 
 21 /*
 22  * Maximum number of sectors for a single bio to limit the size of the
 23  * checksum array.  This matches the number of bio_vecs per bio and thus the
 24  * I/O size for buffered I/O.
 25  */
 26 #define BTRFS_MAX_BIO_SECTORS           (256)
 27 
 28 typedef void (*btrfs_bio_end_io_t)(struct btrfs_bio *bbio);
 29 
 30 /*
 31  * Highlevel btrfs I/O structure.  It is allocated by btrfs_bio_alloc and
 32  * passed to btrfs_submit_bio for mapping to the physical devices.
 33  */
 34 struct btrfs_bio {
 35         /*
 36          * Inode and offset into it that this I/O operates on.
 37          * Only set for data I/O.
 38          */
 39         struct btrfs_inode *inode;
 40         u64 file_offset;
 41 
 42         union {
 43                 /*
 44                  * For data reads: checksumming and original I/O information.
 45                  * (for internal use in the btrfs_submit_bio machinery only)
 46                  */
 47                 struct {
 48                         u8 *csum;
 49                         u8 csum_inline[BTRFS_BIO_INLINE_CSUM_SIZE];
 50                         struct bvec_iter saved_iter;
 51                 };
 52 
 53                 /*
 54                  * For data writes:
 55                  * - ordered extent covering the bio
 56                  * - pointer to the checksums for this bio
 57                  * - original physical address from the allocator
 58                  *   (for zone append only)
 59                  */
 60                 struct {
 61                         struct btrfs_ordered_extent *ordered;
 62                         struct btrfs_ordered_sum *sums;
 63                         u64 orig_physical;
 64                 };
 65 
 66                 /* For metadata reads: parentness verification. */
 67                 struct btrfs_tree_parent_check parent_check;
 68         };
 69 
 70         /* End I/O information supplied to btrfs_bio_alloc */
 71         btrfs_bio_end_io_t end_io;
 72         void *private;
 73 
 74         /* For internal use in read end I/O handling */
 75         unsigned int mirror_num;
 76         atomic_t pending_ios;
 77         struct work_struct end_io_work;
 78 
 79         /* File system that this I/O operates on. */
 80         struct btrfs_fs_info *fs_info;
 81 
 82         /*
 83          * This member must come last, bio_alloc_bioset will allocate enough
 84          * bytes for entire btrfs_bio but relies on bio being last.
 85          */
 86         struct bio bio;
 87 };
 88 
 89 static inline struct btrfs_bio *btrfs_bio(struct bio *bio)
 90 {
 91         return container_of(bio, struct btrfs_bio, bio);
 92 }
 93 
 94 int __init btrfs_bioset_init(void);
 95 void __cold btrfs_bioset_exit(void);
 96 
 97 void btrfs_bio_init(struct btrfs_bio *bbio, struct btrfs_fs_info *fs_info,
 98                     btrfs_bio_end_io_t end_io, void *private);
 99 struct btrfs_bio *btrfs_bio_alloc(unsigned int nr_vecs, blk_opf_t opf,
100                                   struct btrfs_fs_info *fs_info,
101                                   btrfs_bio_end_io_t end_io, void *private);
102 void btrfs_bio_end_io(struct btrfs_bio *bbio, blk_status_t status);
103 
104 /* Submit using blkcg_punt_bio_submit. */
105 #define REQ_BTRFS_CGROUP_PUNT                   REQ_FS_PRIVATE
106 
107 void btrfs_submit_bio(struct btrfs_bio *bbio, int mirror_num);
108 void btrfs_submit_repair_write(struct btrfs_bio *bbio, int mirror_num, bool dev_replace);
109 int btrfs_repair_io_failure(struct btrfs_fs_info *fs_info, u64 ino, u64 start,
110                             u64 length, u64 logical, struct folio *folio,
111                             unsigned int folio_offset, int mirror_num);
112 
113 #endif
114 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php