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

TOMOYO Linux Cross Reference
Linux/include/linux/dm-region-hash.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 Limited.
  4  * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved.
  5  *
  6  * Device-Mapper dirty region hash interface.
  7  *
  8  * This file is released under the GPL.
  9  */
 10 
 11 #ifndef DM_REGION_HASH_H
 12 #define DM_REGION_HASH_H
 13 
 14 #include <linux/dm-dirty-log.h>
 15 
 16 /*
 17  *----------------------------------------------------------------
 18  * Region hash
 19  *----------------------------------------------------------------
 20  */
 21 struct dm_region_hash;
 22 struct dm_region;
 23 
 24 /*
 25  * States a region can have.
 26  */
 27 enum dm_rh_region_states {
 28         DM_RH_CLEAN      = 0x01,        /* No writes in flight. */
 29         DM_RH_DIRTY      = 0x02,        /* Writes in flight. */
 30         DM_RH_NOSYNC     = 0x04,        /* Out of sync. */
 31         DM_RH_RECOVERING = 0x08,        /* Under resynchronization. */
 32 };
 33 
 34 /*
 35  * Region hash create/destroy.
 36  */
 37 struct bio_list;
 38 struct dm_region_hash *dm_region_hash_create(
 39                 void *context, void (*dispatch_bios)(void *context,
 40                                                      struct bio_list *bios),
 41                 void (*wakeup_workers)(void *context),
 42                 void (*wakeup_all_recovery_waiters)(void *context),
 43                 sector_t target_begin, unsigned int max_recovery,
 44                 struct dm_dirty_log *log, uint32_t region_size,
 45                 region_t nr_regions);
 46 void dm_region_hash_destroy(struct dm_region_hash *rh);
 47 
 48 struct dm_dirty_log *dm_rh_dirty_log(struct dm_region_hash *rh);
 49 
 50 /*
 51  * Conversion functions.
 52  */
 53 region_t dm_rh_bio_to_region(struct dm_region_hash *rh, struct bio *bio);
 54 sector_t dm_rh_region_to_sector(struct dm_region_hash *rh, region_t region);
 55 void *dm_rh_region_context(struct dm_region *reg);
 56 
 57 /*
 58  * Get region size and key (ie. number of the region).
 59  */
 60 sector_t dm_rh_get_region_size(struct dm_region_hash *rh);
 61 region_t dm_rh_get_region_key(struct dm_region *reg);
 62 
 63 /*
 64  * Get/set/update region state (and dirty log).
 65  *
 66  */
 67 int dm_rh_get_state(struct dm_region_hash *rh, region_t region, int may_block);
 68 void dm_rh_set_state(struct dm_region_hash *rh, region_t region,
 69                      enum dm_rh_region_states state, int may_block);
 70 
 71 /* Non-zero errors_handled leaves the state of the region NOSYNC */
 72 void dm_rh_update_states(struct dm_region_hash *rh, int errors_handled);
 73 
 74 /* Flush the region hash and dirty log. */
 75 int dm_rh_flush(struct dm_region_hash *rh);
 76 
 77 /* Inc/dec pending count on regions. */
 78 void dm_rh_inc_pending(struct dm_region_hash *rh, struct bio_list *bios);
 79 void dm_rh_dec(struct dm_region_hash *rh, region_t region);
 80 
 81 /* Delay bios on regions. */
 82 void dm_rh_delay(struct dm_region_hash *rh, struct bio *bio);
 83 
 84 void dm_rh_mark_nosync(struct dm_region_hash *rh, struct bio *bio);
 85 
 86 /*
 87  * Region recovery control.
 88  */
 89 
 90 /* Prepare some regions for recovery by starting to quiesce them. */
 91 void dm_rh_recovery_prepare(struct dm_region_hash *rh);
 92 
 93 /* Try fetching a quiesced region for recovery. */
 94 struct dm_region *dm_rh_recovery_start(struct dm_region_hash *rh);
 95 
 96 /* Report recovery end on a region. */
 97 void dm_rh_recovery_end(struct dm_region *reg, int error);
 98 
 99 /* Returns number of regions with recovery work outstanding. */
100 int dm_rh_recovery_in_flight(struct dm_region_hash *rh);
101 
102 /* Start/stop recovery. */
103 void dm_rh_start_recovery(struct dm_region_hash *rh);
104 void dm_rh_stop_recovery(struct dm_region_hash *rh);
105 
106 #endif /* DM_REGION_HASH_H */
107 

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