aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAnton Altaparmakov <aia21@cantab.net>2005-09-08 15:23:06 -0400
committerAnton Altaparmakov <aia21@cantab.net>2005-09-08 15:23:06 -0400
commit3ffc5a443824fcf426d8d35dc632acc4dd9fb6d1 (patch)
tree7d8108fed6ed170766ffc0bd95945c69498e740a /fs
parentf94ad38e68e1623660fdbb063d0c580ba6661c29 (diff)
NTFS: Change ntfs_rl_truncate_nolock() to throw away the runlist if the new
length is zero. Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
Diffstat (limited to 'fs')
-rw-r--r--fs/ntfs/ChangeLog2
-rw-r--r--fs/ntfs/runlist.c14
2 files changed, 15 insertions, 1 deletions
diff --git a/fs/ntfs/ChangeLog b/fs/ntfs/ChangeLog
index 45f806fc45f9..79d9899b3b01 100644
--- a/fs/ntfs/ChangeLog
+++ b/fs/ntfs/ChangeLog
@@ -51,6 +51,8 @@ ToDo/Notes:
51 - Report unrepresentable inodes during ntfs_readdir() as KERN_WARNING 51 - Report unrepresentable inodes during ntfs_readdir() as KERN_WARNING
52 messages and include the inode number. Thanks to Yura Pakhuchiy for 52 messages and include the inode number. Thanks to Yura Pakhuchiy for
53 pointing this out. 53 pointing this out.
54 - Change ntfs_rl_truncate_nolock() to throw away the runlist if the new
55 length is zero.
54 56
552.1.23 - Implement extension of resident files and make writing safe as well as 572.1.23 - Implement extension of resident files and make writing safe as well as
56 many bug fixes, cleanups, and enhancements... 58 many bug fixes, cleanups, and enhancements...
diff --git a/fs/ntfs/runlist.c b/fs/ntfs/runlist.c
index e4c4716939de..539fa2b7f361 100644
--- a/fs/ntfs/runlist.c
+++ b/fs/ntfs/runlist.c
@@ -1455,6 +1455,7 @@ err_out:
1455 1455
1456/** 1456/**
1457 * ntfs_rl_truncate_nolock - truncate a runlist starting at a specified vcn 1457 * ntfs_rl_truncate_nolock - truncate a runlist starting at a specified vcn
1458 * @vol: ntfs volume (needed for error output)
1458 * @runlist: runlist to truncate 1459 * @runlist: runlist to truncate
1459 * @new_length: the new length of the runlist in VCNs 1460 * @new_length: the new length of the runlist in VCNs
1460 * 1461 *
@@ -1462,12 +1463,16 @@ err_out:
1462 * holding the runlist elements to a length of @new_length VCNs. 1463 * holding the runlist elements to a length of @new_length VCNs.
1463 * 1464 *
1464 * If @new_length lies within the runlist, the runlist elements with VCNs of 1465 * If @new_length lies within the runlist, the runlist elements with VCNs of
1465 * @new_length and above are discarded. 1466 * @new_length and above are discarded. As a special case if @new_length is
1467 * zero, the runlist is discarded and set to NULL.
1466 * 1468 *
1467 * If @new_length lies beyond the runlist, a sparse runlist element is added to 1469 * If @new_length lies beyond the runlist, a sparse runlist element is added to
1468 * the end of the runlist @runlist or if the last runlist element is a sparse 1470 * the end of the runlist @runlist or if the last runlist element is a sparse
1469 * one already, this is extended. 1471 * one already, this is extended.
1470 * 1472 *
1473 * Note, no checking is done for unmapped runlist elements. It is assumed that
1474 * the caller has mapped any elements that need to be mapped already.
1475 *
1471 * Return 0 on success and -errno on error. 1476 * Return 0 on success and -errno on error.
1472 * 1477 *
1473 * Locking: The caller must hold @runlist->lock for writing. 1478 * Locking: The caller must hold @runlist->lock for writing.
@@ -1482,6 +1487,13 @@ int ntfs_rl_truncate_nolock(const ntfs_volume *vol, runlist *const runlist,
1482 BUG_ON(!runlist); 1487 BUG_ON(!runlist);
1483 BUG_ON(new_length < 0); 1488 BUG_ON(new_length < 0);
1484 rl = runlist->rl; 1489 rl = runlist->rl;
1490 if (!new_length) {
1491 ntfs_debug("Freeing runlist.");
1492 runlist->rl = NULL;
1493 if (rl)
1494 ntfs_free(rl);
1495 return 0;
1496 }
1485 if (unlikely(!rl)) { 1497 if (unlikely(!rl)) {
1486 /* 1498 /*
1487 * Create a runlist consisting of a sparse runlist element of 1499 * Create a runlist consisting of a sparse runlist element of