[PATCH 6/6] udf: use extent cache when moving to last extent

From: Namjae Jeon
Date: Tue Oct 09 2012 - 11:10:21 EST


From: Namjae Jeon <namjae.jeon@xxxxxxxxxxx>

Use extent cache when moving to last extent.

Signed-off-by: Namjae Jeon <namjae.jeon@xxxxxxxxxxx>
Signed-off-by: Ashish Sangwan <a.sangwan@xxxxxxxxxxx>
---
fs/udf/truncate.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/udf/truncate.c b/fs/udf/truncate.c
index 8a9657d..95fd9bf 100644
--- a/fs/udf/truncate.c
+++ b/fs/udf/truncate.c
@@ -88,6 +88,8 @@ void udf_truncate_tail_extent(struct inode *inode)
adsize = sizeof(struct long_ad);
else
BUG();
+ if (!udf_read_extent_cache(inode, inode->i_size, &lbcount, &epos))
+ epos.block = iinfo->i_location;

/* Find the last extent in the file */
while ((netype = udf_next_aext(inode, &epos, &eloc, &elen, 1)) != -1) {
@@ -139,8 +141,8 @@ void udf_discard_prealloc(struct inode *inode)
adsize = sizeof(struct long_ad);
else
adsize = 0;
-
- epos.block = iinfo->i_location;
+ if (!udf_read_extent_cache(inode, inode->i_size, &lbcount, &epos))
+ epos.block = iinfo->i_location;

/* Find the last extent in the file */
while ((netype = udf_next_aext(inode, &epos, &eloc, &elen, 1)) != -1) {
--
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/