aboutsummaryrefslogtreecommitdiffstats
path: root/fs/reiserfs/super.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/reiserfs/super.c')
-rw-r--r--fs/reiserfs/super.c35
1 files changed, 23 insertions, 12 deletions
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index 031577fb41a1..660aefca1fd2 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -866,8 +866,9 @@ static int reiserfs_parse_options (struct super_block * s, char * options, /* st
866 {"jdev", .arg_required = 'j', .values = NULL}, 866 {"jdev", .arg_required = 'j', .values = NULL},
867 {"nolargeio", .arg_required = 'w', .values = NULL}, 867 {"nolargeio", .arg_required = 'w', .values = NULL},
868 {"commit", .arg_required = 'c', .values = NULL}, 868 {"commit", .arg_required = 'c', .values = NULL},
869 {"usrquota",}, 869 {"usrquota", .setmask = 1<<REISERFS_QUOTA},
870 {"grpquota",}, 870 {"grpquota", .setmask = 1<<REISERFS_QUOTA},
871 {"noquota", .clrmask = 1<<REISERFS_QUOTA},
871 {"errors", .arg_required = 'e', .values = error_actions}, 872 {"errors", .arg_required = 'e', .values = error_actions},
872 {"usrjquota", .arg_required = 'u'|(1<<REISERFS_OPT_ALLOWEMPTY), .values = NULL}, 873 {"usrjquota", .arg_required = 'u'|(1<<REISERFS_OPT_ALLOWEMPTY), .values = NULL},
873 {"grpjquota", .arg_required = 'g'|(1<<REISERFS_OPT_ALLOWEMPTY), .values = NULL}, 874 {"grpjquota", .arg_required = 'g'|(1<<REISERFS_OPT_ALLOWEMPTY), .values = NULL},
@@ -964,6 +965,7 @@ static int reiserfs_parse_options (struct super_block * s, char * options, /* st
964 return 0; 965 return 0;
965 } 966 }
966 strcpy(REISERFS_SB(s)->s_qf_names[qtype], arg); 967 strcpy(REISERFS_SB(s)->s_qf_names[qtype], arg);
968 *mount_options |= 1<<REISERFS_QUOTA;
967 } 969 }
968 else { 970 else {
969 if (REISERFS_SB(s)->s_qf_names[qtype]) { 971 if (REISERFS_SB(s)->s_qf_names[qtype]) {
@@ -995,7 +997,13 @@ static int reiserfs_parse_options (struct super_block * s, char * options, /* st
995 reiserfs_warning(s, "reiserfs_parse_options: journalled quota format not specified."); 997 reiserfs_warning(s, "reiserfs_parse_options: journalled quota format not specified.");
996 return 0; 998 return 0;
997 } 999 }
1000 /* This checking is not precise wrt the quota type but for our purposes it is sufficient */
1001 if (!(*mount_options & (1<<REISERFS_QUOTA)) && sb_any_quota_enabled(s)) {
1002 reiserfs_warning(s, "reiserfs_parse_options: quota options must be present when quota is turned on.");
1003 return 0;
1004 }
998#endif 1005#endif
1006
999 return 1; 1007 return 1;
1000} 1008}
1001 1009
@@ -1105,6 +1113,7 @@ static int reiserfs_remount (struct super_block * s, int * mount_flags, char * a
1105 safe_mask |= 1 << REISERFS_ERROR_RO; 1113 safe_mask |= 1 << REISERFS_ERROR_RO;
1106 safe_mask |= 1 << REISERFS_ERROR_CONTINUE; 1114 safe_mask |= 1 << REISERFS_ERROR_CONTINUE;
1107 safe_mask |= 1 << REISERFS_ERROR_PANIC; 1115 safe_mask |= 1 << REISERFS_ERROR_PANIC;
1116 safe_mask |= 1 << REISERFS_QUOTA;
1108 1117
1109 /* Update the bitmask, taking care to keep 1118 /* Update the bitmask, taking care to keep
1110 * the bits we're not allowed to change here */ 1119 * the bits we're not allowed to change here */
@@ -1845,11 +1854,11 @@ static int reiserfs_dquot_initialize(struct inode *inode, int type)
1845 1854
1846 /* We may create quota structure so we need to reserve enough blocks */ 1855 /* We may create quota structure so we need to reserve enough blocks */
1847 reiserfs_write_lock(inode->i_sb); 1856 reiserfs_write_lock(inode->i_sb);
1848 ret = journal_begin(&th, inode->i_sb, 2*REISERFS_QUOTA_INIT_BLOCKS); 1857 ret = journal_begin(&th, inode->i_sb, 2*REISERFS_QUOTA_INIT_BLOCKS(inode->i_sb));
1849 if (ret) 1858 if (ret)
1850 goto out; 1859 goto out;
1851 ret = dquot_initialize(inode, type); 1860 ret = dquot_initialize(inode, type);
1852 err = journal_end(&th, inode->i_sb, 2*REISERFS_QUOTA_INIT_BLOCKS); 1861 err = journal_end(&th, inode->i_sb, 2*REISERFS_QUOTA_INIT_BLOCKS(inode->i_sb));
1853 if (!ret && err) 1862 if (!ret && err)
1854 ret = err; 1863 ret = err;
1855out: 1864out:
@@ -1864,11 +1873,11 @@ static int reiserfs_dquot_drop(struct inode *inode)
1864 1873
1865 /* We may delete quota structure so we need to reserve enough blocks */ 1874 /* We may delete quota structure so we need to reserve enough blocks */
1866 reiserfs_write_lock(inode->i_sb); 1875 reiserfs_write_lock(inode->i_sb);
1867 ret = journal_begin(&th, inode->i_sb, 2*REISERFS_QUOTA_INIT_BLOCKS); 1876 ret = journal_begin(&th, inode->i_sb, 2*REISERFS_QUOTA_DEL_BLOCKS(inode->i_sb));
1868 if (ret) 1877 if (ret)
1869 goto out; 1878 goto out;
1870 ret = dquot_drop(inode); 1879 ret = dquot_drop(inode);
1871 err = journal_end(&th, inode->i_sb, 2*REISERFS_QUOTA_INIT_BLOCKS); 1880 err = journal_end(&th, inode->i_sb, 2*REISERFS_QUOTA_DEL_BLOCKS(inode->i_sb));
1872 if (!ret && err) 1881 if (!ret && err)
1873 ret = err; 1882 ret = err;
1874out: 1883out:
@@ -1882,11 +1891,11 @@ static int reiserfs_write_dquot(struct dquot *dquot)
1882 int ret, err; 1891 int ret, err;
1883 1892
1884 reiserfs_write_lock(dquot->dq_sb); 1893 reiserfs_write_lock(dquot->dq_sb);
1885 ret = journal_begin(&th, dquot->dq_sb, REISERFS_QUOTA_TRANS_BLOCKS); 1894 ret = journal_begin(&th, dquot->dq_sb, REISERFS_QUOTA_TRANS_BLOCKS(dquot->dq_sb));
1886 if (ret) 1895 if (ret)
1887 goto out; 1896 goto out;
1888 ret = dquot_commit(dquot); 1897 ret = dquot_commit(dquot);
1889 err = journal_end(&th, dquot->dq_sb, REISERFS_QUOTA_TRANS_BLOCKS); 1898 err = journal_end(&th, dquot->dq_sb, REISERFS_QUOTA_TRANS_BLOCKS(dquot->dq_sb));
1890 if (!ret && err) 1899 if (!ret && err)
1891 ret = err; 1900 ret = err;
1892out: 1901out:
@@ -1900,11 +1909,11 @@ static int reiserfs_acquire_dquot(struct dquot *dquot)
1900 int ret, err; 1909 int ret, err;
1901 1910
1902 reiserfs_write_lock(dquot->dq_sb); 1911 reiserfs_write_lock(dquot->dq_sb);
1903 ret = journal_begin(&th, dquot->dq_sb, REISERFS_QUOTA_INIT_BLOCKS); 1912 ret = journal_begin(&th, dquot->dq_sb, REISERFS_QUOTA_INIT_BLOCKS(dquot->dq_sb));
1904 if (ret) 1913 if (ret)
1905 goto out; 1914 goto out;
1906 ret = dquot_acquire(dquot); 1915 ret = dquot_acquire(dquot);
1907 err = journal_end(&th, dquot->dq_sb, REISERFS_QUOTA_INIT_BLOCKS); 1916 err = journal_end(&th, dquot->dq_sb, REISERFS_QUOTA_INIT_BLOCKS(dquot->dq_sb));
1908 if (!ret && err) 1917 if (!ret && err)
1909 ret = err; 1918 ret = err;
1910out: 1919out:
@@ -1918,11 +1927,11 @@ static int reiserfs_release_dquot(struct dquot *dquot)
1918 int ret, err; 1927 int ret, err;
1919 1928
1920 reiserfs_write_lock(dquot->dq_sb); 1929 reiserfs_write_lock(dquot->dq_sb);
1921 ret = journal_begin(&th, dquot->dq_sb, REISERFS_QUOTA_INIT_BLOCKS); 1930 ret = journal_begin(&th, dquot->dq_sb, REISERFS_QUOTA_DEL_BLOCKS(dquot->dq_sb));
1922 if (ret) 1931 if (ret)
1923 goto out; 1932 goto out;
1924 ret = dquot_release(dquot); 1933 ret = dquot_release(dquot);
1925 err = journal_end(&th, dquot->dq_sb, REISERFS_QUOTA_INIT_BLOCKS); 1934 err = journal_end(&th, dquot->dq_sb, REISERFS_QUOTA_DEL_BLOCKS(dquot->dq_sb));
1926 if (!ret && err) 1935 if (!ret && err)
1927 ret = err; 1936 ret = err;
1928out: 1937out:
@@ -1978,6 +1987,8 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id, ch
1978 int err; 1987 int err;
1979 struct nameidata nd; 1988 struct nameidata nd;
1980 1989
1990 if (!(REISERFS_SB(sb)->s_mount_opt & (1<<REISERFS_QUOTA)))
1991 return -EINVAL;
1981 err = path_lookup(path, LOOKUP_FOLLOW, &nd); 1992 err = path_lookup(path, LOOKUP_FOLLOW, &nd);
1982 if (err) 1993 if (err)
1983 return err; 1994 return err;