Skip to contentSkip to conversation

jbd2: Fix comment describing journal_init_common()

PATCH Applied Daniel Martín Gómez 4 participants 4 messages Nov 7, 2024 – Nov 14, 2024 Journalling layer for block devices (JBD2)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 jbd2: Fix comment describing journal_init_common()

The code indicates that journal_init_common() fills the journal_t object it returns while the comment incorrectly states that only a few fields are initialised. Also, the comment claims that journal structures could be created from scratch which isn't possible as journal_init_common() calls journal_load_superblock() which loads and checks journal superblock from disk.

---
 fs/jbd2/journal.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
fs/jbd2/journal.c +4 -3
index 97f487c3d8fc..3c1d42133687 100644
@@ -1518,9 +1518,10 @@ static int journal_load_superblock(journal_t *journal)
  * destroy journal_t structures, and to initialise and read existing
  * journal blocks from disk.  */
 
-/* First: create and setup a journal_t object in memory.  We initialise
- * very few fields yet: that has to wait until we have created the
- * journal structures from from scratch, or loaded them from disk. */
+/* The journal_init_common() function creates and fills a journal_t object
+ * in memory. It calls journal_load_superblock() to load the on-disk journal
+ * superblock and initialize the journal_t object.
+ */
 
 static journal_t *journal_init_common(struct block_device *bdev,
 			struct block_device *fs_dev,
Signature · 1 line
2.39.5
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Daniel Martín Gómez

The code indicates that journal_init_common() fills the journal_t object it returns while the comment incorrectly states that only a few fields are initialised. Also, the comment claims that journal structures could be created from scratch which isn't possible as journal_init_common() calls journal_load_superblock() which loads and checks journal superblock from disk.

Indeed. Thanks for fixing this up. Feel free to add:

Honza

Quoted 26 lines
---
 fs/jbd2/journal.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
fs/jbd2/journal.c +4 -3
index 97f487c3d8fc..3c1d42133687 100644
@@ -1518,9 +1518,10 @@ static int journal_load_superblock(journal_t *journal)
  * destroy journal_t structures, and to initialise and read existing
  * journal blocks from disk.  */
 
-/* First: create and setup a journal_t object in memory.  We initialise
- * very few fields yet: that has to wait until we have created the
- * journal structures from from scratch, or loaded them from disk. */
+/* The journal_init_common() function creates and fills a journal_t object
+ * in memory. It calls journal_load_superblock() to load the on-disk journal
+ * superblock and initialize the journal_t object.
+ */
 
 static journal_t *journal_init_common(struct block_device *bdev,
 			struct block_device *fs_dev,
Signature · 1 line
2.39.5
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
Reviewed-by on v1 1/1
#2 lore raw
In reply to Daniel Martín Gómez
Quoted 8 lines · Daniel Martín Gómez

The code indicates that journal_init_common() fills the journal_t object it returns while the comment incorrectly states that only a few fields are initialised. Also, the comment claims that journal structures could be created from scratch which isn't possible as journal_init_common() calls journal_load_superblock() which loads and checks journal superblock from disk.

Ha, thank you for the fix. This comment became stale after commit c30713084ba5 ("jbd2:move load_superblock() into journal_init_common()") in the "ext4,jbd2: cleanup journal load and initialization process" series.

Quoted 22 lines
---
 fs/jbd2/journal.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
fs/jbd2/journal.c +4 -3
index 97f487c3d8fc..3c1d42133687 100644
@@ -1518,9 +1518,10 @@ static int journal_load_superblock(journal_t *journal)
  * destroy journal_t structures, and to initialise and read existing
  * journal blocks from disk.  */
 
-/* First: create and setup a journal_t object in memory.  We initialise
- * very few fields yet: that has to wait until we have created the
- * journal structures from from scratch, or loaded them from disk. */
+/* The journal_init_common() function creates and fills a journal_t object
+ * in memory. It calls journal_load_superblock() to load the on-disk journal
+ * superblock and initialize the journal_t object.
+ */
 
 static journal_t *journal_init_common(struct block_device *bdev,
 			struct block_device *fs_dev,
maintainer Applied
#3 lore raw
In reply to Daniel Martín Gómez
Quoted 8 lines · Daniel Martín Gómez

The code indicates that journal_init_common() fills the journal_t object it returns while the comment incorrectly states that only a few fields are initialised. Also, the comment claims that journal structures could be created from scratch which isn't possible as journal_init_common() calls journal_load_superblock() which loads and checks journal superblock from disk.

[...]

Applied, thanks!

[1/1] jbd2: Fix comment describing journal_init_common()

      commit: 3e7c69cdb053f9edea95502853f35952ab6cbf06

Best regards,

Signature · 1 line
Theodore Ts'o <[email protected]>