From 2b38960cbf6a500bb8d2d8afd7e0cd546c72efe6 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Sun, 11 Apr 2004 22:57:51 -0700 Subject: [PATCH] JBD: ordered-data commit cleanup For data=ordered, kjournald at commit time has to write out and wait upon a long list of buffers. It does this in a rather awkward way with a single list. it causes complexity and long lock hold times, and makes the addition of rescheduling points quite hard So what we do instead (based on Chris Mason's suggestion) is to add a new buffer list (t_locked_list) to the journal. It contains buffers which have been placed under I/O. So as we walk the t_sync_datalist list we move buffers over to t_locked_list as they are written out. When t_sync_datalist is empty we may then walk t_locked_list waiting for the I/O to complete. As a side-effect this means that we can remove the nasty synchronous wait in journal_dirty_data which is there to avoid the kjournald livelock which would otherwise occur when someone is continuously dirtying a buffer. --- include/linux/jbd.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'include/linux/jbd.h') diff --git a/include/linux/jbd.h b/include/linux/jbd.h index eb154bafe1e4..241387b13764 100644 --- a/include/linux/jbd.h +++ b/include/linux/jbd.h @@ -486,6 +486,12 @@ struct transaction_s */ struct journal_head *t_reserved_list; + /* + * Doubly-linked circular list of all buffers under writeout during + * commit [j_list_lock] + */ + struct journal_head *t_locked_list; + /* * Doubly-linked circular list of all metadata buffers owned by this * transaction [j_list_lock] @@ -1079,7 +1085,8 @@ static inline int jbd_space_needed(journal_t *journal) #define BJ_Shadow 5 /* Buffer contents being shadowed to the log */ #define BJ_LogCtl 6 /* Buffer contains log descriptors */ #define BJ_Reserved 7 /* Buffer is reserved for access by journal */ -#define BJ_Types 8 +#define BJ_Locked 8 /* Locked for I/O during commit */ +#define BJ_Types 9 extern int jbd_blocks_per_page(struct inode *inode); -- cgit v1.2.3