@@ -557,6 +557,16 @@ struct ext4_new_group_data {
* if EXT4_GET_BLOCKS_CREATE is not set, return REMAP flags.
*/
#define EXT4_GET_BLOCKS_MOVE_ON_WRITE 0x0100
+/*
+ * snapshot_map_blocks() flags passed to ext4_map_blocks() for mapping
+ * blocks to snapshot.
+ */
+ /* handle COW race conditions */
+#define EXT4_GET_BLOCKS_COW 0x200
+ /* allocate only indirect blocks */
+#define EXT4_GET_BLOCKS_MOVE 0x400
+ /* bypass journal and sync allocated indirect blocks directly to disk */
+#define EXT4_GET_BLOCKS_SYNC 0x800
/*
* Flags used by ext4_free_blocks
@@ -173,6 +173,9 @@ int __ext4_handle_dirty_super(const char *where, unsigned int line,
#define ext4_handle_dirty_super(handle, sb) \
__ext4_handle_dirty_super(__func__, __LINE__, (handle), (sb))
+#define trace_cow_add(handle, name, num)
+#define trace_cow_inc(handle, name)
+
handle_t *ext4_journal_start_sb(struct super_block *sb, int nblocks);
int __ext4_journal_stop(const char *where, unsigned int line, handle_t *handle);
@@ -1600,8 +1600,8 @@ struct buffer_head *ext4_getblk(handle_t *handle, struct inode *inode,
map.m_lblk = block;
map.m_len = 1;
- err = ext4_map_blocks(handle, inode, &map,
- create ? EXT4_GET_BLOCKS_CREATE : 0);
+ /* passing SNAPMAP flags on create argument */
+ err = ext4_map_blocks(handle, inode, &map, create);
if (err < 0)
*errp = err;