]> err.no Git - linux-2.6/blobdiff - fs/hugetlbfs/inode.c
Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc
[linux-2.6] / fs / hugetlbfs / inode.c
index 12aca8ed605f1616b1f1deda3867464780fcf66d..6846785fe9043b48279bc04c44328d0264e48197 100644 (file)
@@ -364,7 +364,6 @@ static void truncate_hugepages(struct inode *inode, loff_t lstart)
                        ++next;
                        truncate_huge_page(page);
                        unlock_page(page);
-                       hugetlb_put_quota(mapping);
                        freed++;
                }
                huge_pagevec_release(&pvec);
@@ -735,6 +734,7 @@ static const struct super_operations hugetlbfs_ops = {
        .delete_inode   = hugetlbfs_delete_inode,
        .drop_inode     = hugetlbfs_drop_inode,
        .put_super      = hugetlbfs_put_super,
+       .show_options   = generic_show_options,
 };
 
 static int
@@ -769,7 +769,7 @@ hugetlbfs_parse_options(char *options, struct hugetlbfs_config *pconfig)
                case Opt_mode:
                        if (match_octal(&args[0], &option))
                                goto bad_val;
-                       pconfig->mode = option & 0777U;
+                       pconfig->mode = option & 01777U;
                        break;
 
                case Opt_size: {
@@ -818,6 +818,8 @@ hugetlbfs_fill_super(struct super_block *sb, void *data, int silent)
        struct hugetlbfs_config config;
        struct hugetlbfs_sb_info *sbinfo;
 
+       save_mount_options(sb, data);
+
        config.nr_blocks = -1; /* No limit on size by default */
        config.nr_inodes = -1; /* No limit on number of inodes by default */
        config.uid = current->fsuid;
@@ -859,15 +861,15 @@ out_free:
        return -ENOMEM;
 }
 
-int hugetlb_get_quota(struct address_space *mapping)
+int hugetlb_get_quota(struct address_space *mapping, long delta)
 {
        int ret = 0;
        struct hugetlbfs_sb_info *sbinfo = HUGETLBFS_SB(mapping->host->i_sb);
 
        if (sbinfo->free_blocks > -1) {
                spin_lock(&sbinfo->stat_lock);
-               if (sbinfo->free_blocks > 0)
-                       sbinfo->free_blocks--;
+               if (sbinfo->free_blocks - delta >= 0)
+                       sbinfo->free_blocks -= delta;
                else
                        ret = -ENOMEM;
                spin_unlock(&sbinfo->stat_lock);
@@ -876,13 +878,13 @@ int hugetlb_get_quota(struct address_space *mapping)
        return ret;
 }
 
-void hugetlb_put_quota(struct address_space *mapping)
+void hugetlb_put_quota(struct address_space *mapping, long delta)
 {
        struct hugetlbfs_sb_info *sbinfo = HUGETLBFS_SB(mapping->host->i_sb);
 
        if (sbinfo->free_blocks > -1) {
                spin_lock(&sbinfo->stat_lock);
-               sbinfo->free_blocks++;
+               sbinfo->free_blocks += delta;
                spin_unlock(&sbinfo->stat_lock);
        }
 }
@@ -952,7 +954,7 @@ struct file *hugetlb_file_setup(const char *name, size_t size)
                        FMODE_WRITE | FMODE_READ,
                        &hugetlbfs_file_operations);
        if (!file)
-               goto out_inode;
+               goto out_dentry; /* inode is already attached */
 
        return file;