diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2023-03-13 12:40:40 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2024-10-18 17:35:31 -0400 |
commit | 64f30e80d653c4d5aa0a7f1390789348af0cf8f2 (patch) | |
tree | 22ba01747bdb2b7b15eebc2a42d53d2c9efb402e /drivers/platform/surface/aggregator/ssh_parser.c | |
parent | db57044217d609d1d60854e958e28f5d3684d5bc (diff) | |
download | linux-64f30e80d653c4d5aa0a7f1390789348af0cf8f2.tar.gz linux-64f30e80d653c4d5aa0a7f1390789348af0cf8f2.tar.bz2 linux-64f30e80d653c4d5aa0a7f1390789348af0cf8f2.zip |
clean ufs_trunc_direct() up a bit...
For short files (== no indirect blocks needed) UFS allows the last
block to be a partial one. That creates some complications for
truncation down to "short file" lengths. ufs_trunc_direct() is
called when we'd already made sure that new EOF is not in a hole;
nothing needs to be done if we are extending the file and in
case we are shrinking the file it needs to
* shrink or free the old final block.
* free all full direct blocks between the new and old EOF.
* possibly shrink the new final block.
The logics is needlessly complicated by trying to keep all cases
handled by the same sequence of operations.
if not shrinking
nothing to do
else if number of full blocks unchanged
free the tail of possibly partial last block
else
free the tail of (currently full) new last block
free all present (full) blocks in between
free the (possibly partial) old last block
is easier to follow than the result of trying to unify these
cases.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'drivers/platform/surface/aggregator/ssh_parser.c')
0 files changed, 0 insertions, 0 deletions