Skip to content

Commit fd4e7fa

Browse files
konisakpm00
authored andcommitted
nilfs2: add missing return value kernel-doc descriptions
There are a number of kernel-doc comments for functions that are missing return values, which also causes a number of warnings when the kernel-doc script is run with the "-Wall" option. Fix this issue by adding proper return value descriptions, and improve code maintainability. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Ryusuke Konishi <[email protected]> Cc: "Brian G ." <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 343d4a3 commit fd4e7fa

File tree

14 files changed

+160
-7
lines changed

14 files changed

+160
-7
lines changed

fs/nilfs2/alloc.c

Lines changed: 65 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
* nilfs_palloc_groups_per_desc_block - get the number of groups that a group
2222
* descriptor block can maintain
2323
* @inode: inode of metadata file using this allocator
24+
*
25+
* Return: Number of groups that a group descriptor block can maintain.
2426
*/
2527
static inline unsigned long
2628
nilfs_palloc_groups_per_desc_block(const struct inode *inode)
@@ -32,6 +34,8 @@ nilfs_palloc_groups_per_desc_block(const struct inode *inode)
3234
/**
3335
* nilfs_palloc_groups_count - get maximum number of groups
3436
* @inode: inode of metadata file using this allocator
37+
*
38+
* Return: Maximum number of groups.
3539
*/
3640
static inline unsigned long
3741
nilfs_palloc_groups_count(const struct inode *inode)
@@ -43,6 +47,8 @@ nilfs_palloc_groups_count(const struct inode *inode)
4347
* nilfs_palloc_init_blockgroup - initialize private variables for allocator
4448
* @inode: inode of metadata file using this allocator
4549
* @entry_size: size of the persistent object
50+
*
51+
* Return: 0 on success, or a negative error code on failure.
4652
*/
4753
int nilfs_palloc_init_blockgroup(struct inode *inode, unsigned int entry_size)
4854
{
@@ -78,6 +84,9 @@ int nilfs_palloc_init_blockgroup(struct inode *inode, unsigned int entry_size)
7884
* @inode: inode of metadata file using this allocator
7985
* @nr: serial number of the entry (e.g. inode number)
8086
* @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.
8190
*/
8291
static unsigned long nilfs_palloc_group(const struct inode *inode, __u64 nr,
8392
unsigned long *offset)
@@ -93,8 +102,8 @@ static unsigned long nilfs_palloc_group(const struct inode *inode, __u64 nr,
93102
* @inode: inode of metadata file using this allocator
94103
* @group: group number
95104
*
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.
98107
*/
99108
static unsigned long
100109
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)
111120
*
112121
* nilfs_palloc_bitmap_blkoff() returns block offset of the bitmap
113122
* 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.
114126
*/
115127
static unsigned long
116128
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)
125137
* nilfs_palloc_group_desc_nfrees - get the number of free entries in a group
126138
* @desc: pointer to descriptor structure for the group
127139
* @lock: spin lock protecting @desc
140+
*
141+
* Return: Number of free entries written in the group descriptor @desc.
128142
*/
129143
static unsigned long
130144
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,
143157
* @desc: pointer to descriptor structure for the group
144158
* @lock: spin lock protecting @desc
145159
* @n: delta to be added
160+
*
161+
* Return: Number of free entries after adjusting the group descriptor
162+
* @desc.
146163
*/
147164
static u32
148165
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,
161178
* nilfs_palloc_entry_blkoff - get block offset of an entry block
162179
* @inode: inode of metadata file using this allocator
163180
* @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.
164184
*/
165185
static unsigned long
166186
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,
238258
* @blkoff: block offset
239259
* @prev: nilfs_bh_assoc struct of the last used buffer
240260
* @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.
241267
*/
242268
static int nilfs_palloc_delete_block(struct inode *inode, unsigned long blkoff,
243269
struct nilfs_bh_assoc *prev,
@@ -258,6 +284,8 @@ static int nilfs_palloc_delete_block(struct inode *inode, unsigned long blkoff,
258284
* @group: group number
259285
* @create: create flag
260286
* @bhp: pointer to store the resultant buffer head
287+
*
288+
* Return: 0 on success, or a negative error code on failure.
261289
*/
262290
static int nilfs_palloc_get_desc_block(struct inode *inode,
263291
unsigned long group,
@@ -277,6 +305,8 @@ static int nilfs_palloc_get_desc_block(struct inode *inode,
277305
* @group: group number
278306
* @create: create flag
279307
* @bhp: pointer to store the resultant buffer head
308+
*
309+
* Return: 0 on success, or a negative error code on failure.
280310
*/
281311
static int nilfs_palloc_get_bitmap_block(struct inode *inode,
282312
unsigned long group,
@@ -294,6 +324,8 @@ static int nilfs_palloc_get_bitmap_block(struct inode *inode,
294324
* nilfs_palloc_delete_bitmap_block - delete a bitmap block
295325
* @inode: inode of metadata file using this allocator
296326
* @group: group number
327+
*
328+
* Return: 0 on success, or a negative error code on failure.
297329
*/
298330
static int nilfs_palloc_delete_bitmap_block(struct inode *inode,
299331
unsigned long group)
@@ -312,6 +344,8 @@ static int nilfs_palloc_delete_bitmap_block(struct inode *inode,
312344
* @nr: serial number of the entry (e.g. inode number)
313345
* @create: create flag
314346
* @bhp: pointer to store the resultant buffer head
347+
*
348+
* Return: 0 on success, or a negative error code on failure.
315349
*/
316350
int nilfs_palloc_get_entry_block(struct inode *inode, __u64 nr,
317351
int create, struct buffer_head **bhp)
@@ -328,6 +362,8 @@ int nilfs_palloc_get_entry_block(struct inode *inode, __u64 nr,
328362
* nilfs_palloc_delete_entry_block - delete an entry block
329363
* @inode: inode of metadata file using this allocator
330364
* @nr: serial number of the entry
365+
*
366+
* Return: 0 on success, or a negative error code on failure.
331367
*/
332368
static int nilfs_palloc_delete_entry_block(struct inode *inode, __u64 nr)
333369
{
@@ -397,6 +433,9 @@ size_t nilfs_palloc_entry_offset(const struct inode *inode, __u64 nr,
397433
* @bsize: size in bits
398434
* @lock: spin lock protecting @bitmap
399435
* @wrap: whether to wrap around
436+
*
437+
* Return: Offset number within the group of the found free entry, or
438+
* %-ENOSPC if not found.
400439
*/
401440
static int nilfs_palloc_find_available_slot(unsigned char *bitmap,
402441
unsigned long target,
@@ -438,6 +477,9 @@ static int nilfs_palloc_find_available_slot(unsigned char *bitmap,
438477
* @inode: inode of metadata file using this allocator
439478
* @curr: current group number
440479
* @max: maximum number of groups
480+
*
481+
* Return: Number of remaining descriptors (= groups) managed by the descriptor
482+
* block.
441483
*/
442484
static unsigned long
443485
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,
453495
* nilfs_palloc_count_desc_blocks - count descriptor blocks number
454496
* @inode: inode of metadata file using this allocator
455497
* @desc_blocks: descriptor blocks number [out]
498+
*
499+
* Return: 0 on success, or a negative error code on failure.
456500
*/
457501
static int nilfs_palloc_count_desc_blocks(struct inode *inode,
458502
unsigned long *desc_blocks)
@@ -473,6 +517,8 @@ static int nilfs_palloc_count_desc_blocks(struct inode *inode,
473517
* MDT file growing
474518
* @inode: inode of metadata file using this allocator
475519
* @desc_blocks: known current descriptor blocks count
520+
*
521+
* Return: true if a group can be added in the metadata file, false if not.
476522
*/
477523
static inline bool nilfs_palloc_mdt_file_can_grow(struct inode *inode,
478524
unsigned long desc_blocks)
@@ -487,6 +533,12 @@ static inline bool nilfs_palloc_mdt_file_can_grow(struct inode *inode,
487533
* @inode: inode of metadata file using this allocator
488534
* @nused: current number of used entries
489535
* @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.
490542
*/
491543
int nilfs_palloc_count_max_entries(struct inode *inode, u64 nused, u64 *nmaxp)
492544
{
@@ -518,6 +570,13 @@ int nilfs_palloc_count_max_entries(struct inode *inode, u64 nused, u64 *nmaxp)
518570
* @inode: inode of metadata file using this allocator
519571
* @req: nilfs_palloc_req structure exchanged for the allocation
520572
* @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
521580
*/
522581
int nilfs_palloc_prepare_alloc_entry(struct inode *inode,
523582
struct nilfs_palloc_req *req, bool wrap)
@@ -710,6 +769,8 @@ void nilfs_palloc_abort_alloc_entry(struct inode *inode,
710769
* nilfs_palloc_prepare_free_entry - prepare to deallocate a persistent object
711770
* @inode: inode of metadata file using this allocator
712771
* @req: nilfs_palloc_req structure exchanged for the removal
772+
*
773+
* Return: 0 on success, or a negative error code on failure.
713774
*/
714775
int nilfs_palloc_prepare_free_entry(struct inode *inode,
715776
struct nilfs_palloc_req *req)
@@ -754,6 +815,8 @@ void nilfs_palloc_abort_free_entry(struct inode *inode,
754815
* @inode: inode of metadata file using this allocator
755816
* @entry_nrs: array of entry numbers to be deallocated
756817
* @nitems: number of entries stored in @entry_nrs
818+
*
819+
* Return: 0 on success, or a negative error code on failure.
757820
*/
758821
int nilfs_palloc_freev(struct inode *inode, __u64 *entry_nrs, size_t nitems)
759822
{

fs/nilfs2/alloc.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
*
2222
* The number of entries per group is defined by the number of bits
2323
* that a bitmap block can maintain.
24+
*
25+
* Return: Number of entries per group.
2426
*/
2527
static inline unsigned long
2628
nilfs_palloc_entries_per_group(const struct inode *inode)

fs/nilfs2/cpfile.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,6 +1124,8 @@ int nilfs_cpfile_get_stat(struct inode *cpfile, struct nilfs_cpstat *cpstat)
11241124
* @cpsize: size of a checkpoint entry
11251125
* @raw_inode: on-disk cpfile inode
11261126
* @inodep: buffer to store the inode
1127+
*
1128+
* Return: 0 on success, or a negative error code on failure.
11271129
*/
11281130
int nilfs_cpfile_read(struct super_block *sb, size_t cpsize,
11291131
struct nilfs_inode *raw_inode, struct inode **inodep)

fs/nilfs2/dat.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,8 @@ ssize_t nilfs_dat_get_vinfo(struct inode *dat, void *buf, unsigned int visz,
481481
* @entry_size: size of a dat entry
482482
* @raw_inode: on-disk dat inode
483483
* @inodep: buffer to store the inode
484+
*
485+
* Return: 0 on success, or a negative error code on failure.
484486
*/
485487
int nilfs_dat_read(struct super_block *sb, size_t entry_size,
486488
struct nilfs_inode *raw_inode, struct inode **inodep)

fs/nilfs2/ifile.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,8 @@ int nilfs_ifile_get_inode_block(struct inode *ifile, ino_t ino,
146146
* @ifile: ifile inode
147147
* @nmaxinodes: current maximum of available inodes count [out]
148148
* @nfreeinodes: free inodes count [out]
149+
*
150+
* Return: 0 on success, or a negative error code on failure.
149151
*/
150152
int nilfs_ifile_count_free_inodes(struct inode *ifile,
151153
u64 *nmaxinodes, u64 *nfreeinodes)

fs/nilfs2/inode.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ void nilfs_inode_sub_blocks(struct inode *inode, int n)
6868
*
6969
* This function does not issue actual read request of the specified data
7070
* block. It is done by VFS.
71+
*
72+
* Return: 0 on success, or a negative error code on failure.
7173
*/
7274
int nilfs_get_block(struct inode *inode, sector_t blkoff,
7375
struct buffer_head *bh_result, int create)
@@ -141,6 +143,8 @@ int nilfs_get_block(struct inode *inode, sector_t blkoff,
141143
* address_space_operations.
142144
* @file: file struct of the file to be read
143145
* @folio: the folio to be read
146+
*
147+
* Return: 0 on success, or a negative error code on failure.
144148
*/
145149
static int nilfs_read_folio(struct file *file, struct folio *folio)
146150
{

fs/nilfs2/mdt.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,8 @@ void nilfs_mdt_set_entry_size(struct inode *inode, unsigned int entry_size,
519519
* nilfs_mdt_setup_shadow_map - setup shadow map and bind it to metadata file
520520
* @inode: inode of the metadata file
521521
* @shadow: shadow mapping
522+
*
523+
* Return: 0 on success, or a negative error code on failure.
522524
*/
523525
int nilfs_mdt_setup_shadow_map(struct inode *inode,
524526
struct nilfs_shadow_map *shadow)
@@ -540,6 +542,8 @@ int nilfs_mdt_setup_shadow_map(struct inode *inode,
540542
/**
541543
* nilfs_mdt_save_to_shadow_map - copy bmap and dirty pages to shadow map
542544
* @inode: inode of the metadata file
545+
*
546+
* Return: 0 on success, or a negative error code on failure.
543547
*/
544548
int nilfs_mdt_save_to_shadow_map(struct inode *inode)
545549
{

fs/nilfs2/page.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,7 @@ void nilfs_copy_buffer(struct buffer_head *dbh, struct buffer_head *sbh)
135135
* nilfs_folio_buffers_clean - Check if a folio has dirty buffers or not.
136136
* @folio: Folio to be checked.
137137
*
138-
* nilfs_folio_buffers_clean() returns false if the folio has dirty buffers.
139-
* Otherwise, it returns true.
138+
* Return: false if the folio has dirty buffers, true otherwise.
140139
*/
141140
bool nilfs_folio_buffers_clean(struct folio *folio)
142141
{
@@ -500,8 +499,9 @@ void __nilfs_clear_folio_dirty(struct folio *folio)
500499
* This function searches an extent of buffers marked "delayed" which
501500
* starts from a block offset equal to or larger than @start_blk. If
502501
* such an extent was found, this will store the start offset in
503-
* @blkoff and return its length in blocks. Otherwise, zero is
504-
* returned.
502+
* @blkoff and return its length in blocks.
503+
*
504+
* Return: Length in blocks of found extent, 0 otherwise.
505505
*/
506506
unsigned long nilfs_find_uncommitted_extent(struct inode *inode,
507507
sector_t start_blk,

0 commit comments

Comments
 (0)