Bugs in page_io.c, swapfile.c

Chris Evans (chris@ferret.lmh.ox.ac.uk)
Mon, 11 Aug 1997 11:02:06 +0100 (BST)


Hi,

It seems that in 2.1.48 it is erroneously assumed that the swap_file field
of a swap structure is NULL if the bit of swap in question is a partition.
Since the inode pointer became a dentry pointer, this is no longer the
case....

The following patch fixes swap entities as reported by /proc/swaps. There
are pother places in page_io.c and swapfile.c that will need changing
though. Perhaps it would be a good idea to define a couple more flags in
the flags bitfield, say SWP_ISFILE and SWP_ISPART?

Chris

--- swapfile-old.c Sun Aug 10 23:28:53 1997
+++ swapfile.c Sun Aug 10 23:31:11 1997
@@ -423,10 +423,11 @@
if (ptr->flags & SWP_USED) {
len += sprintf(buf + len, "%-31s ", ptr->swap_file->d_name.name);

- if (ptr->swap_file)
- len += sprintf(buf + len, "file\t\t");
+ if (ptr->swap_device)
+ len += sprintf(buf + len, "partition\t");
else
- len += sprintf(buf + len, "partition\t");
+ len += sprintf(buf + len, "file\t\t");
+
usedswap = 0;
for (j = 0; j < ptr->max; ++j)
switch (ptr->swap_map[j]) {