diff options
Diffstat (limited to 'sys-fs/reiserfsprogs/files/blk_size.patch')
-rw-r--r-- | sys-fs/reiserfsprogs/files/blk_size.patch | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/sys-fs/reiserfsprogs/files/blk_size.patch b/sys-fs/reiserfsprogs/files/blk_size.patch new file mode 100644 index 000000000000..e989907b7c30 --- /dev/null +++ b/sys-fs/reiserfsprogs/files/blk_size.patch @@ -0,0 +1,54 @@ +===== lib/misc.c 1.39 vs edited ===== +--- 1.39/reiserfsprogs/lib/misc.c Wed Jul 30 12:05:41 2003 ++++ edited/lib/misc.c Tue Sep 23 17:37:48 2003 +@@ -407,8 +407,9 @@ + fflush (fp); + } + +- +- ++/* To not have problem with last sectors on the block device when switching ++ to smaller one. */ ++#define MAX_BS (64 * 1024) + + /* calculates number of blocks in a file. Returns 0 for "sparse" + regular files and files other than regular files and block devices */ +@@ -429,10 +430,12 @@ + #ifdef BLKGETSIZE64 + { + if (ioctl (fd, BLKGETSIZE64, &size) >= 0) { +- size = (size / 4096) * 4096 / blocksize; ++ size = (size / MAX_BS) * MAX_BS / blocksize; + sz = size; + if ((__u64)sz != size) + die ("count_blocks: block device too large"); ++ ++ close(fd); + return sz; + } + } +@@ -443,7 +446,9 @@ + { + if (ioctl (fd, BLKGETSIZE, &sz) >= 0) { + size = sz; +- return (size * 512 / 4096) * 4096 / blocksize; ++ ++ close(fd); ++ return (size * 512 / MAX_BS) * MAX_BS / blocksize; + } + } + #endif +@@ -459,11 +464,11 @@ + else + high = mid; + } ++ + valid_offset (fd, 0); + + close (fd); +- +- return (low + 1) * 4096 / 4096 / blocksize ; ++ return (low + 1) * MAX_BS / MAX_BS / blocksize; + } + + |