21
21
* nilfs_palloc_groups_per_desc_block - get the number of groups that a group
22
22
* descriptor block can maintain
23
23
* @inode: inode of metadata file using this allocator
24
+ *
25
+ * Return: Number of groups that a group descriptor block can maintain.
24
26
*/
25
27
static inline unsigned long
26
28
nilfs_palloc_groups_per_desc_block (const struct inode * inode )
@@ -32,6 +34,8 @@ nilfs_palloc_groups_per_desc_block(const struct inode *inode)
32
34
/**
33
35
* nilfs_palloc_groups_count - get maximum number of groups
34
36
* @inode: inode of metadata file using this allocator
37
+ *
38
+ * Return: Maximum number of groups.
35
39
*/
36
40
static inline unsigned long
37
41
nilfs_palloc_groups_count (const struct inode * inode )
@@ -43,6 +47,8 @@ nilfs_palloc_groups_count(const struct inode *inode)
43
47
* nilfs_palloc_init_blockgroup - initialize private variables for allocator
44
48
* @inode: inode of metadata file using this allocator
45
49
* @entry_size: size of the persistent object
50
+ *
51
+ * Return: 0 on success, or a negative error code on failure.
46
52
*/
47
53
int nilfs_palloc_init_blockgroup (struct inode * inode , unsigned int entry_size )
48
54
{
@@ -78,6 +84,9 @@ int nilfs_palloc_init_blockgroup(struct inode *inode, unsigned int entry_size)
78
84
* @inode: inode of metadata file using this allocator
79
85
* @nr: serial number of the entry (e.g. inode number)
80
86
* @offset: pointer to store offset number in the group
87
+ *
88
+ * Return: Number of the group that contains the entry with the index
89
+ * specified by @nr.
81
90
*/
82
91
static unsigned long nilfs_palloc_group (const struct inode * inode , __u64 nr ,
83
92
unsigned long * offset )
@@ -93,8 +102,8 @@ static unsigned long nilfs_palloc_group(const struct inode *inode, __u64 nr,
93
102
* @inode: inode of metadata file using this allocator
94
103
* @group: group number
95
104
*
96
- * nilfs_palloc_desc_blkoff() returns block offset of the descriptor
97
- * block which contains a descriptor of the specified group.
105
+ * Return: Index number in the metadata file of the descriptor block of
106
+ * the group specified by @ group.
98
107
*/
99
108
static unsigned long
100
109
nilfs_palloc_desc_blkoff (const struct inode * inode , unsigned long group )
@@ -111,6 +120,9 @@ nilfs_palloc_desc_blkoff(const struct inode *inode, unsigned long group)
111
120
*
112
121
* nilfs_palloc_bitmap_blkoff() returns block offset of the bitmap
113
122
* block used to allocate/deallocate entries in the specified group.
123
+ *
124
+ * Return: Index number in the metadata file of the bitmap block of
125
+ * the group specified by @group.
114
126
*/
115
127
static unsigned long
116
128
nilfs_palloc_bitmap_blkoff (const struct inode * inode , unsigned long group )
@@ -125,6 +137,8 @@ nilfs_palloc_bitmap_blkoff(const struct inode *inode, unsigned long group)
125
137
* nilfs_palloc_group_desc_nfrees - get the number of free entries in a group
126
138
* @desc: pointer to descriptor structure for the group
127
139
* @lock: spin lock protecting @desc
140
+ *
141
+ * Return: Number of free entries written in the group descriptor @desc.
128
142
*/
129
143
static unsigned long
130
144
nilfs_palloc_group_desc_nfrees (const struct nilfs_palloc_group_desc * desc ,
@@ -143,6 +157,9 @@ nilfs_palloc_group_desc_nfrees(const struct nilfs_palloc_group_desc *desc,
143
157
* @desc: pointer to descriptor structure for the group
144
158
* @lock: spin lock protecting @desc
145
159
* @n: delta to be added
160
+ *
161
+ * Return: Number of free entries after adjusting the group descriptor
162
+ * @desc.
146
163
*/
147
164
static u32
148
165
nilfs_palloc_group_desc_add_entries (struct nilfs_palloc_group_desc * desc ,
@@ -161,6 +178,9 @@ nilfs_palloc_group_desc_add_entries(struct nilfs_palloc_group_desc *desc,
161
178
* nilfs_palloc_entry_blkoff - get block offset of an entry block
162
179
* @inode: inode of metadata file using this allocator
163
180
* @nr: serial number of the entry (e.g. inode number)
181
+ *
182
+ * Return: Index number in the metadata file of the block containing
183
+ * the entry specified by @nr.
164
184
*/
165
185
static unsigned long
166
186
nilfs_palloc_entry_blkoff (const struct inode * inode , __u64 nr )
@@ -238,6 +258,12 @@ static int nilfs_palloc_get_block(struct inode *inode, unsigned long blkoff,
238
258
* @blkoff: block offset
239
259
* @prev: nilfs_bh_assoc struct of the last used buffer
240
260
* @lock: spin lock protecting @prev
261
+ *
262
+ * Return: 0 on success, or one of the following negative error codes on
263
+ * failure:
264
+ * * %-EIO - I/O error (including metadata corruption).
265
+ * * %-ENOENT - Non-existent block.
266
+ * * %-ENOMEM - Insufficient memory available.
241
267
*/
242
268
static int nilfs_palloc_delete_block (struct inode * inode , unsigned long blkoff ,
243
269
struct nilfs_bh_assoc * prev ,
@@ -258,6 +284,8 @@ static int nilfs_palloc_delete_block(struct inode *inode, unsigned long blkoff,
258
284
* @group: group number
259
285
* @create: create flag
260
286
* @bhp: pointer to store the resultant buffer head
287
+ *
288
+ * Return: 0 on success, or a negative error code on failure.
261
289
*/
262
290
static int nilfs_palloc_get_desc_block (struct inode * inode ,
263
291
unsigned long group ,
@@ -277,6 +305,8 @@ static int nilfs_palloc_get_desc_block(struct inode *inode,
277
305
* @group: group number
278
306
* @create: create flag
279
307
* @bhp: pointer to store the resultant buffer head
308
+ *
309
+ * Return: 0 on success, or a negative error code on failure.
280
310
*/
281
311
static int nilfs_palloc_get_bitmap_block (struct inode * inode ,
282
312
unsigned long group ,
@@ -294,6 +324,8 @@ static int nilfs_palloc_get_bitmap_block(struct inode *inode,
294
324
* nilfs_palloc_delete_bitmap_block - delete a bitmap block
295
325
* @inode: inode of metadata file using this allocator
296
326
* @group: group number
327
+ *
328
+ * Return: 0 on success, or a negative error code on failure.
297
329
*/
298
330
static int nilfs_palloc_delete_bitmap_block (struct inode * inode ,
299
331
unsigned long group )
@@ -312,6 +344,8 @@ static int nilfs_palloc_delete_bitmap_block(struct inode *inode,
312
344
* @nr: serial number of the entry (e.g. inode number)
313
345
* @create: create flag
314
346
* @bhp: pointer to store the resultant buffer head
347
+ *
348
+ * Return: 0 on success, or a negative error code on failure.
315
349
*/
316
350
int nilfs_palloc_get_entry_block (struct inode * inode , __u64 nr ,
317
351
int create , struct buffer_head * * bhp )
@@ -328,6 +362,8 @@ int nilfs_palloc_get_entry_block(struct inode *inode, __u64 nr,
328
362
* nilfs_palloc_delete_entry_block - delete an entry block
329
363
* @inode: inode of metadata file using this allocator
330
364
* @nr: serial number of the entry
365
+ *
366
+ * Return: 0 on success, or a negative error code on failure.
331
367
*/
332
368
static int nilfs_palloc_delete_entry_block (struct inode * inode , __u64 nr )
333
369
{
@@ -397,6 +433,9 @@ size_t nilfs_palloc_entry_offset(const struct inode *inode, __u64 nr,
397
433
* @bsize: size in bits
398
434
* @lock: spin lock protecting @bitmap
399
435
* @wrap: whether to wrap around
436
+ *
437
+ * Return: Offset number within the group of the found free entry, or
438
+ * %-ENOSPC if not found.
400
439
*/
401
440
static int nilfs_palloc_find_available_slot (unsigned char * bitmap ,
402
441
unsigned long target ,
@@ -438,6 +477,9 @@ static int nilfs_palloc_find_available_slot(unsigned char *bitmap,
438
477
* @inode: inode of metadata file using this allocator
439
478
* @curr: current group number
440
479
* @max: maximum number of groups
480
+ *
481
+ * Return: Number of remaining descriptors (= groups) managed by the descriptor
482
+ * block.
441
483
*/
442
484
static unsigned long
443
485
nilfs_palloc_rest_groups_in_desc_block (const struct inode * inode ,
@@ -453,6 +495,8 @@ nilfs_palloc_rest_groups_in_desc_block(const struct inode *inode,
453
495
* nilfs_palloc_count_desc_blocks - count descriptor blocks number
454
496
* @inode: inode of metadata file using this allocator
455
497
* @desc_blocks: descriptor blocks number [out]
498
+ *
499
+ * Return: 0 on success, or a negative error code on failure.
456
500
*/
457
501
static int nilfs_palloc_count_desc_blocks (struct inode * inode ,
458
502
unsigned long * desc_blocks )
@@ -473,6 +517,8 @@ static int nilfs_palloc_count_desc_blocks(struct inode *inode,
473
517
* MDT file growing
474
518
* @inode: inode of metadata file using this allocator
475
519
* @desc_blocks: known current descriptor blocks count
520
+ *
521
+ * Return: true if a group can be added in the metadata file, false if not.
476
522
*/
477
523
static inline bool nilfs_palloc_mdt_file_can_grow (struct inode * inode ,
478
524
unsigned long desc_blocks )
@@ -487,6 +533,12 @@ static inline bool nilfs_palloc_mdt_file_can_grow(struct inode *inode,
487
533
* @inode: inode of metadata file using this allocator
488
534
* @nused: current number of used entries
489
535
* @nmaxp: max number of entries [out]
536
+ *
537
+ * Return: 0 on success, or one of the following negative error codes on
538
+ * failure:
539
+ * * %-EIO - I/O error (including metadata corruption).
540
+ * * %-ENOMEM - Insufficient memory available.
541
+ * * %-ERANGE - Number of entries in use is out of range.
490
542
*/
491
543
int nilfs_palloc_count_max_entries (struct inode * inode , u64 nused , u64 * nmaxp )
492
544
{
@@ -518,6 +570,13 @@ int nilfs_palloc_count_max_entries(struct inode *inode, u64 nused, u64 *nmaxp)
518
570
* @inode: inode of metadata file using this allocator
519
571
* @req: nilfs_palloc_req structure exchanged for the allocation
520
572
* @wrap: whether to wrap around
573
+ *
574
+ * Return: 0 on success, or one of the following negative error codes on
575
+ * failure:
576
+ * * %-EIO - I/O error (including metadata corruption).
577
+ * * %-ENOMEM - Insufficient memory available.
578
+ * * %-ENOSPC - Entries exhausted (No entries available for allocation).
579
+ * * %-EROFS - Read only filesystem
521
580
*/
522
581
int nilfs_palloc_prepare_alloc_entry (struct inode * inode ,
523
582
struct nilfs_palloc_req * req , bool wrap )
@@ -710,6 +769,8 @@ void nilfs_palloc_abort_alloc_entry(struct inode *inode,
710
769
* nilfs_palloc_prepare_free_entry - prepare to deallocate a persistent object
711
770
* @inode: inode of metadata file using this allocator
712
771
* @req: nilfs_palloc_req structure exchanged for the removal
772
+ *
773
+ * Return: 0 on success, or a negative error code on failure.
713
774
*/
714
775
int nilfs_palloc_prepare_free_entry (struct inode * inode ,
715
776
struct nilfs_palloc_req * req )
@@ -754,6 +815,8 @@ void nilfs_palloc_abort_free_entry(struct inode *inode,
754
815
* @inode: inode of metadata file using this allocator
755
816
* @entry_nrs: array of entry numbers to be deallocated
756
817
* @nitems: number of entries stored in @entry_nrs
818
+ *
819
+ * Return: 0 on success, or a negative error code on failure.
757
820
*/
758
821
int nilfs_palloc_freev (struct inode * inode , __u64 * entry_nrs , size_t nitems )
759
822
{
0 commit comments