segment.c (27e6c7a3ce29ae5fa5bec4ed5917f8508bfac120) segment.c (365e215ce1f154e288ff0f7c9acbdf5421f57949)
1/*
2 * segment.c - NILFS segment constructor.
3 *
4 * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or

--- 743 unchanged lines hidden (view full) ---

752 int ret = 0;
753
754 if (nilfs_mdt_fetch_dirty(root->ifile))
755 ret++;
756 if (nilfs_mdt_fetch_dirty(nilfs->ns_cpfile))
757 ret++;
758 if (nilfs_mdt_fetch_dirty(nilfs->ns_sufile))
759 ret++;
1/*
2 * segment.c - NILFS segment constructor.
3 *
4 * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or

--- 743 unchanged lines hidden (view full) ---

752 int ret = 0;
753
754 if (nilfs_mdt_fetch_dirty(root->ifile))
755 ret++;
756 if (nilfs_mdt_fetch_dirty(nilfs->ns_cpfile))
757 ret++;
758 if (nilfs_mdt_fetch_dirty(nilfs->ns_sufile))
759 ret++;
760 if (ret || nilfs_doing_gc())
761 if (nilfs_mdt_fetch_dirty(nilfs_dat_inode(nilfs)))
762 ret++;
760 if ((ret || nilfs_doing_gc()) && nilfs_mdt_fetch_dirty(nilfs->ns_dat))
761 ret++;
763 return ret;
764}
765
766static int nilfs_segctor_clean(struct nilfs_sc_info *sci)
767{
768 return list_empty(&sci->sc_dirty_files) &&
769 !test_bit(NILFS_SC_DIRTY, &sci->sc_flags) &&
770 sci->sc_nfreesegs == 0 &&

--- 19 unchanged lines hidden (view full) ---

790static void nilfs_segctor_clear_metadata_dirty(struct nilfs_sc_info *sci)
791{
792 struct nilfs_sb_info *sbi = sci->sc_sbi;
793 struct the_nilfs *nilfs = sbi->s_nilfs;
794
795 nilfs_mdt_clear_dirty(sci->sc_root->ifile);
796 nilfs_mdt_clear_dirty(nilfs->ns_cpfile);
797 nilfs_mdt_clear_dirty(nilfs->ns_sufile);
762 return ret;
763}
764
765static int nilfs_segctor_clean(struct nilfs_sc_info *sci)
766{
767 return list_empty(&sci->sc_dirty_files) &&
768 !test_bit(NILFS_SC_DIRTY, &sci->sc_flags) &&
769 sci->sc_nfreesegs == 0 &&

--- 19 unchanged lines hidden (view full) ---

789static void nilfs_segctor_clear_metadata_dirty(struct nilfs_sc_info *sci)
790{
791 struct nilfs_sb_info *sbi = sci->sc_sbi;
792 struct the_nilfs *nilfs = sbi->s_nilfs;
793
794 nilfs_mdt_clear_dirty(sci->sc_root->ifile);
795 nilfs_mdt_clear_dirty(nilfs->ns_cpfile);
796 nilfs_mdt_clear_dirty(nilfs->ns_sufile);
798 nilfs_mdt_clear_dirty(nilfs_dat_inode(nilfs));
797 nilfs_mdt_clear_dirty(nilfs->ns_dat);
799}
800
801static int nilfs_segctor_create_checkpoint(struct nilfs_sc_info *sci)
802{
803 struct the_nilfs *nilfs = sci->sc_sbi->s_nilfs;
804 struct buffer_head *bh_cp;
805 struct nilfs_checkpoint *raw_cp;
806 int err;

--- 92 unchanged lines hidden (view full) ---

899 raw_sr = (struct nilfs_super_root *)bh_sr->b_data;
900
901 raw_sr->sr_bytes = cpu_to_le16(NILFS_SR_BYTES);
902 raw_sr->sr_nongc_ctime
903 = cpu_to_le64(nilfs_doing_gc() ?
904 nilfs->ns_nongc_ctime : sci->sc_seg_ctime);
905 raw_sr->sr_flags = 0;
906
798}
799
800static int nilfs_segctor_create_checkpoint(struct nilfs_sc_info *sci)
801{
802 struct the_nilfs *nilfs = sci->sc_sbi->s_nilfs;
803 struct buffer_head *bh_cp;
804 struct nilfs_checkpoint *raw_cp;
805 int err;

--- 92 unchanged lines hidden (view full) ---

898 raw_sr = (struct nilfs_super_root *)bh_sr->b_data;
899
900 raw_sr->sr_bytes = cpu_to_le16(NILFS_SR_BYTES);
901 raw_sr->sr_nongc_ctime
902 = cpu_to_le64(nilfs_doing_gc() ?
903 nilfs->ns_nongc_ctime : sci->sc_seg_ctime);
904 raw_sr->sr_flags = 0;
905
907 nilfs_write_inode_common(nilfs_dat_inode(nilfs), (void *)raw_sr +
906 nilfs_write_inode_common(nilfs->ns_dat, (void *)raw_sr +
908 NILFS_SR_DAT_OFFSET(isz), 1);
909 nilfs_write_inode_common(nilfs->ns_cpfile, (void *)raw_sr +
910 NILFS_SR_CPFILE_OFFSET(isz), 1);
911 nilfs_write_inode_common(nilfs->ns_sufile, (void *)raw_sr +
912 NILFS_SR_SUFILE_OFFSET(isz), 1);
913}
914
915static void nilfs_redirty_inodes(struct list_head *head)

--- 239 unchanged lines hidden (view full) ---

1155
1156 err = nilfs_segctor_scan_file(sci, nilfs->ns_sufile,
1157 &nilfs_sc_file_ops);
1158 if (unlikely(err))
1159 break;
1160 sci->sc_stage.scnt++; /* Fall through */
1161 case NILFS_ST_DAT:
1162 dat_stage:
907 NILFS_SR_DAT_OFFSET(isz), 1);
908 nilfs_write_inode_common(nilfs->ns_cpfile, (void *)raw_sr +
909 NILFS_SR_CPFILE_OFFSET(isz), 1);
910 nilfs_write_inode_common(nilfs->ns_sufile, (void *)raw_sr +
911 NILFS_SR_SUFILE_OFFSET(isz), 1);
912}
913
914static void nilfs_redirty_inodes(struct list_head *head)

--- 239 unchanged lines hidden (view full) ---

1154
1155 err = nilfs_segctor_scan_file(sci, nilfs->ns_sufile,
1156 &nilfs_sc_file_ops);
1157 if (unlikely(err))
1158 break;
1159 sci->sc_stage.scnt++; /* Fall through */
1160 case NILFS_ST_DAT:
1161 dat_stage:
1163 err = nilfs_segctor_scan_file(sci, nilfs_dat_inode(nilfs),
1162 err = nilfs_segctor_scan_file(sci, nilfs->ns_dat,
1164 &nilfs_sc_dat_ops);
1165 if (unlikely(err))
1166 break;
1167 if (mode == SC_FLUSH_DAT) {
1168 sci->sc_stage.scnt = NILFS_ST_DONE;
1169 return 0;
1170 }
1171 sci->sc_stage.scnt++; /* Fall through */

--- 1670 unchanged lines hidden ---
1163 &nilfs_sc_dat_ops);
1164 if (unlikely(err))
1165 break;
1166 if (mode == SC_FLUSH_DAT) {
1167 sci->sc_stage.scnt = NILFS_ST_DONE;
1168 return 0;
1169 }
1170 sci->sc_stage.scnt++; /* Fall through */

--- 1670 unchanged lines hidden ---