diff options
Diffstat (limited to 'fs/ufs/super.c')
-rw-r--r-- | fs/ufs/super.c | 110 |
1 files changed, 1 insertions, 109 deletions
diff --git a/fs/ufs/super.c b/fs/ufs/super.c index ad9bc1ebd3a6..3ec5a9eb6efb 100644 --- a/fs/ufs/super.c +++ b/fs/ufs/super.c | |||
@@ -77,7 +77,6 @@ | |||
77 | 77 | ||
78 | #include <linux/errno.h> | 78 | #include <linux/errno.h> |
79 | #include <linux/fs.h> | 79 | #include <linux/fs.h> |
80 | #include <linux/quotaops.h> | ||
81 | #include <linux/slab.h> | 80 | #include <linux/slab.h> |
82 | #include <linux/time.h> | 81 | #include <linux/time.h> |
83 | #include <linux/stat.h> | 82 | #include <linux/stat.h> |
@@ -1047,7 +1046,7 @@ magic_found: | |||
1047 | */ | 1046 | */ |
1048 | sb->s_op = &ufs_super_ops; | 1047 | sb->s_op = &ufs_super_ops; |
1049 | sb->s_export_op = &ufs_export_ops; | 1048 | sb->s_export_op = &ufs_export_ops; |
1050 | sb->dq_op = NULL; /***/ | 1049 | |
1051 | sb->s_magic = fs32_to_cpu(sb, usb3->fs_magic); | 1050 | sb->s_magic = fs32_to_cpu(sb, usb3->fs_magic); |
1052 | 1051 | ||
1053 | uspi->s_sblkno = fs32_to_cpu(sb, usb1->fs_sblkno); | 1052 | uspi->s_sblkno = fs32_to_cpu(sb, usb1->fs_sblkno); |
@@ -1437,126 +1436,19 @@ static void destroy_inodecache(void) | |||
1437 | kmem_cache_destroy(ufs_inode_cachep); | 1436 | kmem_cache_destroy(ufs_inode_cachep); |
1438 | } | 1437 | } |
1439 | 1438 | ||
1440 | static void ufs_clear_inode(struct inode *inode) | ||
1441 | { | ||
1442 | dquot_drop(inode); | ||
1443 | } | ||
1444 | |||
1445 | #ifdef CONFIG_QUOTA | ||
1446 | static ssize_t ufs_quota_read(struct super_block *, int, char *,size_t, loff_t); | ||
1447 | static ssize_t ufs_quota_write(struct super_block *, int, const char *, size_t, loff_t); | ||
1448 | #endif | ||
1449 | |||
1450 | static const struct super_operations ufs_super_ops = { | 1439 | static const struct super_operations ufs_super_ops = { |
1451 | .alloc_inode = ufs_alloc_inode, | 1440 | .alloc_inode = ufs_alloc_inode, |
1452 | .destroy_inode = ufs_destroy_inode, | 1441 | .destroy_inode = ufs_destroy_inode, |
1453 | .write_inode = ufs_write_inode, | 1442 | .write_inode = ufs_write_inode, |
1454 | .delete_inode = ufs_delete_inode, | 1443 | .delete_inode = ufs_delete_inode, |
1455 | .clear_inode = ufs_clear_inode, | ||
1456 | .put_super = ufs_put_super, | 1444 | .put_super = ufs_put_super, |
1457 | .write_super = ufs_write_super, | 1445 | .write_super = ufs_write_super, |
1458 | .sync_fs = ufs_sync_fs, | 1446 | .sync_fs = ufs_sync_fs, |
1459 | .statfs = ufs_statfs, | 1447 | .statfs = ufs_statfs, |
1460 | .remount_fs = ufs_remount, | 1448 | .remount_fs = ufs_remount, |
1461 | .show_options = ufs_show_options, | 1449 | .show_options = ufs_show_options, |
1462 | #ifdef CONFIG_QUOTA | ||
1463 | .quota_read = ufs_quota_read, | ||
1464 | .quota_write = ufs_quota_write, | ||
1465 | #endif | ||
1466 | }; | 1450 | }; |
1467 | 1451 | ||
1468 | #ifdef CONFIG_QUOTA | ||
1469 | |||
1470 | /* Read data from quotafile - avoid pagecache and such because we cannot afford | ||
1471 | * acquiring the locks... As quota files are never truncated and quota code | ||
1472 | * itself serializes the operations (and noone else should touch the files) | ||
1473 | * we don't have to be afraid of races */ | ||
1474 | static ssize_t ufs_quota_read(struct super_block *sb, int type, char *data, | ||
1475 | size_t len, loff_t off) | ||
1476 | { | ||
1477 | struct inode *inode = sb_dqopt(sb)->files[type]; | ||
1478 | sector_t blk = off >> sb->s_blocksize_bits; | ||
1479 | int err = 0; | ||
1480 | int offset = off & (sb->s_blocksize - 1); | ||
1481 | int tocopy; | ||
1482 | size_t toread; | ||
1483 | struct buffer_head *bh; | ||
1484 | loff_t i_size = i_size_read(inode); | ||
1485 | |||
1486 | if (off > i_size) | ||
1487 | return 0; | ||
1488 | if (off+len > i_size) | ||
1489 | len = i_size-off; | ||
1490 | toread = len; | ||
1491 | while (toread > 0) { | ||
1492 | tocopy = sb->s_blocksize - offset < toread ? | ||
1493 | sb->s_blocksize - offset : toread; | ||
1494 | |||
1495 | bh = ufs_bread(inode, blk, 0, &err); | ||
1496 | if (err) | ||
1497 | return err; | ||
1498 | if (!bh) /* A hole? */ | ||
1499 | memset(data, 0, tocopy); | ||
1500 | else { | ||
1501 | memcpy(data, bh->b_data+offset, tocopy); | ||
1502 | brelse(bh); | ||
1503 | } | ||
1504 | offset = 0; | ||
1505 | toread -= tocopy; | ||
1506 | data += tocopy; | ||
1507 | blk++; | ||
1508 | } | ||
1509 | return len; | ||
1510 | } | ||
1511 | |||
1512 | /* Write to quotafile */ | ||
1513 | static ssize_t ufs_quota_write(struct super_block *sb, int type, | ||
1514 | const char *data, size_t len, loff_t off) | ||
1515 | { | ||
1516 | struct inode *inode = sb_dqopt(sb)->files[type]; | ||
1517 | sector_t blk = off >> sb->s_blocksize_bits; | ||
1518 | int err = 0; | ||
1519 | int offset = off & (sb->s_blocksize - 1); | ||
1520 | int tocopy; | ||
1521 | size_t towrite = len; | ||
1522 | struct buffer_head *bh; | ||
1523 | |||
1524 | mutex_lock_nested(&inode->i_mutex, I_MUTEX_QUOTA); | ||
1525 | while (towrite > 0) { | ||
1526 | tocopy = sb->s_blocksize - offset < towrite ? | ||
1527 | sb->s_blocksize - offset : towrite; | ||
1528 | |||
1529 | bh = ufs_bread(inode, blk, 1, &err); | ||
1530 | if (!bh) | ||
1531 | goto out; | ||
1532 | lock_buffer(bh); | ||
1533 | memcpy(bh->b_data+offset, data, tocopy); | ||
1534 | flush_dcache_page(bh->b_page); | ||
1535 | set_buffer_uptodate(bh); | ||
1536 | mark_buffer_dirty(bh); | ||
1537 | unlock_buffer(bh); | ||
1538 | brelse(bh); | ||
1539 | offset = 0; | ||
1540 | towrite -= tocopy; | ||
1541 | data += tocopy; | ||
1542 | blk++; | ||
1543 | } | ||
1544 | out: | ||
1545 | if (len == towrite) { | ||
1546 | mutex_unlock(&inode->i_mutex); | ||
1547 | return err; | ||
1548 | } | ||
1549 | if (inode->i_size < off+len-towrite) | ||
1550 | i_size_write(inode, off+len-towrite); | ||
1551 | inode->i_version++; | ||
1552 | inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC; | ||
1553 | mark_inode_dirty(inode); | ||
1554 | mutex_unlock(&inode->i_mutex); | ||
1555 | return len - towrite; | ||
1556 | } | ||
1557 | |||
1558 | #endif | ||
1559 | |||
1560 | static int ufs_get_sb(struct file_system_type *fs_type, | 1452 | static int ufs_get_sb(struct file_system_type *fs_type, |
1561 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) | 1453 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) |
1562 | { | 1454 | { |