summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/jbd2.h34
1 files changed, 22 insertions, 12 deletions
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 64392baf5f4b..7e785aa6d35d 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -429,33 +429,43 @@ struct jbd2_inode {
unsigned long i_flags;
/**
- * @i_dirty_start:
+ * @i_dirty_start_page:
+ *
+ * Dirty range start in PAGE_SIZE units.
+ *
+ * The dirty range is empty if @i_dirty_start_page is greater than or
+ * equal to @i_dirty_end_page.
*
- * Offset in bytes where the dirty range for this inode starts.
* [j_list_lock]
*/
- loff_t i_dirty_start;
+ pgoff_t i_dirty_start_page;
/**
- * @i_dirty_end:
+ * @i_dirty_end_page:
+ *
+ * Dirty range end in PAGE_SIZE units (exclusive).
*
- * Inclusive offset in bytes where the dirty range for this inode
- * ends. [j_list_lock]
+ * [j_list_lock]
*/
- loff_t i_dirty_end;
+ pgoff_t i_dirty_end_page;
};
+/*
+ * Lockless readers treat start_page >= end_page as an empty range.
+ * Writers publish a new non-empty range by storing i_dirty_end_page before
+ * i_dirty_start_page.
+ */
static inline bool jbd2_jinode_get_dirty_range(const struct jbd2_inode *jinode,
loff_t *start, loff_t *end)
{
- loff_t start_byte = jinode->i_dirty_start;
- loff_t end_byte = jinode->i_dirty_end;
+ pgoff_t start_page = READ_ONCE(jinode->i_dirty_start_page);
+ pgoff_t end_page = READ_ONCE(jinode->i_dirty_end_page);
- if (!end_byte)
+ if (start_page >= end_page)
return false;
- *start = start_byte;
- *end = end_byte;
+ *start = (loff_t)start_page << PAGE_SHIFT;
+ *end = ((loff_t)end_page << PAGE_SHIFT) - 1;
return true;
}