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

TOMOYO Linux Cross Reference
Linux/include/linux/dm-bufio.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ 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 ] ~

Diff markup

Differences between /include/linux/dm-bufio.h (Version linux-6.11.5) and /include/linux/dm-bufio.h (Version linux-6.0.19)


  1 /* SPDX-License-Identifier: GPL-2.0-only */    << 
  2 /*                                                  1 /*
  3  * Copyright (C) 2009-2011 Red Hat, Inc.            2  * Copyright (C) 2009-2011 Red Hat, Inc.
  4  *                                                  3  *
  5  * Author: Mikulas Patocka <mpatocka@redhat.co      4  * Author: Mikulas Patocka <mpatocka@redhat.com>
  6  *                                                  5  *
  7  * This file is released under the GPL.             6  * This file is released under the GPL.
  8  */                                                 7  */
  9                                                     8 
 10 #ifndef _LINUX_DM_BUFIO_H                           9 #ifndef _LINUX_DM_BUFIO_H
 11 #define _LINUX_DM_BUFIO_H                          10 #define _LINUX_DM_BUFIO_H
 12                                                    11 
 13 #include <linux/blkdev.h>                          12 #include <linux/blkdev.h>
 14 #include <linux/types.h>                           13 #include <linux/types.h>
 15                                                    14 
 16 /*--------------------------------------------     15 /*----------------------------------------------------------------*/
 17                                                    16 
 18 struct dm_bufio_client;                            17 struct dm_bufio_client;
 19 struct dm_buffer;                                  18 struct dm_buffer;
 20                                                    19 
 21 /*                                                 20 /*
 22  * Flags for dm_bufio_client_create                21  * Flags for dm_bufio_client_create
 23  */                                                22  */
 24 #define DM_BUFIO_CLIENT_NO_SLEEP 0x1               23 #define DM_BUFIO_CLIENT_NO_SLEEP 0x1
 25                                                    24 
 26 /*                                                 25 /*
 27  * Create a buffered IO cache on a given devic     26  * Create a buffered IO cache on a given device
 28  */                                                27  */
 29 struct dm_bufio_client *                           28 struct dm_bufio_client *
 30 dm_bufio_client_create(struct block_device *bd !!  29 dm_bufio_client_create(struct block_device *bdev, unsigned block_size,
 31                        unsigned int reserved_b !!  30                        unsigned reserved_buffers, unsigned aux_size,
 32                        void (*alloc_callback)(     31                        void (*alloc_callback)(struct dm_buffer *),
 33                        void (*write_callback)(     32                        void (*write_callback)(struct dm_buffer *),
 34                        unsigned int flags);        33                        unsigned int flags);
 35                                                    34 
 36 /*                                                 35 /*
 37  * Release a buffered IO cache.                    36  * Release a buffered IO cache.
 38  */                                                37  */
 39 void dm_bufio_client_destroy(struct dm_bufio_c     38 void dm_bufio_client_destroy(struct dm_bufio_client *c);
 40                                                    39 
 41 void dm_bufio_client_reset(struct dm_bufio_cli << 
 42                                                << 
 43 /*                                                 40 /*
 44  * Set the sector range.                           41  * Set the sector range.
 45  * When this function is called, there must be     42  * When this function is called, there must be no I/O in progress on the bufio
 46  * client.                                         43  * client.
 47  */                                                44  */
 48 void dm_bufio_set_sector_offset(struct dm_bufi     45 void dm_bufio_set_sector_offset(struct dm_bufio_client *c, sector_t start);
 49                                                    46 
 50 /*                                                 47 /*
 51  * WARNING: to avoid deadlocks, these conditio     48  * WARNING: to avoid deadlocks, these conditions are observed:
 52  *                                                 49  *
 53  * - At most one thread can hold at most "rese     50  * - At most one thread can hold at most "reserved_buffers" simultaneously.
 54  * - Each other threads can hold at most one b     51  * - Each other threads can hold at most one buffer.
 55  * - Threads which call only dm_bufio_get can      52  * - Threads which call only dm_bufio_get can hold unlimited number of
 56  *   buffers.                                      53  *   buffers.
 57  */                                                54  */
 58                                                    55 
 59 /*                                                 56 /*
 60  * Read a given block from disk. Returns point     57  * Read a given block from disk. Returns pointer to data.  Returns a
 61  * pointer to dm_buffer that can be used to re     58  * pointer to dm_buffer that can be used to release the buffer or to make
 62  * it dirty.                                       59  * it dirty.
 63  */                                                60  */
 64 void *dm_bufio_read(struct dm_bufio_client *c,     61 void *dm_bufio_read(struct dm_bufio_client *c, sector_t block,
 65                     struct dm_buffer **bp);        62                     struct dm_buffer **bp);
 66                                                    63 
 67 void *dm_bufio_read_with_ioprio(struct dm_bufi << 
 68                                 struct dm_buff << 
 69                                                << 
 70 /*                                                 64 /*
 71  * Like dm_bufio_read, but return buffer from      65  * Like dm_bufio_read, but return buffer from cache, don't read
 72  * it. If the buffer is not in the cache, retu     66  * it. If the buffer is not in the cache, return NULL.
 73  */                                                67  */
 74 void *dm_bufio_get(struct dm_bufio_client *c,      68 void *dm_bufio_get(struct dm_bufio_client *c, sector_t block,
 75                    struct dm_buffer **bp);         69                    struct dm_buffer **bp);
 76                                                    70 
 77 /*                                                 71 /*
 78  * Like dm_bufio_read, but don't read anything     72  * Like dm_bufio_read, but don't read anything from the disk.  It is
 79  * expected that the caller initializes the bu     73  * expected that the caller initializes the buffer and marks it dirty.
 80  */                                                74  */
 81 void *dm_bufio_new(struct dm_bufio_client *c,      75 void *dm_bufio_new(struct dm_bufio_client *c, sector_t block,
 82                    struct dm_buffer **bp);         76                    struct dm_buffer **bp);
 83                                                    77 
 84 /*                                                 78 /*
 85  * Prefetch the specified blocks to the cache.     79  * Prefetch the specified blocks to the cache.
 86  * The function starts to read the blocks and      80  * The function starts to read the blocks and returns without waiting for
 87  * I/O to finish.                                  81  * I/O to finish.
 88  */                                                82  */
 89 void dm_bufio_prefetch(struct dm_bufio_client      83 void dm_bufio_prefetch(struct dm_bufio_client *c,
 90                        sector_t block, unsigne !!  84                        sector_t block, unsigned n_blocks);
 91                                                << 
 92 void dm_bufio_prefetch_with_ioprio(struct dm_b << 
 93                                 sector_t block << 
 94                                 unsigned short << 
 95                                                    85 
 96 /*                                                 86 /*
 97  * Release a reference obtained with dm_bufio_     87  * Release a reference obtained with dm_bufio_{read,get,new}. The data
 98  * pointer and dm_buffer pointer is no longer      88  * pointer and dm_buffer pointer is no longer valid after this call.
 99  */                                                89  */
100 void dm_bufio_release(struct dm_buffer *b);        90 void dm_bufio_release(struct dm_buffer *b);
101                                                    91 
102 /*                                                 92 /*
103  * Mark a buffer dirty. It should be called af     93  * Mark a buffer dirty. It should be called after the buffer is modified.
104  *                                                 94  *
105  * In case of memory pressure, the buffer may      95  * In case of memory pressure, the buffer may be written after
106  * dm_bufio_mark_buffer_dirty, but before dm_b     96  * dm_bufio_mark_buffer_dirty, but before dm_bufio_write_dirty_buffers.  So
107  * dm_bufio_write_dirty_buffers guarantees tha     97  * dm_bufio_write_dirty_buffers guarantees that the buffer is on-disk but
108  * the actual writing may occur earlier.           98  * the actual writing may occur earlier.
109  */                                                99  */
110 void dm_bufio_mark_buffer_dirty(struct dm_buff    100 void dm_bufio_mark_buffer_dirty(struct dm_buffer *b);
111                                                   101 
112 /*                                                102 /*
113  * Mark a part of the buffer dirty.               103  * Mark a part of the buffer dirty.
114  *                                                104  *
115  * The specified part of the buffer is schedul    105  * The specified part of the buffer is scheduled to be written. dm-bufio may
116  * write the specified part of the buffer or i    106  * write the specified part of the buffer or it may write a larger superset.
117  */                                               107  */
118 void dm_bufio_mark_partial_buffer_dirty(struct    108 void dm_bufio_mark_partial_buffer_dirty(struct dm_buffer *b,
119                                         unsign !! 109                                         unsigned start, unsigned end);
120                                                   110 
121 /*                                                111 /*
122  * Initiate writing of dirty buffers, without     112  * Initiate writing of dirty buffers, without waiting for completion.
123  */                                               113  */
124 void dm_bufio_write_dirty_buffers_async(struct    114 void dm_bufio_write_dirty_buffers_async(struct dm_bufio_client *c);
125                                                   115 
126 /*                                                116 /*
127  * Write all dirty buffers. Guarantees that al    117  * Write all dirty buffers. Guarantees that all dirty buffers created prior
128  * to this call are on disk when this call exi    118  * to this call are on disk when this call exits.
129  */                                               119  */
130 int dm_bufio_write_dirty_buffers(struct dm_buf    120 int dm_bufio_write_dirty_buffers(struct dm_bufio_client *c);
131                                                   121 
132 /*                                                122 /*
133  * Send an empty write barrier to the device t    123  * Send an empty write barrier to the device to flush hardware disk cache.
134  */                                               124  */
135 int dm_bufio_issue_flush(struct dm_bufio_clien    125 int dm_bufio_issue_flush(struct dm_bufio_client *c);
136                                                   126 
137 /*                                                127 /*
138  * Send a discard request to the underlying de    128  * Send a discard request to the underlying device.
139  */                                               129  */
140 int dm_bufio_issue_discard(struct dm_bufio_cli    130 int dm_bufio_issue_discard(struct dm_bufio_client *c, sector_t block, sector_t count);
141                                                   131 
142 /*                                                132 /*
                                                   >> 133  * Like dm_bufio_release but also move the buffer to the new
                                                   >> 134  * block. dm_bufio_write_dirty_buffers is needed to commit the new block.
                                                   >> 135  */
                                                   >> 136 void dm_bufio_release_move(struct dm_buffer *b, sector_t new_block);
                                                   >> 137 
                                                   >> 138 /*
143  * Free the given buffer.                         139  * Free the given buffer.
144  * This is just a hint, if the buffer is in us    140  * This is just a hint, if the buffer is in use or dirty, this function
145  * does nothing.                                  141  * does nothing.
146  */                                               142  */
147 void dm_bufio_forget(struct dm_bufio_client *c    143 void dm_bufio_forget(struct dm_bufio_client *c, sector_t block);
148                                                   144 
149 /*                                                145 /*
150  * Free the given range of buffers.               146  * Free the given range of buffers.
151  * This is just a hint, if the buffer is in us    147  * This is just a hint, if the buffer is in use or dirty, this function
152  * does nothing.                                  148  * does nothing.
153  */                                               149  */
154 void dm_bufio_forget_buffers(struct dm_bufio_c    150 void dm_bufio_forget_buffers(struct dm_bufio_client *c, sector_t block, sector_t n_blocks);
155                                                   151 
156 /*                                                152 /*
157  * Set the minimum number of buffers before cl    153  * Set the minimum number of buffers before cleanup happens.
158  */                                               154  */
159 void dm_bufio_set_minimum_buffers(struct dm_bu !! 155 void dm_bufio_set_minimum_buffers(struct dm_bufio_client *c, unsigned n);
160                                                   156 
161 unsigned int dm_bufio_get_block_size(struct dm !! 157 unsigned dm_bufio_get_block_size(struct dm_bufio_client *c);
162 sector_t dm_bufio_get_device_size(struct dm_bu    158 sector_t dm_bufio_get_device_size(struct dm_bufio_client *c);
163 struct dm_io_client *dm_bufio_get_dm_io_client    159 struct dm_io_client *dm_bufio_get_dm_io_client(struct dm_bufio_client *c);
164 sector_t dm_bufio_get_block_number(struct dm_b    160 sector_t dm_bufio_get_block_number(struct dm_buffer *b);
165 void *dm_bufio_get_block_data(struct dm_buffer    161 void *dm_bufio_get_block_data(struct dm_buffer *b);
166 void *dm_bufio_get_aux_data(struct dm_buffer *    162 void *dm_bufio_get_aux_data(struct dm_buffer *b);
167 struct dm_bufio_client *dm_bufio_get_client(st    163 struct dm_bufio_client *dm_bufio_get_client(struct dm_buffer *b);
168                                                   164 
169 /*--------------------------------------------    165 /*----------------------------------------------------------------*/
170                                                   166 
171 #endif                                            167 #endif
172                                                   168 

~ [ 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