summaryrefslogtreecommitdiffstats
path: root/fs/sysv/truncate.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1999-06-22 23:05:57 +0000
committerRalf Baechle <ralf@linux-mips.org>1999-06-22 23:05:57 +0000
commit51d3b7814cdccef9188240fe0cbd8d97ff2c7470 (patch)
tree5cbb01d0323d4f63ade66bdf48ba4a91aaa6df16 /fs/sysv/truncate.c
parent52273a23c9a84336b93a35e4847fc88fac7eb0e4 (diff)
Merge with Linux 2.3.7.
WARNING: 2.3.7 is known to eat filesystems for breakfast and little children for lunch, so if you try this on your machine make backups first ...
Diffstat (limited to 'fs/sysv/truncate.c')
-rw-r--r--fs/sysv/truncate.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/fs/sysv/truncate.c b/fs/sysv/truncate.c
index c318648a9..a8c0e0745 100644
--- a/fs/sysv/truncate.c
+++ b/fs/sysv/truncate.c
@@ -35,6 +35,9 @@
* general case (size = XXX). I hope.
*/
+#define DATA_BUFFER_USED(bh) \
+ ((bh->b_count > 1) || buffer_locked(bh))
+
/* We throw away any data beyond inode->i_size. */
static int trunc_direct(struct inode * inode)
@@ -58,7 +61,7 @@ repeat:
brelse(bh);
goto repeat;
}
- if ((bh && bh->b_count != 1) || (block != *p)) {
+ if ((bh && DATA_BUFFER_USED(bh)) || (block != *p)) {
retry = 1;
brelse(bh);
continue;
@@ -115,7 +118,7 @@ repeat:
brelse(bh);
goto repeat;
}
- if ((bh && bh->b_count != 1) || (tmp != *ind)) {
+ if ((bh && DATA_BUFFER_USED(bh)) || (tmp != *ind)) {
retry = 1;
brelse(bh);
continue;
@@ -128,7 +131,7 @@ repeat:
for (i = 0; i < sb->sv_ind_per_block; i++)
if (((sysv_zone_t *) indbh->b_data)[i])
goto done;
- if ((indbh->b_count != 1) || (indtmp != *p)) {
+ if (DATA_BUFFER_USED(indbh) || (indtmp != *p)) {
brelse(indbh);
return 1;
}
@@ -185,7 +188,7 @@ static int trunc_dindirect(struct inode * inode, unsigned long offset, sysv_zone
for (i = 0; i < sb->sv_ind_per_block; i++)
if (((sysv_zone_t *) indbh->b_data)[i])
goto done;
- if ((indbh->b_count != 1) || (indtmp != *p)) {
+ if (DATA_BUFFER_USED(indbh) || (indtmp != *p)) {
brelse(indbh);
return 1;
}
@@ -242,7 +245,7 @@ static int trunc_tindirect(struct inode * inode, unsigned long offset, sysv_zone
for (i = 0; i < sb->sv_ind_per_block; i++)
if (((sysv_zone_t *) indbh->b_data)[i])
goto done;
- if ((indbh->b_count != 1) || (indtmp != *p)) {
+ if (DATA_BUFFER_USED(indbh) || (indtmp != *p)) {
brelse(indbh);
return 1;
}