[PATCH] mark address_space_operations const
[deliverable/linux.git] / drivers / block / rd.c
index f8a8b68dced013a6d88a5272934a59719b89e461..0378da04cfa23c0c38b967a0162aee3563119171 100644 (file)
@@ -74,7 +74,7 @@ static struct request_queue *rd_queue[CONFIG_BLK_DEV_RAM_COUNT];
  * architecture-specific setup routine (from the stored boot sector
  * information).
  */
-static int rd_size = CONFIG_BLK_DEV_RAM_SIZE;  /* Size of the RAM disks */
+int rd_size = CONFIG_BLK_DEV_RAM_SIZE;         /* Size of the RAM disks */
 /*
  * It would be very desirable to have a soft-blocksize (that in the case
  * of the ramdisk driver is also the hardblocksize ;) of PAGE_SIZE because
@@ -154,7 +154,7 @@ static int ramdisk_commit_write(struct file *file, struct page *page,
 
 /*
  * ->writepage to the the blockdev's mapping has to redirty the page so that the
- * VM doesn't go and steal it.  We return WRITEPAGE_ACTIVATE so that the VM
+ * VM doesn't go and steal it.  We return AOP_WRITEPAGE_ACTIVATE so that the VM
  * won't try to (pointlessly) write the page again for a while.
  *
  * Really, these pages should not be on the LRU at all.
@@ -165,7 +165,7 @@ static int ramdisk_writepage(struct page *page, struct writeback_control *wbc)
                make_page_uptodate(page);
        SetPageDirty(page);
        if (wbc->for_reclaim)
-               return WRITEPAGE_ACTIVATE;
+               return AOP_WRITEPAGE_ACTIVATE;
        unlock_page(page);
        return 0;
 }
@@ -186,11 +186,12 @@ static int ramdisk_writepages(struct address_space *mapping,
  */
 static int ramdisk_set_page_dirty(struct page *page)
 {
-       SetPageDirty(page);
+       if (!TestSetPageDirty(page))
+               return 1;
        return 0;
 }
 
-static struct address_space_operations ramdisk_aops = {
+static const struct address_space_operations ramdisk_aops = {
        .readpage       = ramdisk_readpage,
        .prepare_write  = ramdisk_prepare_write,
        .commit_write   = ramdisk_commit_write,
@@ -310,12 +311,12 @@ static int rd_ioctl(struct inode *inode, struct file *file,
         * cache
         */
        error = -EBUSY;
-       down(&bdev->bd_sem);
+       mutex_lock(&bdev->bd_mutex);
        if (bdev->bd_openers <= 2) {
                truncate_inode_pages(bdev->bd_inode->i_mapping, 0);
                error = 0;
        }
-       up(&bdev->bd_sem);
+       mutex_unlock(&bdev->bd_mutex);
        return error;
 }
 
@@ -348,7 +349,7 @@ static int rd_open(struct inode *inode, struct file *filp)
                struct block_device *bdev = inode->i_bdev;
                struct address_space *mapping;
                unsigned bsize;
-               int gfp_mask;
+               gfp_t gfp_mask;
 
                inode = igrab(bdev->bd_inode);
                rd_bdev[unit] = bdev;
This page took 0.038118 seconds and 5 git commands to generate.