]> git.hungrycats.org Git - linux/commitdiff
[PATCH] Remove SWP_BLOCKDEV
authorAlexander Viro <viro@math.psu.edu>
Tue, 5 Mar 2002 06:56:52 +0000 (22:56 -0800)
committerLinus Torvalds <torvalds@penguin.transmeta.com>
Tue, 5 Mar 2002 06:56:52 +0000 (22:56 -0800)
Below is a followup to bd_claim patch - it is the last one
from the current series.  Removes SWP_BLOCKDEV flag - it isn't needed
anymore.

include/linux/swap.h
mm/swapfile.c

index 45a65b97460fe86ff1070e5150d7ac820801fbfc..824a928d5c3786c755a0f88da9b5a98c3d73ccd3 100644 (file)
@@ -64,7 +64,6 @@ typedef struct {
 enum {
        SWP_USED        = (1 << 0),     /* is slot in swap_info[] used? */
        SWP_WRITEOK     = (1 << 1),     /* ok to write to this swap?    */
-       SWP_BLOCKDEV    = (1 << 2),     /* is this swap a block device? */
        SWP_ACTIVE      = (SWP_USED | SWP_WRITEOK),
 };
 
index d6fab4e64cf6b95b66284c583c8335552303a370..bf28ff5d9bd394b7c656e057e2739ff1c4fdffe0 100644 (file)
@@ -809,27 +809,30 @@ int get_swaparea_info(char *buf)
 
        len = sprintf(buf, "Filename\t\t\t\tType\t\tSize\tUsed\tPriority\n");
        for (i = 0 ; i < nr_swapfiles ; i++, ptr++) {
-               if ((ptr->flags & SWP_USED) && ptr->swap_map) {
-                       char * path = d_path(ptr->swap_file->f_dentry,
-                                               ptr->swap_file->f_vfsmnt,
-                                               page, PAGE_SIZE);
-                       int j, usedswap = 0;
-                       for (j = 0; j < ptr->max; ++j)
-                               switch (ptr->swap_map[j]) {
-                                       case SWAP_MAP_BAD:
-                                       case 0:
-                                               continue;
-                                       default:
-                                               usedswap++;
-                               }
-                       len += sprintf(buf + len, "%-39s %s\t%d\t%d\t%d\n",
-                                      path,
-                                      (ptr->flags & SWP_BLOCKDEV) ?
-                                               "partition" : "file\t",
-                                      ptr->pages << (PAGE_SHIFT - 10),
-                                      usedswap << (PAGE_SHIFT - 10),
-                                      ptr->prio);
-               }
+               int j, usedswap;
+               struct file *file;
+               char *path;
+
+               if (!(ptr->flags & SWP_USED) || !ptr->swap_map)
+                       continue;
+
+               file = ptr->swap_file;
+               path = d_path(file->f_dentry, file->f_vfsmnt, page, PAGE_SIZE);
+               for (j = 0,usedswap = 0; j < ptr->max; ++j)
+                       switch (ptr->swap_map[j]) {
+                               case SWAP_MAP_BAD:
+                               case 0:
+                                       continue;
+                               default:
+                                       usedswap++;
+                       }
+               len += sprintf(buf + len, "%-39s %s\t%d\t%d\t%d\n",
+                              path,
+                              S_ISBLK(file->f_dentry->d_inode->i_mode) ?
+                                       "partition" : "file\t",
+                              ptr->pages << (PAGE_SHIFT - 10),
+                              usedswap << (PAGE_SHIFT - 10),
+                              ptr->prio);
        }
        free_page((unsigned long) page);
        return len;
@@ -1037,8 +1040,6 @@ asmlinkage long sys_swapon(const char * specialfile, int swap_flags)
        swap_device_lock(p);
        p->max = maxpages;
        p->flags = SWP_ACTIVE;
-       if (S_ISBLK(swap_file->f_dentry->d_inode->i_mode))
-               p->flags |= SWP_BLOCKDEV;
        p->pages = nr_good_pages;
        nr_swap_pages += nr_good_pages;
        total_swap_pages += nr_good_pages;