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

TOMOYO Linux Cross Reference
Linux/fs/ocfs2/reservations.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 ] ~

Diff markup

Differences between /fs/ocfs2/reservations.h (Version linux-6.12-rc7) and /fs/ocfs2/reservations.h (Version linux-5.5.19)


  1 /* SPDX-License-Identifier: GPL-2.0-only */         1 /* SPDX-License-Identifier: GPL-2.0-only */
  2 /*                                             !!   2 /* -*- mode: c; c-basic-offset: 8; -*-
                                                   >>   3  * vim: noexpandtab sw=8 ts=8 sts=0:
                                                   >>   4  *
  3  * reservations.h                                   5  * reservations.h
  4  *                                                  6  *
  5  * Allocation reservations function prototypes      7  * Allocation reservations function prototypes and structures.
  6  *                                                  8  *
  7  * Copyright (C) 2010 Novell.  All rights rese      9  * Copyright (C) 2010 Novell.  All rights reserved.
  8  */                                                10  */
  9                                                    11 
 10 #ifndef OCFS2_RESERVATIONS_H                       12 #ifndef OCFS2_RESERVATIONS_H
 11 #define OCFS2_RESERVATIONS_H                       13 #define OCFS2_RESERVATIONS_H
 12                                                    14 
 13 #include <linux/rbtree.h>                          15 #include <linux/rbtree.h>
 14                                                    16 
 15 #define OCFS2_DEFAULT_RESV_LEVEL        2          17 #define OCFS2_DEFAULT_RESV_LEVEL        2
 16 #define OCFS2_MAX_RESV_LEVEL    9                  18 #define OCFS2_MAX_RESV_LEVEL    9
 17 #define OCFS2_MIN_RESV_LEVEL    0                  19 #define OCFS2_MIN_RESV_LEVEL    0
 18                                                    20 
 19 struct ocfs2_alloc_reservation {                   21 struct ocfs2_alloc_reservation {
 20         struct rb_node  r_node;                    22         struct rb_node  r_node;
 21                                                    23 
 22         unsigned int    r_start;        /* Beg     24         unsigned int    r_start;        /* Beginning of current window */
 23         unsigned int    r_len;          /* Len     25         unsigned int    r_len;          /* Length of the window */
 24                                                    26 
 25         unsigned int    r_last_len;     /* Len     27         unsigned int    r_last_len;     /* Length of most recent alloc */
 26         unsigned int    r_last_start;   /* Sta     28         unsigned int    r_last_start;   /* Start of most recent alloc */
 27         struct list_head        r_lru;  /* LRU     29         struct list_head        r_lru;  /* LRU list head */
 28                                                    30 
 29         unsigned int    r_flags;                   31         unsigned int    r_flags;
 30 };                                                 32 };
 31                                                    33 
 32 #define OCFS2_RESV_FLAG_INUSE   0x01    /* Set     34 #define OCFS2_RESV_FLAG_INUSE   0x01    /* Set when r_node is part of a btree */
 33 #define OCFS2_RESV_FLAG_TMP     0x02    /* Tem     35 #define OCFS2_RESV_FLAG_TMP     0x02    /* Temporary reservation, will be
 34                                          * des     36                                          * destroyed immedately after use */
 35 #define OCFS2_RESV_FLAG_DIR     0x04    /* Res     37 #define OCFS2_RESV_FLAG_DIR     0x04    /* Reservation is for an unindexed
 36                                          * dir     38                                          * directory btree */
 37                                                    39 
 38 struct ocfs2_reservation_map {                     40 struct ocfs2_reservation_map {
 39         struct rb_root          m_reservations     41         struct rb_root          m_reservations;
 40         char                    *m_disk_bitmap     42         char                    *m_disk_bitmap;
 41                                                    43 
 42         struct ocfs2_super      *m_osb;            44         struct ocfs2_super      *m_osb;
 43                                                    45 
 44         /* The following are not initialized t     46         /* The following are not initialized to meaningful values until a disk
 45          * bitmap is provided. */                  47          * bitmap is provided. */
 46         u32                     m_bitmap_len;      48         u32                     m_bitmap_len;   /* Number of valid
 47                                                    49                                                  * bits available */
 48                                                    50 
 49         struct list_head        m_lru;             51         struct list_head        m_lru;          /* LRU of reservations
 50                                                    52                                                  * structures. */
 51                                                    53 
 52 };                                                 54 };
 53                                                    55 
 54 void ocfs2_resv_init_once(struct ocfs2_alloc_r     56 void ocfs2_resv_init_once(struct ocfs2_alloc_reservation *resv);
 55                                                    57 
 56 #define OCFS2_RESV_TYPES        (OCFS2_RESV_FL     58 #define OCFS2_RESV_TYPES        (OCFS2_RESV_FLAG_TMP|OCFS2_RESV_FLAG_DIR)
 57 void ocfs2_resv_set_type(struct ocfs2_alloc_re     59 void ocfs2_resv_set_type(struct ocfs2_alloc_reservation *resv,
 58                          unsigned int flags);      60                          unsigned int flags);
 59                                                    61 
 60 int ocfs2_dir_resv_allowed(struct ocfs2_super      62 int ocfs2_dir_resv_allowed(struct ocfs2_super *osb);
 61                                                    63 
 62 /**                                                64 /**
 63  * ocfs2_resv_discard() - truncate a reservati     65  * ocfs2_resv_discard() - truncate a reservation
 64  * @resmap:                                        66  * @resmap:
 65  * @resv: the reservation to truncate.             67  * @resv: the reservation to truncate.
 66  *                                                 68  *
 67  * After this function is called, the reservat     69  * After this function is called, the reservation will be empty, and
 68  * unlinked from the rbtree.                       70  * unlinked from the rbtree.
 69  */                                                71  */
 70 void ocfs2_resv_discard(struct ocfs2_reservati     72 void ocfs2_resv_discard(struct ocfs2_reservation_map *resmap,
 71                         struct ocfs2_alloc_res     73                         struct ocfs2_alloc_reservation *resv);
 72                                                    74 
 73                                                    75 
 74 /**                                                76 /**
 75  * ocfs2_resmap_init() - Initialize fields of      77  * ocfs2_resmap_init() - Initialize fields of a reservations bitmap
 76  * @osb: struct ocfs2_super to be saved in res << 
 77  * @resmap: struct ocfs2_reservation_map to in     78  * @resmap: struct ocfs2_reservation_map to initialize
                                                   >>  79  * @obj: unused for now
                                                   >>  80  * @ops: unused for now
                                                   >>  81  * @max_bitmap_bytes: Maximum size of the bitmap (typically blocksize)
                                                   >>  82  *
                                                   >>  83  * Only possible return value other than '' is -ENOMEM for failure to
                                                   >>  84  * allocation mirror bitmap.
 78  */                                                85  */
 79 void ocfs2_resmap_init(struct ocfs2_super *osb !!  86 int ocfs2_resmap_init(struct ocfs2_super *osb,
 80                       struct ocfs2_reservation     87                       struct ocfs2_reservation_map *resmap);
 81                                                    88 
 82 /**                                                89 /**
 83  * ocfs2_resmap_restart() - "restart" a reserv     90  * ocfs2_resmap_restart() - "restart" a reservation bitmap
 84  * @resmap: reservations bitmap                    91  * @resmap: reservations bitmap
 85  * @clen: Number of valid bits in the bitmap       92  * @clen: Number of valid bits in the bitmap
 86  * @disk_bitmap: the disk bitmap this resmap s     93  * @disk_bitmap: the disk bitmap this resmap should refer to.
 87  *                                                 94  *
 88  * Re-initialize the parameters of a reservati     95  * Re-initialize the parameters of a reservation bitmap. This is
 89  * useful for local alloc window slides.           96  * useful for local alloc window slides.
 90  *                                                 97  *
 91  * This function will call ocfs2_trunc_resv ag     98  * This function will call ocfs2_trunc_resv against all existing
 92  * reservations. A future version will recalcu     99  * reservations. A future version will recalculate existing
 93  * reservations based on the new bitmap.          100  * reservations based on the new bitmap.
 94  */                                               101  */
 95 void ocfs2_resmap_restart(struct ocfs2_reserva    102 void ocfs2_resmap_restart(struct ocfs2_reservation_map *resmap,
 96                           unsigned int clen, c    103                           unsigned int clen, char *disk_bitmap);
 97                                                   104 
 98 /**                                               105 /**
 99  * ocfs2_resmap_uninit() - uninitialize a rese    106  * ocfs2_resmap_uninit() - uninitialize a reservation bitmap structure
100  * @resmap: the struct ocfs2_reservation_map t    107  * @resmap: the struct ocfs2_reservation_map to uninitialize
101  */                                               108  */
102 void ocfs2_resmap_uninit(struct ocfs2_reservat    109 void ocfs2_resmap_uninit(struct ocfs2_reservation_map *resmap);
103                                                   110 
104 /**                                               111 /**
105  * ocfs2_resmap_resv_bits() - Return still-val    112  * ocfs2_resmap_resv_bits() - Return still-valid reservation bits
106  * @resmap: reservations bitmap                   113  * @resmap: reservations bitmap
107  * @resv: reservation to base search from         114  * @resv: reservation to base search from
108  * @cstart: start of proposed allocation          115  * @cstart: start of proposed allocation
109  * @clen: length (in clusters) of proposed all    116  * @clen: length (in clusters) of proposed allocation
110  *                                                117  *
111  * Using the reservation data from resv, this     118  * Using the reservation data from resv, this function will compare
112  * resmap and resmap->m_disk_bitmap to determi    119  * resmap and resmap->m_disk_bitmap to determine what part (if any) of
113  * the reservation window is still clear to us    120  * the reservation window is still clear to use. If resv is empty,
114  * this function will try to allocate a window    121  * this function will try to allocate a window for it.
115  *                                                122  *
116  * On success, zero is returned and the valid     123  * On success, zero is returned and the valid allocation area is set in cstart
117  * and clen.                                      124  * and clen.
118  *                                                125  *
119  * Returns -ENOSPC if reservations are disable    126  * Returns -ENOSPC if reservations are disabled.
120  */                                               127  */
121 int ocfs2_resmap_resv_bits(struct ocfs2_reserv    128 int ocfs2_resmap_resv_bits(struct ocfs2_reservation_map *resmap,
122                            struct ocfs2_alloc_    129                            struct ocfs2_alloc_reservation *resv,
123                            int *cstart, int *c    130                            int *cstart, int *clen);
124                                                   131 
125 /**                                               132 /**
126  * ocfs2_resmap_claimed_bits() - Tell the rese    133  * ocfs2_resmap_claimed_bits() - Tell the reservation code that bits were used.
127  * @resmap: reservations bitmap                   134  * @resmap: reservations bitmap
128  * @resv: optional reservation to recalulate b    135  * @resv: optional reservation to recalulate based on new bitmap
129  * @cstart: start of allocation in clusters       136  * @cstart: start of allocation in clusters
130  * @clen: end of allocation in clusters.          137  * @clen: end of allocation in clusters.
131  *                                                138  *
132  * Tell the reservation code that bits were us    139  * Tell the reservation code that bits were used to fulfill allocation in
133  * resmap. The bits don't have to have been pa    140  * resmap. The bits don't have to have been part of any existing
134  * reservation. But we must always call this f    141  * reservation. But we must always call this function when bits are claimed.
135  * Internally, the reservations code will use     142  * Internally, the reservations code will use this information to mark the
136  * reservations bitmap. If resv is passed, it'    143  * reservations bitmap. If resv is passed, it's next allocation window will be
137  * calculated. It also expects that 'cstart' i    144  * calculated. It also expects that 'cstart' is the same as we passed back
138  * from ocfs2_resmap_resv_bits().                 145  * from ocfs2_resmap_resv_bits().
139  */                                               146  */
140 void ocfs2_resmap_claimed_bits(struct ocfs2_re    147 void ocfs2_resmap_claimed_bits(struct ocfs2_reservation_map *resmap,
141                                struct ocfs2_al    148                                struct ocfs2_alloc_reservation *resv,
142                                u32 cstart, u32    149                                u32 cstart, u32 clen);
143                                                   150 
144 #endif  /* OCFS2_RESERVATIONS_H */                151 #endif  /* OCFS2_RESERVATIONS_H */
145                                                   152 

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