Skip to content

Commit 0828258

Browse files
committed
Refine the comments
1 parent dde1216 commit 0828258

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

extent.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,18 @@
33

44
#include "simplefs.h"
55

6-
/* Search for the extent containing the target block.
6+
/* Search for the extent containing the target block. Binary search is used
7+
* for efficiency.
8+
*
79
* Returns the first unused file index if not found.
810
* Returns -1 if the target block is out of range.
9-
* Binary search is used for efficiency.
1011
*/
1112
uint32_t simplefs_ext_search(struct simplefs_file_ei_block *index,
1213
uint32_t iblock)
1314
{
14-
/* first, find the first unused file index with binary search.
15-
* It'll be our right boundary for actual binary search
16-
* and return value when file index is not found.
15+
/* First, find the first unused file index with binary search.
16+
* It will be our right boundary for actual binary search and the return
17+
* value when the file index is not found.
1718
*/
1819
uint32_t start = 0;
1920
uint32_t end = SIMPLEFS_MAX_EXTENTS - 1;
@@ -62,13 +63,13 @@ uint32_t simplefs_ext_search(struct simplefs_file_ei_block *index,
6263

6364
/* return 'end' if it directs to valid block
6465
* return 'boundary' if index is not found
65-
* and eiblock has remaining space */
66+
* and eiblock has remaining space
67+
*/
6668
end_block = index->extents[end].ee_block;
6769
end_len = index->extents[end].ee_len;
68-
if (iblock >= end_block && iblock < end_len) {
70+
if (iblock >= end_block && iblock < end_len)
6971
return end;
70-
} else if (boundary < SIMPLEFS_MAX_EXTENTS) {
72+
if (boundary < SIMPLEFS_MAX_EXTENTS)
7173
return boundary;
72-
}
7374
return boundary;
74-
}
75+
}

inode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ struct inode *simplefs_iget(struct super_block *sb, unsigned long ino)
9696
return ERR_PTR(ret);
9797
}
9898

99-
/* Searches for a dentry in dir.
99+
/* Search for a dentry in dir.
100100
* Fills dentry with NULL if not found in dir, or with the corresponding inode
101101
* if found.
102102
* Returns NULL on success, indicating the dentry was successfully filled or

mkfs.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,9 @@ static int write_ifree_blocks(int fd, struct superblock *sb)
155155
goto end;
156156
}
157157

158-
/* All ifree blocks except the one containing 2 first inodes */
158+
/* All free blocks in the inode bitmap except the one containing the first
159+
* two inodes.
160+
*/
159161
ifree[0] = 0xffffffffffffffff;
160162
uint32_t i;
161163
for (i = 1; i < le32toh(sb->info.nr_ifree_blocks); i++) {

0 commit comments

Comments
 (0)