Skip to contentSkip to conversation

down i_data_sem only for read when walking tree for fiemap

PATCH Applied Eric Sandeen 2 participants 2 messages May 15, 2009 – May 18, 2009 ext4 file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 down i_data_sem only for read when walking tree for fiemap

Not sure why I put this in as down_write originally; all we are doing is walking the tree, nothing will change under us and concurrent reads should be no problem.

---

fs/ext4/extents.c +2 -2
Index: linux-2.6/fs/ext4/extents.c
===================================================================
@@ -3309,10 +3309,10 @@ int ext4_fiemap(struct inode *inode, str
 		 * Walk the extent tree gathering extent information.
 		 * ext4_ext_fiemap_cb will push extents back to user.
 		 */
-		down_write(&EXT4_I(inode)->i_data_sem);
+		down_read(&EXT4_I(inode)->i_data_sem);
 		error = ext4_ext_walk_space(inode, start_blk, len_blks,
 					  ext4_ext_fiemap_cb, fieinfo);
-		up_write(&EXT4_I(inode)->i_data_sem);
+		up_read(&EXT4_I(inode)->i_data_sem);
 	}
 
 	return error;
maintainer Applied
#1 lore raw
Quoted 3 lines · Eric Sandeen

Not sure why I put this in as down_write originally; all we are doing is walking the tree, nothing will change under us and concurrent reads should be no problem.

Applied, thanks.

- Ted