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

TOMOYO Linux Cross Reference
Linux/include/linux/dm-dirty-log.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ 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.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-only */
  2 /*
  3  * Copyright (C) 2003 Sistina Software
  4  * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved.
  5  *
  6  * Device-Mapper dirty region log.
  7  *
  8  * This file is released under the LGPL.
  9  */
 10 
 11 #ifndef _LINUX_DM_DIRTY_LOG
 12 #define _LINUX_DM_DIRTY_LOG
 13 
 14 #ifdef __KERNEL__
 15 
 16 #include <linux/types.h>
 17 #include <linux/device-mapper.h>
 18 
 19 typedef sector_t region_t;
 20 
 21 struct dm_dirty_log_type;
 22 
 23 struct dm_dirty_log {
 24         struct dm_dirty_log_type *type;
 25         int (*flush_callback_fn)(struct dm_target *ti);
 26         void *context;
 27 };
 28 
 29 struct dm_dirty_log_type {
 30         const char *name;
 31         struct module *module;
 32 
 33         /* For internal device-mapper use */
 34         struct list_head list;
 35 
 36         int (*ctr)(struct dm_dirty_log *log, struct dm_target *ti,
 37                    unsigned int argc, char **argv);
 38         void (*dtr)(struct dm_dirty_log *log);
 39 
 40         /*
 41          * There are times when we don't want the log to touch
 42          * the disk.
 43          */
 44         int (*presuspend)(struct dm_dirty_log *log);
 45         int (*postsuspend)(struct dm_dirty_log *log);
 46         int (*resume)(struct dm_dirty_log *log);
 47 
 48         /*
 49          * Retrieves the smallest size of region that the log can
 50          * deal with.
 51          */
 52         uint32_t (*get_region_size)(struct dm_dirty_log *log);
 53 
 54         /*
 55          * A predicate to say whether a region is clean or not.
 56          * May block.
 57          */
 58         int (*is_clean)(struct dm_dirty_log *log, region_t region);
 59 
 60         /*
 61          *  Returns: 0, 1, -EWOULDBLOCK, < 0
 62          *
 63          * A predicate function to check the area given by
 64          * [sector, sector + len) is in sync.
 65          *
 66          * If -EWOULDBLOCK is returned the state of the region is
 67          * unknown, typically this will result in a read being
 68          * passed to a daemon to deal with, since a daemon is
 69          * allowed to block.
 70          */
 71         int (*in_sync)(struct dm_dirty_log *log, region_t region,
 72                        int can_block);
 73 
 74         /*
 75          * Flush the current log state (eg, to disk).  This
 76          * function may block.
 77          */
 78         int (*flush)(struct dm_dirty_log *log);
 79 
 80         /*
 81          * Mark an area as clean or dirty.  These functions may
 82          * block, though for performance reasons blocking should
 83          * be extremely rare (eg, allocating another chunk of
 84          * memory for some reason).
 85          */
 86         void (*mark_region)(struct dm_dirty_log *log, region_t region);
 87         void (*clear_region)(struct dm_dirty_log *log, region_t region);
 88 
 89         /*
 90          * Returns: <0 (error), 0 (no region), 1 (region)
 91          *
 92          * The mirrord will need perform recovery on regions of
 93          * the mirror that are in the NOSYNC state.  This
 94          * function asks the log to tell the caller about the
 95          * next region that this machine should recover.
 96          *
 97          * Do not confuse this function with 'in_sync()', one
 98          * tells you if an area is synchronised, the other
 99          * assigns recovery work.
100          */
101         int (*get_resync_work)(struct dm_dirty_log *log, region_t *region);
102 
103         /*
104          * This notifies the log that the resync status of a region
105          * has changed.  It also clears the region from the recovering
106          * list (if present).
107          */
108         void (*set_region_sync)(struct dm_dirty_log *log,
109                                 region_t region, int in_sync);
110 
111         /*
112          * Returns the number of regions that are in sync.
113          */
114         region_t (*get_sync_count)(struct dm_dirty_log *log);
115 
116         /*
117          * Support function for mirror status requests.
118          */
119         int (*status)(struct dm_dirty_log *log, status_type_t status_type,
120                       char *result, unsigned int maxlen);
121 
122         /*
123          * is_remote_recovering is necessary for cluster mirroring. It provides
124          * a way to detect recovery on another node, so we aren't writing
125          * concurrently.  This function is likely to block (when a cluster log
126          * is used).
127          *
128          * Returns: 0, 1
129          */
130         int (*is_remote_recovering)(struct dm_dirty_log *log, region_t region);
131 };
132 
133 int dm_dirty_log_type_register(struct dm_dirty_log_type *type);
134 int dm_dirty_log_type_unregister(struct dm_dirty_log_type *type);
135 
136 /*
137  * Make sure you use these two functions, rather than calling
138  * type->constructor/destructor() directly.
139  */
140 struct dm_dirty_log *dm_dirty_log_create(const char *type_name,
141                         struct dm_target *ti,
142                         int (*flush_callback_fn)(struct dm_target *ti),
143                         unsigned int argc, char **argv);
144 void dm_dirty_log_destroy(struct dm_dirty_log *log);
145 
146 #endif  /* __KERNEL__ */
147 #endif  /* _LINUX_DM_DIRTY_LOG_H */
148 

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