Commit 36350462 authored by Jan Kara's avatar Jan Kara

udf: Remove dead quota code

Quota on UDF is non-functional at least since 2.6.16 (I'm too lazy to
do more archeology) because it does not provide .quota_write and .quota_read
functions and thus quotaon(8) just returns EINVAL. Since nobody complained
for all those years and quota support is not even in UDF standard just nuke
it.
Signed-off-by: default avatarJan Kara <jack@suse.cz>
parent 287a8095
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include "udfdecl.h" #include "udfdecl.h"
#include <linux/quotaops.h>
#include <linux/buffer_head.h> #include <linux/buffer_head.h>
#include <linux/bitops.h> #include <linux/bitops.h>
...@@ -159,8 +158,6 @@ static void udf_bitmap_free_blocks(struct super_block *sb, ...@@ -159,8 +158,6 @@ static void udf_bitmap_free_blocks(struct super_block *sb,
udf_debug("byte=%2x\n", udf_debug("byte=%2x\n",
((char *)bh->b_data)[(bit + i) >> 3]); ((char *)bh->b_data)[(bit + i) >> 3]);
} else { } else {
if (inode)
dquot_free_block(inode, 1);
udf_add_free_space(sb, sbi->s_partition, 1); udf_add_free_space(sb, sbi->s_partition, 1);
} }
} }
...@@ -210,15 +207,8 @@ static int udf_bitmap_prealloc_blocks(struct super_block *sb, ...@@ -210,15 +207,8 @@ static int udf_bitmap_prealloc_blocks(struct super_block *sb,
bit = block % (sb->s_blocksize << 3); bit = block % (sb->s_blocksize << 3);
while (bit < (sb->s_blocksize << 3) && block_count > 0) { while (bit < (sb->s_blocksize << 3) && block_count > 0) {
if (!udf_test_bit(bit, bh->b_data)) if (!udf_clear_bit(bit, bh->b_data))
goto out; goto out;
else if (dquot_prealloc_block(inode, 1))
goto out;
else if (!udf_clear_bit(bit, bh->b_data)) {
udf_debug("bit already cleared for block %d\n", bit);
dquot_free_block(inode, 1);
goto out;
}
block_count--; block_count--;
alloc_count++; alloc_count++;
bit++; bit++;
...@@ -338,20 +328,6 @@ static int udf_bitmap_new_block(struct super_block *sb, ...@@ -338,20 +328,6 @@ static int udf_bitmap_new_block(struct super_block *sb,
} }
got_block: got_block:
/*
* Check quota for allocation of this block.
*/
if (inode) {
int ret = dquot_alloc_block(inode, 1);
if (ret) {
mutex_unlock(&sbi->s_alloc_mutex);
*err = ret;
return 0;
}
}
newblock = bit + (block_group << (sb->s_blocksize_bits + 3)) - newblock = bit + (block_group << (sb->s_blocksize_bits + 3)) -
(sizeof(struct spaceBitmapDesc) << 3); (sizeof(struct spaceBitmapDesc) << 3);
...@@ -401,10 +377,6 @@ static void udf_table_free_blocks(struct super_block *sb, ...@@ -401,10 +377,6 @@ static void udf_table_free_blocks(struct super_block *sb,
} }
iinfo = UDF_I(table); iinfo = UDF_I(table);
/* We do this up front - There are some error conditions that
could occure, but.. oh well */
if (inode)
dquot_free_block(inode, count);
udf_add_free_space(sb, sbi->s_partition, count); udf_add_free_space(sb, sbi->s_partition, count);
start = bloc->logicalBlockNum + offset; start = bloc->logicalBlockNum + offset;
...@@ -649,10 +621,7 @@ static int udf_table_prealloc_blocks(struct super_block *sb, ...@@ -649,10 +621,7 @@ static int udf_table_prealloc_blocks(struct super_block *sb,
epos.offset -= adsize; epos.offset -= adsize;
alloc_count = (elen >> sb->s_blocksize_bits); alloc_count = (elen >> sb->s_blocksize_bits);
if (inode && dquot_prealloc_block(inode, if (alloc_count > block_count) {
alloc_count > block_count ? block_count : alloc_count))
alloc_count = 0;
else if (alloc_count > block_count) {
alloc_count = block_count; alloc_count = block_count;
eloc.logicalBlockNum += alloc_count; eloc.logicalBlockNum += alloc_count;
elen -= (alloc_count << sb->s_blocksize_bits); elen -= (alloc_count << sb->s_blocksize_bits);
...@@ -752,14 +721,6 @@ static int udf_table_new_block(struct super_block *sb, ...@@ -752,14 +721,6 @@ static int udf_table_new_block(struct super_block *sb,
newblock = goal_eloc.logicalBlockNum; newblock = goal_eloc.logicalBlockNum;
goal_eloc.logicalBlockNum++; goal_eloc.logicalBlockNum++;
goal_elen -= sb->s_blocksize; goal_elen -= sb->s_blocksize;
if (inode) {
*err = dquot_alloc_block(inode, 1);
if (*err) {
brelse(goal_epos.bh);
mutex_unlock(&sbi->s_alloc_mutex);
return 0;
}
}
if (goal_elen) if (goal_elen)
udf_write_aext(table, &goal_epos, &goal_eloc, goal_elen, 1); udf_write_aext(table, &goal_epos, &goal_eloc, goal_elen, 1);
......
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <linux/pagemap.h> #include <linux/pagemap.h>
#include <linux/quotaops.h>
#include <linux/buffer_head.h> #include <linux/buffer_head.h>
#include <linux/aio.h> #include <linux/aio.h>
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
...@@ -219,7 +218,7 @@ const struct file_operations udf_file_operations = { ...@@ -219,7 +218,7 @@ const struct file_operations udf_file_operations = {
.read = do_sync_read, .read = do_sync_read,
.aio_read = generic_file_aio_read, .aio_read = generic_file_aio_read,
.unlocked_ioctl = udf_ioctl, .unlocked_ioctl = udf_ioctl,
.open = dquot_file_open, .open = generic_file_open,
.mmap = generic_file_mmap, .mmap = generic_file_mmap,
.write = do_sync_write, .write = do_sync_write,
.aio_write = udf_file_aio_write, .aio_write = udf_file_aio_write,
...@@ -229,29 +228,6 @@ const struct file_operations udf_file_operations = { ...@@ -229,29 +228,6 @@ const struct file_operations udf_file_operations = {
.llseek = generic_file_llseek, .llseek = generic_file_llseek,
}; };
int udf_setattr(struct dentry *dentry, struct iattr *iattr)
{
struct inode *inode = dentry->d_inode;
int error;
error = inode_change_ok(inode, iattr);
if (error)
return error;
if (is_quota_modification(inode, iattr))
dquot_initialize(inode);
if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) ||
(iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) {
error = dquot_transfer(inode, iattr);
if (error)
return error;
}
return inode_setattr(inode, iattr);
}
const struct inode_operations udf_file_inode_operations = { const struct inode_operations udf_file_inode_operations = {
.truncate = udf_truncate, .truncate = udf_truncate,
.setattr = udf_setattr,
}; };
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include "udfdecl.h" #include "udfdecl.h"
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/quotaops.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/slab.h> #include <linux/slab.h>
...@@ -32,13 +31,6 @@ void udf_free_inode(struct inode *inode) ...@@ -32,13 +31,6 @@ void udf_free_inode(struct inode *inode)
struct super_block *sb = inode->i_sb; struct super_block *sb = inode->i_sb;
struct udf_sb_info *sbi = UDF_SB(sb); struct udf_sb_info *sbi = UDF_SB(sb);
/*
* Note: we must free any quota before locking the superblock,
* as writing the quota to disk may need the lock as well.
*/
dquot_free_inode(inode);
dquot_drop(inode);
clear_inode(inode); clear_inode(inode);
mutex_lock(&sbi->s_alloc_mutex); mutex_lock(&sbi->s_alloc_mutex);
...@@ -61,7 +53,7 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err) ...@@ -61,7 +53,7 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err)
struct super_block *sb = dir->i_sb; struct super_block *sb = dir->i_sb;
struct udf_sb_info *sbi = UDF_SB(sb); struct udf_sb_info *sbi = UDF_SB(sb);
struct inode *inode; struct inode *inode;
int block, ret; int block;
uint32_t start = UDF_I(dir)->i_location.logicalBlockNum; uint32_t start = UDF_I(dir)->i_location.logicalBlockNum;
struct udf_inode_info *iinfo; struct udf_inode_info *iinfo;
struct udf_inode_info *dinfo = UDF_I(dir); struct udf_inode_info *dinfo = UDF_I(dir);
...@@ -146,17 +138,6 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err) ...@@ -146,17 +138,6 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err)
insert_inode_hash(inode); insert_inode_hash(inode);
mark_inode_dirty(inode); mark_inode_dirty(inode);
dquot_initialize(inode);
ret = dquot_alloc_inode(inode);
if (ret) {
dquot_drop(inode);
inode->i_flags |= S_NOQUOTA;
inode->i_nlink = 0;
iput(inode);
*err = ret;
return NULL;
}
*err = 0; *err = 0;
return inode; return inode;
} }
...@@ -36,7 +36,6 @@ ...@@ -36,7 +36,6 @@
#include <linux/pagemap.h> #include <linux/pagemap.h>
#include <linux/buffer_head.h> #include <linux/buffer_head.h>
#include <linux/writeback.h> #include <linux/writeback.h>
#include <linux/quotaops.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/crc-itu-t.h> #include <linux/crc-itu-t.h>
...@@ -71,9 +70,6 @@ static int udf_get_block(struct inode *, sector_t, struct buffer_head *, int); ...@@ -71,9 +70,6 @@ static int udf_get_block(struct inode *, sector_t, struct buffer_head *, int);
void udf_delete_inode(struct inode *inode) void udf_delete_inode(struct inode *inode)
{ {
if (!is_bad_inode(inode))
dquot_initialize(inode);
truncate_inode_pages(&inode->i_data, 0); truncate_inode_pages(&inode->i_data, 0);
if (is_bad_inode(inode)) if (is_bad_inode(inode))
...@@ -113,7 +109,6 @@ void udf_clear_inode(struct inode *inode) ...@@ -113,7 +109,6 @@ void udf_clear_inode(struct inode *inode)
(unsigned long long)iinfo->i_lenExtents); (unsigned long long)iinfo->i_lenExtents);
} }
dquot_drop(inode);
kfree(iinfo->i_ext.i_data); kfree(iinfo->i_ext.i_data);
iinfo->i_ext.i_data = NULL; iinfo->i_ext.i_data = NULL;
} }
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/quotaops.h>
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <linux/buffer_head.h> #include <linux/buffer_head.h>
#include <linux/sched.h> #include <linux/sched.h>
...@@ -563,8 +562,6 @@ static int udf_create(struct inode *dir, struct dentry *dentry, int mode, ...@@ -563,8 +562,6 @@ static int udf_create(struct inode *dir, struct dentry *dentry, int mode,
int err; int err;
struct udf_inode_info *iinfo; struct udf_inode_info *iinfo;
dquot_initialize(dir);
lock_kernel(); lock_kernel();
inode = udf_new_inode(dir, mode, &err); inode = udf_new_inode(dir, mode, &err);
if (!inode) { if (!inode) {
...@@ -617,8 +614,6 @@ static int udf_mknod(struct inode *dir, struct dentry *dentry, int mode, ...@@ -617,8 +614,6 @@ static int udf_mknod(struct inode *dir, struct dentry *dentry, int mode,
if (!old_valid_dev(rdev)) if (!old_valid_dev(rdev))
return -EINVAL; return -EINVAL;
dquot_initialize(dir);
lock_kernel(); lock_kernel();
err = -EIO; err = -EIO;
inode = udf_new_inode(dir, mode, &err); inode = udf_new_inode(dir, mode, &err);
...@@ -664,8 +659,6 @@ static int udf_mkdir(struct inode *dir, struct dentry *dentry, int mode) ...@@ -664,8 +659,6 @@ static int udf_mkdir(struct inode *dir, struct dentry *dentry, int mode)
struct udf_inode_info *dinfo = UDF_I(dir); struct udf_inode_info *dinfo = UDF_I(dir);
struct udf_inode_info *iinfo; struct udf_inode_info *iinfo;
dquot_initialize(dir);
lock_kernel(); lock_kernel();
err = -EMLINK; err = -EMLINK;
if (dir->i_nlink >= (256 << sizeof(dir->i_nlink)) - 1) if (dir->i_nlink >= (256 << sizeof(dir->i_nlink)) - 1)
...@@ -800,8 +793,6 @@ static int udf_rmdir(struct inode *dir, struct dentry *dentry) ...@@ -800,8 +793,6 @@ static int udf_rmdir(struct inode *dir, struct dentry *dentry)
struct fileIdentDesc *fi, cfi; struct fileIdentDesc *fi, cfi;
struct kernel_lb_addr tloc; struct kernel_lb_addr tloc;
dquot_initialize(dir);
retval = -ENOENT; retval = -ENOENT;
lock_kernel(); lock_kernel();
fi = udf_find_entry(dir, &dentry->d_name, &fibh, &cfi); fi = udf_find_entry(dir, &dentry->d_name, &fibh, &cfi);
...@@ -848,8 +839,6 @@ static int udf_unlink(struct inode *dir, struct dentry *dentry) ...@@ -848,8 +839,6 @@ static int udf_unlink(struct inode *dir, struct dentry *dentry)
struct fileIdentDesc cfi; struct fileIdentDesc cfi;
struct kernel_lb_addr tloc; struct kernel_lb_addr tloc;
dquot_initialize(dir);
retval = -ENOENT; retval = -ENOENT;
lock_kernel(); lock_kernel();
fi = udf_find_entry(dir, &dentry->d_name, &fibh, &cfi); fi = udf_find_entry(dir, &dentry->d_name, &fibh, &cfi);
...@@ -904,8 +893,6 @@ static int udf_symlink(struct inode *dir, struct dentry *dentry, ...@@ -904,8 +893,6 @@ static int udf_symlink(struct inode *dir, struct dentry *dentry,
struct buffer_head *bh; struct buffer_head *bh;
struct udf_inode_info *iinfo; struct udf_inode_info *iinfo;
dquot_initialize(dir);
lock_kernel(); lock_kernel();
inode = udf_new_inode(dir, S_IFLNK | S_IRWXUGO, &err); inode = udf_new_inode(dir, S_IFLNK | S_IRWXUGO, &err);
if (!inode) if (!inode)
...@@ -1075,8 +1062,6 @@ static int udf_link(struct dentry *old_dentry, struct inode *dir, ...@@ -1075,8 +1062,6 @@ static int udf_link(struct dentry *old_dentry, struct inode *dir,
int err; int err;
struct buffer_head *bh; struct buffer_head *bh;
dquot_initialize(dir);
lock_kernel(); lock_kernel();
if (inode->i_nlink >= (256 << sizeof(inode->i_nlink)) - 1) { if (inode->i_nlink >= (256 << sizeof(inode->i_nlink)) - 1) {
unlock_kernel(); unlock_kernel();
...@@ -1139,9 +1124,6 @@ static int udf_rename(struct inode *old_dir, struct dentry *old_dentry, ...@@ -1139,9 +1124,6 @@ static int udf_rename(struct inode *old_dir, struct dentry *old_dentry,
struct kernel_lb_addr tloc; struct kernel_lb_addr tloc;
struct udf_inode_info *old_iinfo = UDF_I(old_inode); struct udf_inode_info *old_iinfo = UDF_I(old_inode);
dquot_initialize(old_dir);
dquot_initialize(new_dir);
lock_kernel(); lock_kernel();
ofi = udf_find_entry(old_dir, &old_dentry->d_name, &ofibh, &ocfi); ofi = udf_find_entry(old_dir, &old_dentry->d_name, &ofibh, &ocfi);
if (ofi) { if (ofi) {
...@@ -1387,7 +1369,6 @@ const struct export_operations udf_export_ops = { ...@@ -1387,7 +1369,6 @@ const struct export_operations udf_export_ops = {
const struct inode_operations udf_dir_inode_operations = { const struct inode_operations udf_dir_inode_operations = {
.lookup = udf_lookup, .lookup = udf_lookup,
.create = udf_create, .create = udf_create,
.setattr = udf_setattr,
.link = udf_link, .link = udf_link,
.unlink = udf_unlink, .unlink = udf_unlink,
.symlink = udf_symlink, .symlink = udf_symlink,
...@@ -1400,5 +1381,4 @@ const struct inode_operations udf_symlink_inode_operations = { ...@@ -1400,5 +1381,4 @@ const struct inode_operations udf_symlink_inode_operations = {
.readlink = generic_readlink, .readlink = generic_readlink,
.follow_link = page_follow_link_light, .follow_link = page_follow_link_light,
.put_link = page_put_link, .put_link = page_put_link,
.setattr = udf_setattr,
}; };
...@@ -54,7 +54,6 @@ ...@@ -54,7 +54,6 @@
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/mount.h> #include <linux/mount.h>
#include <linux/quotaops.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/bitmap.h> #include <linux/bitmap.h>
#include <linux/crc-itu-t.h> #include <linux/crc-itu-t.h>
...@@ -587,18 +586,11 @@ static int udf_remount_fs(struct super_block *sb, int *flags, char *options) ...@@ -587,18 +586,11 @@ static int udf_remount_fs(struct super_block *sb, int *flags, char *options)
if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY))
goto out_unlock; goto out_unlock;
if (*flags & MS_RDONLY) { if (*flags & MS_RDONLY)
udf_close_lvid(sb); udf_close_lvid(sb);
else
error = dquot_suspend(sb, -1);
} else {
udf_open_lvid(sb); udf_open_lvid(sb);
/* mark the fs r/w for quota activity */
sb->s_flags &= ~MS_RDONLY;
dquot_resume(sb, -1);
}
out_unlock: out_unlock:
unlock_kernel(); unlock_kernel();
return error; return error;
...@@ -1948,10 +1940,6 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) ...@@ -1948,10 +1940,6 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
/* Fill in the rest of the superblock */ /* Fill in the rest of the superblock */
sb->s_op = &udf_sb_ops; sb->s_op = &udf_sb_ops;
sb->s_export_op = &udf_export_ops; sb->s_export_op = &udf_export_ops;
#ifdef CONFIG_QUOTA
sb->s_qcop = &dquot_quotactl_ops;
sb->dq_op = NULL; /* &dquot_operations */
#endif
sb->s_dirt = 0; sb->s_dirt = 0;
sb->s_magic = UDF_SUPER_MAGIC; sb->s_magic = UDF_SUPER_MAGIC;
...@@ -2106,8 +2094,6 @@ static void udf_put_super(struct super_block *sb) ...@@ -2106,8 +2094,6 @@ static void udf_put_super(struct super_block *sb)
int i; int i;
struct udf_sb_info *sbi; struct udf_sb_info *sbi;
dquot_disable(sb, -1, DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED);
sbi = UDF_SB(sb); sbi = UDF_SB(sb);
lock_kernel(); lock_kernel();
......
...@@ -131,7 +131,6 @@ extern int udf_write_fi(struct inode *inode, struct fileIdentDesc *, ...@@ -131,7 +131,6 @@ extern int udf_write_fi(struct inode *inode, struct fileIdentDesc *,
/* file.c */ /* file.c */
extern long udf_ioctl(struct file *, unsigned int, unsigned long); extern long udf_ioctl(struct file *, unsigned int, unsigned long);
extern int udf_setattr(struct dentry *dentry, struct iattr *iattr);
/* inode.c */ /* inode.c */
extern struct inode *udf_iget(struct super_block *, struct kernel_lb_addr *); extern struct inode *udf_iget(struct super_block *, struct kernel_lb_addr *);
extern int udf_sync_inode(struct inode *); extern int udf_sync_inode(struct inode *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment