11 #include <linux/sched.h>
12 #include <linux/slab.h>
23 #include <linux/time.h>
24 #include <linux/wait.h>
46 #define args_neq(a1, a2, x) ((a1)->ar_##x != (a2)->ar_##x)
144 o =
strsep(&options,
",");
179 "are mutually exclusive.\n");
231 printk(
KERN_WARNING "GFS2: commit mount option requires a positive numeric argument\n");
238 printk(
KERN_WARNING "GFS2: statfs_quantum mount option requires a non-negative numeric argument\n");
245 printk(
KERN_WARNING "GFS2: quota_quantum mount option requires a positive numeric argument\n");
253 printk(
KERN_WARNING "statfs_percent mount option requires a numeric argument between 0 and 100\n");
263 "are mutually exclusive.\n");
308 while (!list_empty(&list)) {
311 while (!list_empty(head)) {
359 if (gfs2_check_internal_file_size(jd->
jd_inode, 8 << 20, 1 << 30))
405 gfs2_log_pointers_init(sdp, head.
lh_blkno);
448 struct buffer_head *m_bh, *l_bh;
457 error = gfs2_meta_inode_buffer(m_ip, &m_bh);
461 if (sdp->
sd_args.ar_spectator) {
467 error = gfs2_meta_inode_buffer(l_ip, &l_bh);
494 struct buffer_head *l_bh;
499 error = gfs2_meta_inode_buffer(l_ip, &l_bh);
509 gfs2_statfs_change_out(l_sc, l_bh->b_data +
sizeof(
struct gfs2_dinode));
510 if (sdp->
sd_args.ar_statfs_percent) {
513 if (x >= y || x <= -y)
524 struct buffer_head *l_bh)
543 gfs2_statfs_change_out(m_sc, m_bh->b_data +
sizeof(
struct gfs2_dinode));
554 struct buffer_head *m_bh, *l_bh;
562 error = gfs2_meta_inode_buffer(m_ip, &m_bh);
575 error = gfs2_meta_inode_buffer(l_ip, &l_bh);
612 static int gfs2_lock_fs_check_clean(
struct gfs2_sbd *sdp,
657 while (!list_empty(&
list)) {
684 error = gfs2_lock_fs_check_clean(sdp, &sdp->
sd_freeze_gh);
762 struct gfs2_sbd *sdp = GFS2_SB(inode);
776 mark_inode_dirty_sync(inode);
793 static void gfs2_dirty_inode(
struct inode *inode,
int flags)
796 struct gfs2_sbd *sdp = GFS2_SB(inode);
797 struct buffer_head *bh;
800 int need_endtrans = 0;
806 if (!gfs2_glock_is_locked_by_me(ip->
i_gl)) {
809 fs_err(sdp,
"dirty_inode: glock %d\n", ret);
819 fs_err(sdp,
"dirty_inode: gfs2_trans_begin %d\n", ret);
825 ret = gfs2_meta_inode_buffer(ip, &bh);
846 static int gfs2_make_fs_ro(
struct gfs2_sbd *sdp)
873 static int gfs2_umount_recovery_wait(
void *
word)
919 error = gfs2_make_fs_ro(sdp);
935 if (!sdp->
sd_args.ar_spectator) {
994 fs_err(sdp,
"waiting for recovery before freeze\n");
998 fs_err(sdp,
"error freezing FS: %d\n", error);
1002 fs_err(sdp,
"retrying...\n");
1028 static int statfs_slow_fill(
struct gfs2_rgrpd *rgd,
1055 unsigned int slots = 64;
1070 for (x = 0; x <
slots; x++) {
1080 error = statfs_slow_fill(
1081 gh->
gh_gl->gl_object, sc);
1088 else if (rgd_next && !error) {
1089 error = gfs2_glock_nq_init(rgd_next->
rd_gl,
1163 error = gfs2_statfs_slow(sdp, &sc);
1165 error = gfs2_statfs_i(sdp, &sc);
1191 static int gfs2_remount_fs(
struct super_block *sb,
int *flags,
char *
data)
1222 if (sdp->
sd_args.ar_spectator)
1226 if (*flags & MS_RDONLY)
1227 error = gfs2_make_fs_ro(sdp);
1235 if (sdp->
sd_args.ar_posix_acl)
1239 if (sdp->
sd_args.ar_nobarrier)
1275 static int gfs2_drop_inode(
struct inode *inode)
1284 return generic_drop_inode(inode);
1287 static int is_ancestor(
const struct dentry *
d1,
const struct dentry *
d2)
1305 static int gfs2_show_options(
struct seq_file *
s,
struct dentry *root)
1351 state =
"writeback";
1364 val = sdp->
sd_tune.gt_logd_secs;
1367 val = sdp->
sd_tune.gt_statfs_quantum;
1370 else if (sdp->
sd_tune.gt_statfs_slow)
1372 val = sdp->
sd_tune.gt_quota_quantum;
1402 static void gfs2_final_release_pages(
struct gfs2_inode *ip)
1404 struct inode *inode = &ip->
i_inode;
1416 static int gfs2_dinode_dealloc(
struct gfs2_inode *ip)
1423 if (gfs2_get_inode_blocks(&ip->
i_inode) != 1) {
1450 goto out_rg_gunlock;
1454 gfs2_final_release_pages(ip);
1486 static void gfs2_evict_inode(
struct inode *inode)
1538 if (!gfs2_is_stuffed(ip)) {
1544 error = gfs2_dinode_dealloc(ip);
1567 if (gfs2_rs_active(ip->
i_res))
1575 fs_warn(sdp,
"gfs2_evict_inode: %d\n", error);
1593 static struct inode *gfs2_alloc_inode(
struct super_block *sb)
1607 static void gfs2_i_callback(
struct rcu_head *head)
1613 static void gfs2_destroy_inode(
struct inode *inode)
1619 .alloc_inode = gfs2_alloc_inode,
1620 .destroy_inode = gfs2_destroy_inode,
1621 .write_inode = gfs2_write_inode,
1622 .dirty_inode = gfs2_dirty_inode,
1623 .evict_inode = gfs2_evict_inode,
1624 .put_super = gfs2_put_super,
1625 .sync_fs = gfs2_sync_fs,
1626 .freeze_fs = gfs2_freeze,
1627 .unfreeze_fs = gfs2_unfreeze,
1628 .statfs = gfs2_statfs,
1629 .remount_fs = gfs2_remount_fs,
1630 .drop_inode = gfs2_drop_inode,
1631 .show_options = gfs2_show_options,