From 51b5d60facf791fc285183b96a6d9ff4d6901428 Mon Sep 17 00:00:00 2001 From: szaka Date: Sat, 12 Jul 2008 12:29:53 +0000 Subject: [PATCH] ntfs_bitmap_set_bits_in_run(): log errors --- libntfs-3g/bitmap.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/libntfs-3g/bitmap.c b/libntfs-3g/bitmap.c index 60cd4a89..32363f4d 100644 --- a/libntfs-3g/bitmap.c +++ b/libntfs-3g/bitmap.c @@ -121,6 +121,8 @@ static int ntfs_bitmap_set_bits_in_run(ntfs_attr *na, s64 start_bit, if (!na || start_bit < 0 || count < 0) { errno = EINVAL; + ntfs_log_perror("%s: Invalid argument (%p, %lld, %lld)", + __FUNCTION__, na, (long long)start_bit, (long long)count); return -1; } @@ -172,7 +174,7 @@ static int ntfs_bitmap_set_bits_in_run(ntfs_attr *na, s64 start_bit, lastbyte_pos = ((count + 7) >> 3) + firstbyte; if (!lastbyte_pos) { // FIXME: Eeek! BUG! - ntfs_log_trace("Eeek! lastbyte is zero. Leaving " + ntfs_log_error("Lastbyte is zero. Leaving " "inconsistent metadata.\n"); err = EIO; goto free_err_out; @@ -186,9 +188,9 @@ static int ntfs_bitmap_set_bits_in_run(ntfs_attr *na, s64 start_bit, 3, 1, lastbyte_buf); if (br != 1) { // FIXME: Eeek! We need rollback! (AIA) - ntfs_log_trace("Eeek! Read of last byte " - "failed. Leaving " - "inconsistent metadata.\n"); + ntfs_log_perror("Reading of last byte " + "failed (%lld). Leaving inconsistent " + "metadata", (long long)br); err = EIO; goto free_err_out; } @@ -211,8 +213,9 @@ static int ntfs_bitmap_set_bits_in_run(ntfs_attr *na, s64 start_bit, br = ntfs_attr_pwrite(na, tmp, bufsize, buf); if (br != bufsize) { // FIXME: Eeek! We need rollback! (AIA) - ntfs_log_trace("Eeek! Failed to write buffer to bitmap. " - "Leaving inconsistent metadata.\n"); + ntfs_log_perror("Failed to write buffer to bitmap " + "(%lld != %lld). Leaving inconsistent metadata", + (long long)br, (long long)bufsize); err = EIO; goto free_err_out; } @@ -234,9 +237,9 @@ static int ntfs_bitmap_set_bits_in_run(ntfs_attr *na, s64 start_bit, if (lastbyte && count != 0) { // FIXME: Eeek! BUG! - ntfs_log_trace("Eeek! Last buffer but count is not zero (= " - "%lli). Leaving inconsistent metadata.\n", - (long long)count); + ntfs_log_error("Last buffer but count is not zero " + "(%lld). Leaving inconsistent metadata.\n", + (long long)count); err = EIO; goto free_err_out; }