~ubuntu-branches/ubuntu/edgy/xfsprogs/edgy

« back to all changes in this revision

Viewing changes to repair/phase3.c

  • Committer: Bazaar Package Importer
  • Author(s): Nathan Scott
  • Date: 2004-07-28 21:11:38 UTC
  • Revision ID: james.westby@ubuntu.com-20040728211138-0v4pdnunnp7na5lm
Tags: 2.6.20-1
* New upstream release.
* Fix xfs_io segfault on non-XFS files.  (closes: #260470)
* Fix packaging botch, deleted files included.  (closes: #260491)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
3
 
 * 
 
2
 * Copyright (c) 2000-2001 Silicon Graphics, Inc.  All Rights Reserved.
 
3
 *
4
4
 * This program is free software; you can redistribute it and/or modify it
5
5
 * under the terms of version 2 of the GNU General Public License as
6
6
 * published by the Free Software Foundation.
7
 
 * 
 
7
 *
8
8
 * This program is distributed in the hope that it would be useful, but
9
9
 * WITHOUT ANY WARRANTY; without even the implied warranty of
10
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11
 
 * 
 
11
 *
12
12
 * Further, this software is distributed without any warranty that it is
13
13
 * free of the rightful claim of any third person regarding infringement
14
14
 * or the like.  Any license provided herein, whether implied or
15
15
 * otherwise, applies only to this software file.  Patent licenses, if
16
16
 * any, provided herein do not apply to combinations of this program with
17
17
 * other software, or any other product whatsoever.
18
 
 * 
 
18
 *
19
19
 * You should have received a copy of the GNU General Public License along
20
20
 * with this program; if not, write the Free Software Foundation, Inc., 59
21
21
 * Temple Place - Suite 330, Boston MA 02111-1307, USA.
22
 
 * 
 
22
 *
23
23
 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24
24
 * Mountain View, CA  94043, or:
25
 
 * 
26
 
 * http://www.sgi.com 
27
 
 * 
28
 
 * For further information regarding this notice, see: 
29
 
 * 
 
25
 *
 
26
 * http://www.sgi.com
 
27
 *
 
28
 * For further information regarding this notice, see:
 
29
 *
30
30
 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31
31
 */
32
32
 
80
80
                                                XR_E_INO);
81
81
                                        break;
82
82
                                case XR_E_BAD_STATE:
83
 
                                        do_error(
84
 
                                                "bad state in block map %d\n",
 
83
                                        do_error(_(
 
84
                                                "bad state in block map %d\n"),
85
85
                                                state);
86
86
                                        abort();
87
87
                                        break;
120
120
        int err = 0;
121
121
        int agi_dirty = 0;
122
122
 
123
 
        bp = libxfs_readbuf(mp->m_dev, XFS_AG_DADDR(mp, agno, XFS_AGI_DADDR),
124
 
                                mp->m_sb.sb_sectsize/BBSIZE, 0);
125
 
        if (!bp) {
126
 
                do_error("cannot read agi block %lld for ag %u\n",
127
 
                        XFS_AG_DADDR(mp, agno, XFS_AGI_DADDR), agno);
128
 
                exit(1);
129
 
        }
 
123
        bp = libxfs_readbuf(mp->m_dev,
 
124
                        XFS_AG_DADDR(mp, agno, XFS_AGI_DADDR(mp)),
 
125
                        mp->m_sb.sb_sectsize/BBSIZE, 0);
 
126
        if (!bp)
 
127
                do_error(_("cannot read agi block %lld for ag %u\n"),
 
128
                        XFS_AG_DADDR(mp, agno, XFS_AGI_DADDR(mp)), agno);
130
129
 
131
130
        agip = XFS_BUF_TO_AGI(bp);
132
131
 
134
133
 
135
134
        for (i = 0; i < XFS_AGI_UNLINKED_BUCKETS; i++)  {
136
135
                if (INT_GET(agip->agi_unlinked[i], ARCH_CONVERT) != NULLAGINO)  {
137
 
                        err += walk_unlinked_list(mp, agno,
138
 
                                                INT_GET(agip->agi_unlinked[i], ARCH_CONVERT));
 
136
                        err += walk_unlinked_list(mp, agno, INT_GET(
 
137
                                        agip->agi_unlinked[i], ARCH_CONVERT));
139
138
                        /*
140
139
                         * clear the list
141
140
                         */
142
141
                        if (!no_modify)  {
143
 
                                INT_SET(agip->agi_unlinked[i], ARCH_CONVERT, NULLAGINO);
 
142
                                INT_SET(agip->agi_unlinked[i], ARCH_CONVERT,
 
143
                                        NULLAGINO);
144
144
                                agi_dirty = 1;
145
145
                        }
146
146
                }
147
147
        }
148
148
 
149
149
        if (err)
150
 
                do_warn("error following ag %d unlinked list\n", agno);
 
150
                do_warn(_("error following ag %d unlinked list\n"), agno);
151
151
 
152
152
        ASSERT(agi_dirty == 0 || (agi_dirty && !no_modify));
153
153
 
162
162
{
163
163
        int i, j;
164
164
 
165
 
        printf("Phase 3 - for each AG...\n");
 
165
        do_log(_("Phase 3 - for each AG...\n"));
166
166
        if (!no_modify)
167
 
                printf("        - scan and clear agi unlinked lists...\n");
 
167
                do_log(_("        - scan and clear agi unlinked lists...\n"));
168
168
        else
169
 
                printf("        - scan (but don't clear) agi unlinked lists...\n");
 
169
                do_log(_("        - scan (but don't clear) agi unlinked lists...\n"));
170
170
 
171
171
        /*
172
172
         * first, let's look at the possibly bogus inodes
181
181
 
182
182
        /* ok, now that the tree's ok, let's take a good look */
183
183
 
184
 
        printf(
185
 
            "        - process known inodes and perform inode discovery...\n");
 
184
        do_log(_(
 
185
            "        - process known inodes and perform inode discovery...\n"));
186
186
 
187
187
        for (i = 0; i < mp->m_sb.sb_agcount; i++)  {
188
 
                do_log("        - agno = %d\n", i);
 
188
                do_log(_("        - agno = %d\n"), i);
189
189
                /*
190
 
                 * turn on directory processing (inode discovery) and 
 
190
                 * turn on directory processing (inode discovery) and
191
191
                 * attribute processing (extra_attr_check)
192
192
                 */
193
193
                process_aginodes(mp, i, 1, 0, 1);
196
196
        /*
197
197
         * process newly discovered inode chunks
198
198
         */
199
 
        printf("        - process newly discovered inodes...\n");
 
199
        do_log(_("        - process newly discovered inodes...\n"));
200
200
        do  {
201
201
                /*
202
202
                 * have to loop until no ag has any uncertain
212
212
                }
213
213
        } while (j != 0);
214
214
}
215