ext3: Don't update superblock write time when filesystem is read-only
[safe/jmp/linux-2.6] / fs / nilfs2 / mdt.c
index a5cd801..f632611 100644 (file)
@@ -103,15 +103,12 @@ static int nilfs_mdt_create_block(struct inode *inode, unsigned long block,
                goto failed_unlock;
 
        err = -EEXIST;
-       if (buffer_uptodate(bh) || buffer_mapped(bh))
+       if (buffer_uptodate(bh))
                goto failed_bh;
-#if 0
-       /* The uptodate flag is not protected by the page lock, but
-          the mapped flag is.  Thus, we don't have to wait the buffer. */
+
        wait_on_buffer(bh);
        if (buffer_uptodate(bh))
                goto failed_bh;
-#endif
 
        bh->b_bdev = nilfs->ns_bdev;
        err = nilfs_mdt_insert_new_block(inode, block, bh, init_block);
@@ -139,7 +136,7 @@ nilfs_mdt_submit_block(struct inode *inode, unsigned long blkoff,
                       int mode, struct buffer_head **out_bh)
 {
        struct buffer_head *bh;
-       unsigned long blknum = 0;
+       __u64 blknum = 0;
        int ret = -ENOMEM;
 
        bh = nilfs_grab_buffer(inode, inode->i_mapping, blkoff, 0);
@@ -162,17 +159,15 @@ nilfs_mdt_submit_block(struct inode *inode, unsigned long blkoff,
                unlock_buffer(bh);
                goto out;
        }
-       if (!buffer_mapped(bh)) { /* unused buffer */
-               ret = nilfs_bmap_lookup(NILFS_I(inode)->i_bmap, blkoff,
-                                       &blknum);
-               if (unlikely(ret)) {
-                       unlock_buffer(bh);
-                       goto failed_bh;
-               }
-               bh->b_bdev = NILFS_MDT(inode)->mi_nilfs->ns_bdev;
-               bh->b_blocknr = blknum;
-               set_buffer_mapped(bh);
+
+       ret = nilfs_bmap_lookup(NILFS_I(inode)->i_bmap, blkoff, &blknum);
+       if (unlikely(ret)) {
+               unlock_buffer(bh);
+               goto failed_bh;
        }
+       bh->b_bdev = NILFS_MDT(inode)->mi_nilfs->ns_bdev;
+       bh->b_blocknr = (sector_t)blknum;
+       set_buffer_mapped(bh);
 
        bh->b_end_io = end_buffer_read_sync;
        get_bh(bh);
@@ -432,13 +427,13 @@ nilfs_mdt_write_page(struct page *page, struct writeback_control *wbc)
 }
 
 
-static struct address_space_operations def_mdt_aops = {
+static const struct address_space_operations def_mdt_aops = {
        .writepage              = nilfs_mdt_write_page,
        .sync_page              = block_sync_page,
 };
 
-static struct inode_operations def_mdt_iops;
-static struct file_operations def_mdt_fops;
+static const struct inode_operations def_mdt_iops;
+static const struct file_operations def_mdt_fops;
 
 /*
  * NILFS2 uses pseudo inodes for meta data files such as DAT, cpfile, sufile,
@@ -518,9 +513,10 @@ nilfs_mdt_new_common(struct the_nilfs *nilfs, struct super_block *sb,
 }
 
 struct inode *nilfs_mdt_new(struct the_nilfs *nilfs, struct super_block *sb,
-                           ino_t ino, gfp_t gfp_mask)
+                           ino_t ino)
 {
-       struct inode *inode = nilfs_mdt_new_common(nilfs, sb, ino, gfp_mask);
+       struct inode *inode = nilfs_mdt_new_common(nilfs, sb, ino,
+                                                  NILFS_MDT_GFP);
 
        if (!inode)
                return NULL;