~ubuntu-branches/ubuntu/vivid/linux-ti-omap/vivid

« back to all changes in this revision

Viewing changes to ubuntu/dm-raid4-5/dm-region-hash.h

  • Committer: Bazaar Package Importer
  • Author(s): Stefan Bader, Amit Kucheria
  • Date: 2010-03-23 18:05:12 UTC
  • Revision ID: james.westby@ubuntu.com-20100323180512-iavj906ocnphdubp
Tags: 2.6.33-500.3
[ Amit Kucheria ]

* [Config] Fix the debug package name to end in -dbgsym
* SAUCE: Add the ubuntu/ drivers to omap
* SAUCE: Re-export the symbols for aufs
* [Config] Enable AUFS and COMPCACHE

Show diffs side-by-side

added added

removed removed

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