Skip to contentSkip to conversation

ext4-use-generic-discard-reservations-call

RFC PATCH In review Theodore Ts'o 2 participants 2 messages Aug 14, 2008 ext4 file system

lore
Share & tools
lore

Theodore Ts'o

author maintainer
#0 lore raw

RFC PATCH 1/1 ext4-use-generic-discard-reservations-call

Does this patch make sense? I noticed that in the extents version of the truncate, we call the mballoc-specific version of ext4_discard_reservation(), instead of ext4_discard_reservation() directly. As a result, if the filesystem is mounted -o nomballoc, we won't throw away the reservation window when truncating or unlinking an
extents-based file. We are using ext4_discard_reservation() in
non-extent truncate code, which is what made me notice this.

- Ted

ext4: Use ext4_discard_reservations instead of mballoc-specific call

In ext4_ext_truncate(), we should use the more generic ext4_discard_reservations() call so we do the right thing when the filesystem is mounted with the nomballoc option.

fs/ext4/extents.c +1 -1
index 3c82ab1..30a59b8 100644
@@ -2963,7 +2963,7 @@ void ext4_ext_truncate(struct inode *inode)
 	down_write(&EXT4_I(inode)->i_data_sem);
 	ext4_ext_invalidate_cache(inode);
 
-	ext4_mb_discard_inode_preallocations(inode);
+	ext4_discard_reservation(inode);
 
 	/*
 	 * TODO: optimization is possible here.
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · 在 2008-08-14四的 15:54 -0400,Theodore Ts'o写道:

Does this patch make sense? I noticed that in the extents version of the truncate, we call the mballoc-specific version of ext4_discard_reservation(), instead of ext4_discard_reservation() directly. As a result, if the filesystem is mounted -o nomballoc, we won't throw away the reservation window when truncating or unlinking an
extents-based file. We are using ext4_discard_reservation() in
non-extent truncate code, which is what made me notice this.

- Ted

Agreed.

Quoted 21 lines

ext4: Use ext4_discard_reservations instead of mballoc-specific call

In ext4_ext_truncate(), we should use the more generic ext4_discard_reservations() call so we do the right thing when the filesystem is mounted with the nomballoc option.

fs/ext4/extents.c +1 -2
index 3c82ab1..30a59b8 100644
@@ -2963,7 +2963,7 @@ void ext4_ext_truncate(struct inode *inode)
 	down_write(&EXT4_I(inode)->i_data_sem);
 	ext4_ext_invalidate_cache(inode);
 
-	ext4_mb_discard_inode_preallocations(inode);
+	ext4_discard_reservation(inode);
 
 	/*
 	 * TODO: optimization is possible here.
--
Quoted 3 lines

To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html