1 jbd2: fix sphinx kernel-doc build warnings
3 From: "Tobin C. Harding" <me@tobin.cc>
5 Sphinx emits various (26) warnings when building make target 'htmldocs'.
6 Currently struct definitions contain duplicate documentation, some as
7 kernel-docs and some as standard c89 comments. We can reduce
8 duplication while cleaning up the kernel docs.
10 Move all kernel-docs to right above each struct member. Use the set of
11 all existing comments (kernel-doc and c89). Add documentation for
12 missing struct members and function arguments.
14 Signed-off-by: Tobin C. Harding <me@tobin.cc>
15 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
17 fs/jbd2/transaction.c | 5 +-
18 include/linux/jbd2.h | 431 ++++++++++++++++++++++++++++++++++++++++-------------------------
19 2 files changed, 272 insertions(+), 164 deletions(-)
21 diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
22 index 881a9e09ca4e..ac311037d7a5 100644
23 --- a/fs/jbd2/transaction.c
24 +++ b/fs/jbd2/transaction.c
25 @@ -492,8 +492,10 @@ void jbd2_journal_free_reserved(handle_t *handle)
26 EXPORT_SYMBOL(jbd2_journal_free_reserved);
29 - * int jbd2_journal_start_reserved(handle_t *handle) - start reserved handle
30 + * int jbd2_journal_start_reserved() - start reserved handle
31 * @handle: handle to start
32 + * @type: for handle statistics
33 + * @line_no: for handle statistics
35 * Start handle that has been previously reserved with jbd2_journal_reserve().
36 * This attaches @handle to the running transaction (or creates one if there's
37 @@ -623,6 +625,7 @@ int jbd2_journal_extend(handle_t *handle, int nblocks)
38 * int jbd2_journal_restart() - restart a handle .
39 * @handle: handle to restart
40 * @nblocks: nr credits requested
41 + * @gfp_mask: memory allocation flags (for start_this_handle)
43 * Restart a handle for a multi-transaction filesystem
45 diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
46 index 296d1e0ea87b..b708e5169d1d 100644
47 --- a/include/linux/jbd2.h
48 +++ b/include/linux/jbd2.h
49 @@ -418,26 +418,41 @@ static inline void jbd_unlock_bh_journal_head(struct buffer_head *bh)
50 #define JI_WAIT_DATA (1 << __JI_WAIT_DATA)
53 - * struct jbd_inode is the structure linking inodes in ordered mode
54 - * present in a transaction so that we can sync them during commit.
55 + * struct jbd_inode - The jbd_inode type is the structure linking inodes in
56 + * ordered mode present in a transaction so that we can sync them during commit.
59 - /* Which transaction does this inode belong to? Either the running
60 - * transaction or the committing one. [j_list_lock] */
64 + * Which transaction does this inode belong to? Either the running
65 + * transaction or the committing one. [j_list_lock]
67 transaction_t *i_transaction;
69 - /* Pointer to the running transaction modifying inode's data in case
70 - * there is already a committing transaction touching it. [j_list_lock] */
72 + * @i_next_transaction:
74 + * Pointer to the running transaction modifying inode's data in case
75 + * there is already a committing transaction touching it. [j_list_lock]
77 transaction_t *i_next_transaction;
79 - /* List of inodes in the i_transaction [j_list_lock] */
81 + * @i_list: List of inodes in the i_transaction [j_list_lock]
83 struct list_head i_list;
85 - /* VFS inode this inode belongs to [constant during the lifetime
86 - * of the structure] */
90 + * VFS inode this inode belongs to [constant for lifetime of structure]
92 struct inode *i_vfs_inode;
94 - /* Flags of inode [j_list_lock] */
96 + * @i_flags: Flags of inode [j_list_lock]
98 unsigned long i_flags;
101 @@ -447,12 +462,20 @@ struct jbd2_revoke_table_s;
102 * struct handle_s - The handle_s type is the concrete type associated with
104 * @h_transaction: Which compound transaction is this update a part of?
105 + * @h_journal: Which journal handle belongs to - used iff h_reserved set.
106 + * @h_rsv_handle: Handle reserved for finishing the logical operation.
107 * @h_buffer_credits: Number of remaining buffers we are allowed to dirty.
108 - * @h_ref: Reference count on this handle
109 - * @h_err: Field for caller's use to track errors through large fs operations
110 - * @h_sync: flag for sync-on-close
111 - * @h_jdata: flag to force data journaling
112 - * @h_aborted: flag indicating fatal error on handle
113 + * @h_ref: Reference count on this handle.
114 + * @h_err: Field for caller's use to track errors through large fs operations.
115 + * @h_sync: Flag for sync-on-close.
116 + * @h_jdata: Flag to force data journaling.
117 + * @h_reserved: Flag for handle for reserved credits.
118 + * @h_aborted: Flag indicating fatal error on handle.
119 + * @h_type: For handle statistics.
120 + * @h_line_no: For handle statistics.
121 + * @h_start_jiffies: Handle Start time.
122 + * @h_requested_credits: Holds @h_buffer_credits after handle is started.
123 + * @saved_alloc_context: Saved context while transaction is open.
126 /* Docbook can't yet cope with the bit fields, but will leave the documentation
127 @@ -462,32 +485,23 @@ struct jbd2_revoke_table_s;
128 struct jbd2_journal_handle
131 - /* Which compound transaction is this update a part of? */
132 transaction_t *h_transaction;
133 /* Which journal handle belongs to - used iff h_reserved set */
134 journal_t *h_journal;
137 - /* Handle reserved for finishing the logical operation */
138 handle_t *h_rsv_handle;
140 - /* Number of remaining buffers we are allowed to dirty: */
141 int h_buffer_credits;
143 - /* Reference count on this handle */
146 - /* Field for caller's use to track errors through large fs */
150 /* Flags [no locking] */
151 - unsigned int h_sync: 1; /* sync-on-close */
152 - unsigned int h_jdata: 1; /* force data journaling */
153 - unsigned int h_reserved: 1; /* handle with reserved credits */
154 - unsigned int h_aborted: 1; /* fatal error on handle */
155 - unsigned int h_type: 8; /* for handle statistics */
156 - unsigned int h_line_no: 16; /* for handle statistics */
157 + unsigned int h_sync: 1;
158 + unsigned int h_jdata: 1;
159 + unsigned int h_reserved: 1;
160 + unsigned int h_aborted: 1;
161 + unsigned int h_type: 8;
162 + unsigned int h_line_no: 16;
164 unsigned long h_start_jiffies;
165 unsigned int h_requested_credits;
166 @@ -729,228 +743,253 @@ jbd2_time_diff(unsigned long start, unsigned long end)
168 * struct journal_s - The journal_s type is the concrete type associated with
170 - * @j_flags: General journaling state flags
171 - * @j_errno: Is there an outstanding uncleared error on the journal (from a
173 - * @j_sb_buffer: First part of superblock buffer
174 - * @j_superblock: Second part of superblock buffer
175 - * @j_format_version: Version of the superblock format
176 - * @j_state_lock: Protect the various scalars in the journal
177 - * @j_barrier_count: Number of processes waiting to create a barrier lock
178 - * @j_barrier: The barrier lock itself
179 - * @j_running_transaction: The current running transaction..
180 - * @j_committing_transaction: the transaction we are pushing to disk
181 - * @j_checkpoint_transactions: a linked circular list of all transactions
182 - * waiting for checkpointing
183 - * @j_wait_transaction_locked: Wait queue for waiting for a locked transaction
184 - * to start committing, or for a barrier lock to be released
185 - * @j_wait_done_commit: Wait queue for waiting for commit to complete
186 - * @j_wait_commit: Wait queue to trigger commit
187 - * @j_wait_updates: Wait queue to wait for updates to complete
188 - * @j_wait_reserved: Wait queue to wait for reserved buffer credits to drop
189 - * @j_checkpoint_mutex: Mutex for locking against concurrent checkpoints
190 - * @j_head: Journal head - identifies the first unused block in the journal
191 - * @j_tail: Journal tail - identifies the oldest still-used block in the
193 - * @j_free: Journal free - how many free blocks are there in the journal?
194 - * @j_first: The block number of the first usable block
195 - * @j_last: The block number one beyond the last usable block
196 - * @j_dev: Device where we store the journal
197 - * @j_blocksize: blocksize for the location where we store the journal.
198 - * @j_blk_offset: starting block offset for into the device where we store the
200 - * @j_fs_dev: Device which holds the client fs. For internal journal this will
201 - * be equal to j_dev
202 - * @j_reserved_credits: Number of buffers reserved from the running transaction
203 - * @j_maxlen: Total maximum capacity of the journal region on disk.
204 - * @j_list_lock: Protects the buffer lists and internal buffer state.
205 - * @j_inode: Optional inode where we store the journal. If present, all journal
206 - * block numbers are mapped into this inode via bmap().
207 - * @j_tail_sequence: Sequence number of the oldest transaction in the log
208 - * @j_transaction_sequence: Sequence number of the next transaction to grant
209 - * @j_commit_sequence: Sequence number of the most recently committed
211 - * @j_commit_request: Sequence number of the most recent transaction wanting
213 - * @j_uuid: Uuid of client object.
214 - * @j_task: Pointer to the current commit thread for this journal
215 - * @j_max_transaction_buffers: Maximum number of metadata buffers to allow in a
216 - * single compound commit transaction
217 - * @j_commit_interval: What is the maximum transaction lifetime before we begin
219 - * @j_commit_timer: The timer used to wakeup the commit thread
220 - * @j_revoke_lock: Protect the revoke table
221 - * @j_revoke: The revoke table - maintains the list of revoked blocks in the
222 - * current transaction.
223 - * @j_revoke_table: alternate revoke tables for j_revoke
224 - * @j_wbuf: array of buffer_heads for jbd2_journal_commit_transaction
225 - * @j_wbufsize: maximum number of buffer_heads allowed in j_wbuf, the
226 - * number that will fit in j_blocksize
227 - * @j_last_sync_writer: most recent pid which did a synchronous write
228 - * @j_history_lock: Protect the transactions statistics history
229 - * @j_proc_entry: procfs entry for the jbd statistics directory
230 - * @j_stats: Overall statistics
231 - * @j_private: An opaque pointer to fs-private information.
232 - * @j_trans_commit_map: Lockdep entity to track transaction commit dependencies
237 - /* General journaling state flags [j_state_lock] */
239 + * @j_flags: General journaling state flags [j_state_lock]
241 unsigned long j_flags;
247 * Is there an outstanding uncleared error on the journal (from a prior
248 * abort)? [j_state_lock]
252 - /* The superblock buffer */
254 + * @j_sb_buffer: The first part of the superblock buffer.
256 struct buffer_head *j_sb_buffer;
259 + * @j_superblock: The second part of the superblock buffer.
261 journal_superblock_t *j_superblock;
263 - /* Version of the superblock format */
265 + * @j_format_version: Version of the superblock format.
267 int j_format_version;
270 - * Protect the various scalars in the journal
272 + * @j_state_lock: Protect the various scalars in the journal.
274 rwlock_t j_state_lock;
278 + * @j_barrier_count:
280 * Number of processes waiting to create a barrier lock [j_state_lock]
284 - /* The barrier lock itself */
286 + * @j_barrier: The barrier lock itself.
288 struct mutex j_barrier;
292 + * @j_running_transaction:
294 * Transactions: The current running transaction...
295 * [j_state_lock] [caller holding open handle]
297 transaction_t *j_running_transaction;
301 + * @j_committing_transaction:
303 * the transaction we are pushing to disk
304 * [j_state_lock] [caller holding open handle]
306 transaction_t *j_committing_transaction;
310 + * @j_checkpoint_transactions:
312 * ... and a linked circular list of all transactions waiting for
313 * checkpointing. [j_list_lock]
315 transaction_t *j_checkpoint_transactions;
319 + * @j_wait_transaction_locked:
321 * Wait queue for waiting for a locked transaction to start committing,
322 - * or for a barrier lock to be released
323 + * or for a barrier lock to be released.
325 wait_queue_head_t j_wait_transaction_locked;
327 - /* Wait queue for waiting for commit to complete */
329 + * @j_wait_done_commit: Wait queue for waiting for commit to complete.
331 wait_queue_head_t j_wait_done_commit;
333 - /* Wait queue to trigger commit */
335 + * @j_wait_commit: Wait queue to trigger commit.
337 wait_queue_head_t j_wait_commit;
339 - /* Wait queue to wait for updates to complete */
341 + * @j_wait_updates: Wait queue to wait for updates to complete.
343 wait_queue_head_t j_wait_updates;
345 - /* Wait queue to wait for reserved buffer credits to drop */
347 + * @j_wait_reserved:
349 + * Wait queue to wait for reserved buffer credits to drop.
351 wait_queue_head_t j_wait_reserved;
353 - /* Semaphore for locking against concurrent checkpoints */
355 + * @j_checkpoint_mutex:
357 + * Semaphore for locking against concurrent checkpoints.
359 struct mutex j_checkpoint_mutex;
365 * List of buffer heads used by the checkpoint routine. This
366 * was moved from jbd2_log_do_checkpoint() to reduce stack
367 * usage. Access to this array is controlled by the
368 - * j_checkpoint_mutex. [j_checkpoint_mutex]
369 + * @j_checkpoint_mutex. [j_checkpoint_mutex]
371 struct buffer_head *j_chkpt_bhs[JBD2_NR_BATCH];
378 * Journal head: identifies the first unused block in the journal.
381 unsigned long j_head;
387 * Journal tail: identifies the oldest still-used block in the journal.
390 unsigned long j_tail;
396 * Journal free: how many free blocks are there in the journal?
399 unsigned long j_free;
402 - * Journal start and end: the block numbers of the first usable block
403 - * and one beyond the last usable block in the journal. [j_state_lock]
407 + * The block number of the first usable block in the journal
410 unsigned long j_first;
415 + * The block number one beyond the last usable block in the journal
418 unsigned long j_last;
421 - * Device, blocksize and starting block offset for the location where we
422 - * store the journal.
424 + * @j_dev: Device where we store the journal.
426 struct block_device *j_dev;
429 + * @j_blocksize: Block size for the location where we store the journal.
436 + * Starting block offset into the device where we store the journal.
438 unsigned long long j_blk_offset;
441 + * @j_devname: Journal device name.
443 char j_devname[BDEVNAME_SIZE+24];
449 * Device which holds the client fs. For internal journal this will be
452 struct block_device *j_fs_dev;
454 - /* Total maximum capacity of the journal region on disk. */
456 + * @j_maxlen: Total maximum capacity of the journal region on disk.
458 unsigned int j_maxlen;
460 - /* Number of buffers reserved from the running transaction */
462 + * @j_reserved_credits:
464 + * Number of buffers reserved from the running transaction.
466 atomic_t j_reserved_credits;
469 - * Protects the buffer lists and internal buffer state.
471 + * @j_list_lock: Protects the buffer lists and internal buffer state.
473 spinlock_t j_list_lock;
475 - /* Optional inode where we store the journal. If present, all */
476 - /* journal block numbers are mapped into this inode via */
481 + * Optional inode where we store the journal. If present, all
482 + * journal block numbers are mapped into this inode via bmap().
484 struct inode *j_inode;
488 + * @j_tail_sequence:
490 * Sequence number of the oldest transaction in the log [j_state_lock]
492 tid_t j_tail_sequence;
496 + * @j_transaction_sequence:
498 * Sequence number of the next transaction to grant [j_state_lock]
500 tid_t j_transaction_sequence;
504 + * @j_commit_sequence:
506 * Sequence number of the most recently committed transaction
509 tid_t j_commit_sequence;
513 + * @j_commit_request:
515 * Sequence number of the most recent transaction wanting commit
518 tid_t j_commit_request;
524 * Journal uuid: identifies the object (filesystem, LVM volume etc)
525 * backed by this journal. This will eventually be replaced by an array
526 * of uuids, allowing us to index multiple devices within a single
527 @@ -958,85 +997,151 @@ struct journal_s
531 - /* Pointer to the current commit thread for this journal */
533 + * @j_task: Pointer to the current commit thread for this journal.
535 struct task_struct *j_task;
539 + * @j_max_transaction_buffers:
541 * Maximum number of metadata buffers to allow in a single compound
542 - * commit transaction
543 + * commit transaction.
545 int j_max_transaction_buffers;
549 + * @j_commit_interval:
551 * What is the maximum transaction lifetime before we begin a commit?
553 unsigned long j_commit_interval;
555 - /* The timer used to wakeup the commit thread: */
557 + * @j_commit_timer: The timer used to wakeup the commit thread.
559 struct timer_list j_commit_timer;
562 - * The revoke table: maintains the list of revoked blocks in the
563 - * current transaction. [j_revoke_lock]
565 + * @j_revoke_lock: Protect the revoke table.
567 spinlock_t j_revoke_lock;
572 + * The revoke table - maintains the list of revoked blocks in the
573 + * current transaction.
575 struct jbd2_revoke_table_s *j_revoke;
578 + * @j_revoke_table: Alternate revoke tables for j_revoke.
580 struct jbd2_revoke_table_s *j_revoke_table[2];
583 - * array of bhs for jbd2_journal_commit_transaction
585 + * @j_wbuf: Array of bhs for jbd2_journal_commit_transaction.
587 struct buffer_head **j_wbuf;
592 + * Size of @j_wbuf array.
597 - * this is the pid of hte last person to run a synchronous operation
598 - * through the journal
600 + * @j_last_sync_writer:
602 + * The pid of the last person to run a synchronous operation
603 + * through the journal.
605 pid_t j_last_sync_writer;
608 - * the average amount of time in nanoseconds it takes to commit a
610 + * @j_average_commit_time:
612 + * The average amount of time in nanoseconds it takes to commit a
613 * transaction to disk. [j_state_lock]
615 u64 j_average_commit_time;
618 - * minimum and maximum times that we should wait for
619 - * additional filesystem operations to get batched into a
620 - * synchronous handle in microseconds
622 + * @j_min_batch_time:
624 + * Minimum time that we should wait for additional filesystem operations
625 + * to get batched into a synchronous handle in microseconds.
627 u32 j_min_batch_time;
630 + * @j_max_batch_time:
632 + * Maximum time that we should wait for additional filesystem operations
633 + * to get batched into a synchronous handle in microseconds.
635 u32 j_max_batch_time;
637 - /* This function is called when a transaction is closed */
639 + * @j_commit_callback:
641 + * This function is called when a transaction is closed.
643 void (*j_commit_callback)(journal_t *,
651 + * @j_history_lock: Protect the transactions statistics history.
653 spinlock_t j_history_lock;
656 + * @j_proc_entry: procfs entry for the jbd statistics directory.
658 struct proc_dir_entry *j_proc_entry;
661 + * @j_stats: Overall statistics.
663 struct transaction_stats_s j_stats;
665 - /* Failed journal commit ID */
667 + * @j_failed_commit: Failed journal commit ID.
669 unsigned int j_failed_commit;
675 * An opaque pointer to fs-private information. ext3 puts its
676 - * superblock pointer here
677 + * superblock pointer here.
681 - /* Reference to checksum algorithm driver via cryptoapi */
683 + * @j_chksum_driver:
685 + * Reference to checksum algorithm driver via cryptoapi.
687 struct crypto_shash *j_chksum_driver;
689 - /* Precomputed journal UUID checksum for seeding other checksums */
693 + * Precomputed journal UUID checksum for seeding other checksums.
697 #ifdef CONFIG_DEBUG_LOCK_ALLOC
700 + * @j_trans_commit_map:
702 * Lockdep entity to track transaction commit dependencies. Handles
703 * hold this "lock" for read, when we wait for commit, we acquire the
704 * "lock" for writing. This matches the properties of jbd2 journalling