19 #include <linux/module.h>
24 #include <linux/random.h>
31 #include <asm/uaccess.h>
33 #define CREATE_TRACE_POINTS
40 #ifdef CONFIG_EXT3_DEFAULTS_TO_ORDERED
41 #define EXT3_MOUNT_DEFAULT_DATA_MODE EXT3_MOUNT_ORDERED_DATA
43 #define EXT3_MOUNT_DEFAULT_DATA_MODE EXT3_MOUNT_WRITEBACK_DATA
47 unsigned long journal_devnum);
53 static void ext3_mark_recovery_complete(
struct super_block *
sb,
58 static const char *ext3_decode_error(
struct super_block *
sb,
int errno,
73 return ERR_PTR(-
EROFS);
78 journal = EXT3_SB(sb)->s_journal;
79 if (is_journal_aborted(journal)) {
81 "Detected aborted journal");
82 return ERR_PTR(-
EROFS);
94 sb = handle->h_transaction->t_journal->j_private;
106 struct buffer_head *bh, handle_t *
handle,
int err)
109 const char *
errstr = ext3_decode_error(
NULL, err, nbuf);
112 BUFFER_TRACE(bh,
"abort");
117 if (is_handle_aborted(handle))
121 caller, errstr, err_fn);
123 journal_abort_handle(handle);
127 const char *
fmt, ...)
137 printk(
"%sEXT3-fs (%s): %pV\n", prefix, sb->
s_id, &vaf);
168 journal_t *journal = EXT3_SB(sb)->s_journal;
176 "error: remounting filesystem read-only");
179 ext3_commit_super(sb, es, 1);
181 panic(
"EXT3-fs (%s): panic forced after error\n",
186 const char *
fmt, ...)
197 sb->
s_id,
function, &vaf);
201 ext3_handle_error(sb);
204 static const char *ext3_decode_error(
struct super_block * sb,
int errno,
211 errstr =
"IO failure";
214 errstr =
"Out of memory";
217 if (!sb || EXT3_SB(sb)->
s_journal->j_flags & JFS_ABORT)
218 errstr =
"Journal has aborted";
220 errstr =
"Readonly filesystem";
228 if (
snprintf(nbuf, 16,
"error %d", -errno) >= 0)
249 if (errno == -
EROFS && journal_current_handle() ==
NULL &&
253 errstr = ext3_decode_error(sb, errno, nbuf);
256 ext3_handle_error(sb);
270 const char *
fmt, ...)
281 sb->
s_id,
function, &vaf);
286 panic(
"EXT3-fs: panic from previous error\n");
292 "error: remounting filesystem read-only");
301 const char *
fmt, ...)
312 sb->
s_id,
function, &vaf);
325 "warning: updating to rev %d because of "
326 "new feature flag, running e2fsck is recommended",
356 ext3_msg(sb,
"error: failed to open journal device %s: %ld",
377 ret = ext3_blkdev_put(bdev);
399 "inode %s:%lu at %p: mode %o, nlink %d, next %d\n",
406 static void ext3_put_super (
struct super_block * sb)
417 ext3_abort(sb, __func__,
"Couldn't clean up the journal");
422 BUFFER_TRACE(sbi->
s_sbh,
"marking dirty");
424 ext3_commit_super(sb, es, 1);
436 kfree(sbi->s_qf_names[i]);
444 dump_orphan_list(sb, sbi);
445 J_ASSERT(list_empty(&sbi->
s_orphan));
456 ext3_blkdev_remove(sbi);
482 static int ext3_drop_inode(
struct inode *
inode)
484 int drop = generic_drop_inode(inode);
486 trace_ext3_drop_inode(inode, drop);
496 static void ext3_destroy_inode(
struct inode *inode)
498 if (!list_empty(&(EXT3_I(inode)->i_orphan))) {
499 printk(
"EXT3 Inode %p: orphan list check failed!\n",
509 static void init_once(
void *
foo)
514 #ifdef CONFIG_EXT3_FS_XATTR
521 static int init_inodecache(
void)
528 if (ext3_inode_cachep ==
NULL)
533 static void destroy_inodecache(
void)
545 #if defined(CONFIG_QUOTA)
548 if (sbi->s_jquota_fmt) {
551 switch (sbi->s_jquota_fmt) {
579 static char *data_mode_string(
unsigned long mode)
597 static int ext3_show_options(
struct seq_file *seq,
struct dentry *root)
602 unsigned long def_mount_opts;
629 seq_puts(seq,
",errors=remount-ro");
640 #ifdef CONFIG_EXT3_FS_XATTR
648 #ifdef CONFIG_EXT3_FS_POSIX_ACL
673 ext3_show_quota_options(seq, sb);
679 static struct inode *ext3_nfs_get_inode(
struct super_block *sb,
686 if (ino >
le32_to_cpu(EXT3_SB(sb)->s_es->s_inodes_count))
699 return ERR_CAST(inode);
709 int fh_len,
int fh_type)
716 int fh_len,
int fh_type)
731 journal_t *journal = EXT3_SB(sb)->s_journal;
734 if (!page_has_buffers(page))
743 #define QTYPE2NAME(t) ((t)==USRQUOTA?"user":"group")
744 #define QTYPE2MOPT(on, t) ((t)==USRQUOTA?((on)##USRJQUOTA):((on)##GRPJQUOTA))
746 static int ext3_write_dquot(
struct dquot *
dquot);
747 static int ext3_acquire_dquot(
struct dquot *
dquot);
748 static int ext3_release_dquot(
struct dquot *
dquot);
749 static int ext3_mark_dquot_dirty(
struct dquot *
dquot);
755 size_t len, loff_t off);
757 const char *
data,
size_t len, loff_t off);
761 .acquire_dquot = ext3_acquire_dquot,
762 .release_dquot = ext3_release_dquot,
763 .mark_dirty = ext3_mark_dquot_dirty,
764 .write_info = ext3_write_info,
769 static const struct quotactl_ops ext3_qctl_operations = {
781 .alloc_inode = ext3_alloc_inode,
782 .destroy_inode = ext3_destroy_inode,
785 .drop_inode = ext3_drop_inode,
787 .put_super = ext3_put_super,
788 .sync_fs = ext3_sync_fs,
789 .freeze_fs = ext3_freeze,
790 .unfreeze_fs = ext3_unfreeze,
791 .statfs = ext3_statfs,
792 .remount_fs = ext3_remount,
793 .show_options = ext3_show_options,
795 .quota_read = ext3_quota_read,
796 .quota_write = ext3_quota_write,
802 .fh_to_dentry = ext3_fh_to_dentry,
803 .fh_to_parent = ext3_fh_to_parent,
882 char *
options = (
char *) *data;
884 if (!options ||
strncmp(options,
"sb=", 3) != 0)
889 if (*options && *options !=
',') {
890 ext3_msg(sb,
"error: invalid sb specification: %s",
896 *data = (
void *) options;
906 if (sb_any_quota_loaded(sb) &&
907 !sbi->s_qf_names[qtype]) {
909 "Cannot change journaled "
910 "quota options when quota turned on");
916 "Not enough memory for storing quotafile name");
919 if (sbi->s_qf_names[qtype] &&
920 strcmp(sbi->s_qf_names[qtype], qname)) {
922 "%s quota file already specified", QTYPE2NAME(qtype));
926 sbi->s_qf_names[qtype] = qname;
927 if (
strchr(sbi->s_qf_names[qtype],
'/')) {
929 "quotafile must be on filesystem root");
930 kfree(sbi->s_qf_names[qtype]);
931 sbi->s_qf_names[qtype] =
NULL;
938 static int clear_qf_name(
struct super_block *sb,
int qtype) {
942 if (sb_any_quota_loaded(sb) &&
943 sbi->s_qf_names[qtype]) {
945 " when quota turned on");
952 sbi->s_qf_names[qtype] =
NULL;
957 static int parse_options (
char *options,
struct super_block *sb,
958 unsigned int *
inum,
unsigned long *journal_devnum,
975 while ((p =
strsep (&options,
",")) !=
NULL) {
1002 if (!uid_valid(uid)) {
1013 if (!gid_valid(gid)) {
1049 "Ignoring deprecated oldalloc option");
1053 "Ignoring deprecated orlov option");
1055 #ifdef CONFIG_EXT3_FS_XATTR
1066 "(no)user_xattr options not supported");
1069 #ifdef CONFIG_EXT3_FS_POSIX_ACL
1080 "(no)acl options not supported");
1097 "journal on remount");
1105 "journal on remount");
1115 "journal on remount");
1120 *journal_devnum =
option;
1131 option = JBD_DEFAULT_MAX_COMMIT_AGE;
1144 if (
test_opt(sb, DATA_FLAGS) == data_opt)
1147 "error: cannot change "
1148 "data mode on remount. The filesystem "
1149 "is mounted in data=%s mode and you "
1150 "try to remount it in data=%s mode.",
1153 data_mode_string(data_opt));
1168 if (!set_qf_name(sb,
USRQUOTA, &args[0]))
1172 if (!set_qf_name(sb,
GRPQUOTA, &args[0]))
1192 if (sb_any_quota_loaded(sb) &&
1193 sbi->s_jquota_fmt != qfmt) {
1195 "journaled quota options when "
1196 "quota turned on.");
1199 sbi->s_jquota_fmt =
qfmt;
1211 if (sb_any_quota_loaded(sb)) {
1213 "quota options when quota turned on.");
1225 "error: quota options not supported.");
1235 "error: journaled quota options not "
1263 "error: resize option only available "
1269 *n_blocks_count =
option;
1273 "warning: ignoring deprecated nobh option");
1277 "warning: ignoring deprecated bh option");
1281 "error: unrecognized mount option \"%s\" "
1282 "or missing value", p);
1299 if (!sbi->s_jquota_fmt) {
1305 if (sbi->s_jquota_fmt) {
1307 "specified with no journaling "
1324 "error: revision level too high, "
1325 "forcing read-only mode");
1332 "warning: mounting unchecked fs, "
1333 "running e2fsck is recommended");
1336 "warning: mounting fs with errors, "
1337 "running e2fsck is recommended");
1342 "warning: maximal mount count reached, "
1343 "running e2fsck is recommended");
1348 "warning: checktime reached, "
1349 "running e2fsck is recommended");
1364 ext3_commit_super(sb, es, 1);
1367 "bpg=%lu, ipg=%lu, mo=%04lx]",
1381 cleancache_init_fs(sb);
1386 static int ext3_check_descriptors(
struct super_block *sb)
1395 ext3_fsblk_t first_block = ext3_group_first_block_no(sb, i);
1401 last_block = first_block +
1408 "Block bitmap for group %d"
1409 " not in group (block %lu)!",
1418 "Inode bitmap for group %d"
1419 " not in group (block %lu)!",
1429 "Inode table for group %d"
1430 " not in group (block %lu)!",
1460 static void ext3_orphan_cleanup (
struct super_block * sb,
1464 int nr_orphans = 0, nr_truncates = 0;
1469 jbd_debug(4,
"no orphan inodes to clean up\n");
1475 "unavailable, skipping orphan cleanup.");
1482 "unknown ROCOMPAT features");
1490 "clearing orphan list.\n");
1493 jbd_debug(1,
"Skipping orphan recovery on fs with errors.\n");
1506 if (EXT3_SB(sb)->s_qf_names[i]) {
1507 int ret = ext3_quota_on_mount(sb, i);
1510 "error: cannot turn on journaled "
1517 struct inode *
inode;
1520 if (IS_ERR(inode)) {
1525 list_add(&EXT3_I(inode)->i_orphan, &EXT3_SB(sb)->s_orphan);
1529 "%s: truncating inode %lu to %Ld bytes\n",
1531 jbd_debug(2,
"truncating inode %lu to %Ld bytes\n",
1537 "%s: deleting unreferenced inode %lu\n",
1538 __func__, inode->
i_ino);
1539 jbd_debug(2,
"deleting unreferenced inode %lu\n",
1546 #define PLURAL(x) (x), ((x)==1) ? "" : "s"
1557 if (sb_dqopt(sb)->
files[i])
1569 static loff_t ext3_max_size(
int bits)
1582 upper_limit = (1
LL << 32) - 1;
1585 upper_limit >>= (bits - 9);
1591 meta_blocks += 1 + (1
LL << (bits-2));
1593 meta_blocks += 1 + (1
LL << (bits-2)) + (1
LL << (2*(bits-2)));
1595 upper_limit -= meta_blocks;
1596 upper_limit <<=
bits;
1599 res += 1
LL << (2*(
bits-2));
1600 res += 1
LL << (3*(
bits-2));
1602 if (res > upper_limit)
1605 if (res > MAX_LFS_FILESIZE)
1606 res = MAX_LFS_FILESIZE;
1616 unsigned long bg, first_meta_bg;
1623 return (logic_sb_block + nr + 1);
1627 return (has_super + ext3_group_first_block_no(sb, bg));
1631 static int ext3_fill_super (
struct super_block *sb,
void *data,
int silent)
1633 struct buffer_head * bh;
1639 unsigned long offset = 0;
1640 unsigned int journal_inum = 0;
1641 unsigned long journal_devnum = 0;
1642 unsigned long def_mount_opts;
1683 logic_sb_block = sb_block;
1686 if (!(bh = sb_bread(sb, logic_sb_block))) {
1704 if (def_mount_opts & EXT3_DEFM_BSDGROUPS)
1708 #ifdef CONFIG_EXT3_FS_XATTR
1709 if (def_mount_opts & EXT3_DEFM_XATTR_USER)
1712 #ifdef CONFIG_EXT3_FS_POSIX_ACL
1713 if (def_mount_opts & EXT3_DEFM_ACL)
1737 if (!parse_options ((
char *) data, sb, &journal_inum, &journal_devnum,
1749 "warning: feature flags set on rev 0 fs, "
1750 "running e2fsck is recommended");
1759 "error: couldn't mount because of unsupported "
1764 if (!(sb->
s_flags & MS_RDONLY) && features) {
1766 "error: couldn't mount RDWR because of unsupported "
1775 "error: couldn't mount because of unsupported "
1776 "filesystem blocksize %d", blocksize);
1780 hblock = bdev_logical_block_size(sb->
s_bdev);
1786 if (blocksize < hblock) {
1788 "error: fsblocksize %d too small for "
1789 "hardware sectorsize %d", blocksize, hblock);
1796 "error: bad blocksize %d", blocksize);
1801 bh = sb_bread(sb, logic_sb_block);
1804 "error: can't read superblock on 2nd try");
1811 "error: magic mismatch");
1828 "error: unsupported inode size: %d",
1837 "error: fragsize %lu != blocksize %u (unsupported)",
1857 for (i=0; i < 4; i++)
1864 #ifdef __CHAR_UNSIGNED__
1874 "#blocks per group too big: %lu",
1880 "error: #fragments per group too big: %lu",
1886 "error: #inodes per group too big: %lu",
1895 "error: filesystem is too large to mount safely");
1898 "error: CONFIG_LBDAF not enabled");
1913 "error: not enough memory");
1920 for (i = 0; i < db_count; i++) {
1921 block = descriptor_loc(sb, logic_sb_block, i);
1925 "error: can't read group descriptor %d", i);
1930 if (!ext3_check_descriptors (sb)) {
1932 "error: group descriptors corrupted");
1955 sb->
s_op = &ext3_sops;
1959 sb->
s_qcop = &ext3_qctl_operations;
1960 sb->
dq_op = &ext3_quota_operations;
1979 if (ext3_load_journal(sb, es, journal_devnum))
1981 }
else if (journal_inum) {
1982 if (ext3_create_journal(sb, es, journal_inum))
1987 "error: no journal found. "
1988 "mounting ext3 over ext2?");
2009 switch (
test_opt(sb, DATA_FLAGS)) {
2026 "error: journal does not support "
2027 "requested data journaling mode");
2042 ret = PTR_ERR(root);
2057 if (ext3_setup_super(sb, es, sb->
s_flags & MS_RDONLY))
2061 ext3_orphan_cleanup(sb, es);
2063 if (needs_recovery) {
2064 ext3_mark_recovery_complete(sb, es);
2077 "error: can't find ext3 filesystem on dev %s.",
2087 for (i = 0; i < db_count; i++)
2093 kfree(sbi->s_qf_names[i]);
2095 ext3_blkdev_remove(sbi);
2109 static void ext3_init_journal_params(
struct super_block *sb, journal_t *journal)
2119 spin_lock(&journal->j_state_lock);
2121 journal->j_flags |= JFS_BARRIER;
2123 journal->j_flags &= ~JFS_BARRIER;
2125 journal->j_flags |= JFS_ABORT_ON_SYNCDATA_ERR;
2127 journal->j_flags &= ~JFS_ABORT_ON_SYNCDATA_ERR;
2128 spin_unlock(&journal->j_state_lock);
2131 static journal_t *ext3_get_journal(
struct super_block *sb,
2132 unsigned int journal_inum)
2134 struct inode *journal_inode;
2141 journal_inode =
ext3_iget(sb, journal_inum);
2142 if (IS_ERR(journal_inode)) {
2146 if (!journal_inode->
i_nlink) {
2148 iput(journal_inode);
2153 jbd_debug(2,
"Journal inode found at %p: %Ld bytes\n",
2154 journal_inode, journal_inode->
i_size);
2157 iput(journal_inode);
2164 iput(journal_inode);
2167 journal->j_private =
sb;
2168 ext3_init_journal_params(sb, journal);
2172 static journal_t *ext3_get_dev_journal(
struct super_block *sb,
2175 struct buffer_head * bh;
2179 int hblock, blocksize;
2185 bdev = ext3_blkdev_get(j_dev, sb);
2190 hblock = bdev_logical_block_size(bdev);
2191 if (blocksize < hblock) {
2193 "error: blocksize too small for journal device");
2200 if (!(bh =
__bread(bdev, sb_block, blocksize))) {
2202 "external journal");
2216 if (
memcmp(EXT3_SB(sb)->s_es->s_journal_uuid, es->
s_uuid, 16)) {
2223 start = sb_block + 1;
2227 start, len, blocksize);
2230 "error: failed to create device journal");
2233 journal->j_private =
sb;
2240 if (
be32_to_cpu(journal->j_superblock->s_nr_users) != 1) {
2242 "error: external journal has more than one "
2243 "user (unsupported) - %d",
2247 EXT3_SB(sb)->journal_bdev = bdev;
2248 ext3_init_journal_params(sb, journal);
2253 ext3_blkdev_put(bdev);
2257 static int ext3_load_journal(
struct super_block *sb,
2259 unsigned long journal_devnum)
2265 int really_read_only;
2267 if (journal_devnum &&
2270 "numbers have changed");
2271 journal_dev = new_decode_dev(journal_devnum);
2284 if (sb->
s_flags & MS_RDONLY) {
2286 "recovery required on readonly filesystem");
2287 if (really_read_only) {
2289 "unavailable, cannot proceed");
2293 "write access will be enabled during recovery");
2297 if (journal_inum && journal_dev) {
2299 "and inode journals");
2304 if (!(journal = ext3_get_journal(sb, journal_inum)))
2307 if (!(journal = ext3_get_dev_journal(sb, journal_dev)))
2311 if (!(journal->j_flags & JFS_BARRIER))
2314 if (!really_read_only &&
test_opt(sb, UPDATE_JOURNAL)) {
2334 EXT3_SB(sb)->s_journal = journal;
2335 ext3_clear_journal_err(sb, es);
2337 if (!really_read_only && journal_devnum &&
2342 ext3_commit_super(sb, es, 1);
2348 static int ext3_create_journal(
struct super_block *sb,
2350 unsigned int journal_inum)
2355 if (sb->
s_flags & MS_RDONLY) {
2357 "error: readonly filesystem when trying to "
2362 journal = ext3_get_journal(sb, journal_inum);
2376 EXT3_SB(sb)->s_journal = journal;
2385 ext3_commit_super(sb, es, 1);
2390 static int ext3_commit_super(
struct super_block *sb,
2394 struct buffer_head *sbh = EXT3_SB(sb)->s_sbh;
2400 if (buffer_write_io_error(sbh)) {
2410 "superblock detected");
2411 clear_buffer_write_io_error(sbh);
2412 set_buffer_uptodate(sbh);
2424 if (!(sb->
s_flags & MS_RDONLY))
2428 BUFFER_TRACE(sbh,
"marking dirty");
2432 if (buffer_write_io_error(sbh)) {
2435 clear_buffer_write_io_error(sbh);
2436 set_buffer_uptodate(sbh);
2448 static void ext3_mark_recovery_complete(
struct super_block * sb,
2451 journal_t *journal = EXT3_SB(sb)->s_journal;
2460 ext3_commit_super(sb, es, 1);
2472 static void ext3_clear_journal_err(
struct super_block *sb,
2479 journal = EXT3_SB(sb)->s_journal;
2490 errstr = ext3_decode_error(sb, j_errno, nbuf);
2491 ext3_warning(sb, __func__,
"Filesystem error recorded "
2492 "from previous mount: %s", errstr);
2494 "filesystem check.");
2498 ext3_commit_super (sb, es, 1);
2516 journal = EXT3_SB(sb)->s_journal;
2517 ret = ext3_journal_force_commit(journal);
2521 static int ext3_sync_fs(
struct super_block *sb,
int wait)
2525 trace_ext3_sync_fs(sb, wait);
2547 if (!(sb->
s_flags & MS_RDONLY)) {
2548 journal = EXT3_SB(sb)->s_journal;
2563 error = ext3_commit_super(sb, EXT3_SB(sb)->s_es, 1);
2580 if (!(sb->
s_flags & MS_RDONLY)) {
2583 ext3_commit_super(sb, EXT3_SB(sb)->s_es, 1);
2589 static int ext3_remount (
struct super_block * sb,
int *
flags,
char * data)
2594 unsigned long old_sb_flags;
2596 int enable_quota = 0;
2609 old_opts.s_jquota_fmt = sbi->s_jquota_fmt;
2611 old_opts.s_qf_names[i] = sbi->s_qf_names[i];
2617 if (!parse_options(data, sb,
NULL,
NULL, &n_blocks_count, 1)) {
2623 ext3_abort(sb, __func__,
"Abort forced by user");
2630 ext3_init_journal_params(sb, sbi->
s_journal);
2632 if ((*flags & MS_RDONLY) != (sb->
s_flags & MS_RDONLY) ||
2639 if (*flags & MS_RDONLY) {
2640 err = dquot_suspend(sb, -1);
2659 ext3_mark_recovery_complete(sb, es);
2665 "warning: couldn't remount RDWR "
2666 "because of unsupported optional "
2679 "remount RDWR because of unprocessed "
2680 "orphan inode list. Please "
2681 "umount & mount instead.");
2692 ext3_clear_journal_err(sb, es);
2696 if (!ext3_setup_super (sb, es, 0))
2704 if (old_opts.s_qf_names[i] &&
2705 old_opts.s_qf_names[i] != sbi->s_qf_names[i])
2706 kfree(old_opts.s_qf_names[i]);
2718 sbi->s_jquota_fmt = old_opts.s_jquota_fmt;
2720 if (sbi->s_qf_names[i] &&
2721 old_opts.s_qf_names[i] != sbi->s_qf_names[i])
2722 kfree(sbi->s_qf_names[i]);
2723 sbi->s_qf_names[
i] = old_opts.s_qf_names[
i];
2760 for (i = 0; i < ngroups; i++) {
2789 buf->
f_fsid.
val[1] = (fsid >> 32) & 0xFFFFFFFFUL;
2805 static inline struct inode *dquot_to_inode(
struct dquot *
dquot)
2807 return sb_dqopt(dquot->
dq_sb)->files[dquot->
dq_id.type];
2810 static int ext3_write_dquot(
struct dquot *
dquot)
2814 struct inode *
inode;
2816 inode = dquot_to_inode(dquot);
2817 handle = ext3_journal_start(inode,
2820 return PTR_ERR(handle);
2828 static int ext3_acquire_dquot(
struct dquot *dquot)
2833 handle = ext3_journal_start(dquot_to_inode(dquot),
2836 return PTR_ERR(handle);
2844 static int ext3_release_dquot(
struct dquot *dquot)
2849 handle = ext3_journal_start(dquot_to_inode(dquot),
2851 if (IS_ERR(handle)) {
2854 return PTR_ERR(handle);
2863 static int ext3_mark_dquot_dirty(
struct dquot *dquot)
2869 return ext3_write_dquot(dquot);
2881 handle = ext3_journal_start(sb->
s_root->d_inode, 2);
2883 return PTR_ERR(handle);
2895 static int ext3_quota_on_mount(
struct super_block *sb,
int type)
2898 EXT3_SB(sb)->s_jquota_fmt, type);
2913 if (path->
dentry->d_sb != sb)
2916 if (EXT3_SB(sb)->s_qf_names[type]) {
2920 "warning: Quota file not on filesystem root. "
2921 "Journaled quota will not work.");
2928 if (ext3_should_journal_data(path->
dentry->d_inode)) {
2948 size_t len, loff_t off)
2950 struct inode *inode = sb_dqopt(sb)->files[
type];
2956 struct buffer_head *bh;
2957 loff_t i_size = i_size_read(inode);
2961 if (off+len > i_size)
2964 while (toread > 0) {
2973 memcpy(data, bh->b_data+offset, tocopy);
2986 const char *data,
size_t len, loff_t off)
2988 struct inode *inode = sb_dqopt(sb)->files[
type];
2992 int journal_quota = EXT3_SB(sb)->s_qf_names[
type] !=
NULL;
2993 struct buffer_head *bh;
2994 handle_t *handle = journal_current_handle();
2998 "warning: quota write (off=%llu, len=%llu)"
2999 " cancelled because transaction is not started.",
3000 (
unsigned long long)off, (
unsigned long long)len);
3010 " cancelled because not block aligned",
3011 (
unsigned long long)off, (
unsigned long long)len);
3014 bh =
ext3_bread(handle, inode, blk, 1, &err);
3017 if (journal_quota) {
3025 memcpy(bh->b_data+offset, data, len);
3039 if (inode->
i_size < off + len) {
3040 i_size_write(inode, off + len);
3041 EXT3_I(inode)->i_disksize = inode->
i_size;
3052 int flags,
const char *dev_name,
void *data)
3054 return mount_bdev(fs_type, flags, dev_name, data, ext3_fill_super);
3060 .mount = ext3_mount,
3065 static int __init init_ext3_fs(
void)
3070 err = init_inodecache();
3078 destroy_inodecache();
3084 static void __exit exit_ext3_fs(
void)
3087 destroy_inodecache();
3091 MODULE_AUTHOR(
"Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others");