aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/recovery.c
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2006-06-14 15:32:57 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2006-06-14 15:32:57 -0400
commitfeaa7bba026c181ce071d5a4884f7f9dd26207a1 (patch)
treec858deb225917265cb07820730e9764674d133e8 /fs/gfs2/recovery.c
parent22da645fd6675b7abc55cf937ddf6132f343e5b9 (diff)
[GFS2] Fix unlinked file handling
This patch fixes the way we have been dealing with unlinked, but still open files. It removes all limits (other than memory for inodes, as per every other filesystem) on numbers of these which we can support on GFS2. It also means that (like other fs) its the responsibility of the last process to close the file to deallocate the storage, rather than the person who did the unlinking. Note that with GFS2, those two events might take place on different nodes. Also there are a number of other changes: o We use the Linux inode subsystem as it was intended to be used, wrt allocating GFS2 inodes o The Linux inode cache is now the point which we use for local enforcement of only holding one copy of the inode in core at once (previous to this we used the glock layer). o We no longer use the unlinked "special" file. We just ignore it completely. This makes unlinking more efficient. o We now use the 4th block allocation state. The previously unused state is used to track unlinked but still open inodes. o gfs2_inoded is no longer needed o Several fields are now no longer needed (and removed) from the in core struct gfs2_inode o Several fields are no longer needed (and removed) from the in core superblock There are a number of future possible optimisations and clean ups which have been made possible by this patch. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/recovery.c')
-rw-r--r--fs/gfs2/recovery.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/fs/gfs2/recovery.c b/fs/gfs2/recovery.c
index c504ac1b831d..7aabc03e4abd 100644
--- a/fs/gfs2/recovery.c
+++ b/fs/gfs2/recovery.c
@@ -32,14 +32,14 @@
32int gfs2_replay_read_block(struct gfs2_jdesc *jd, unsigned int blk, 32int gfs2_replay_read_block(struct gfs2_jdesc *jd, unsigned int blk,
33 struct buffer_head **bh) 33 struct buffer_head **bh)
34{ 34{
35 struct gfs2_inode *ip = jd->jd_inode->u.generic_ip; 35 struct gfs2_inode *ip = GFS2_I(jd->jd_inode);
36 struct gfs2_glock *gl = ip->i_gl; 36 struct gfs2_glock *gl = ip->i_gl;
37 int new = 0; 37 int new = 0;
38 uint64_t dblock; 38 uint64_t dblock;
39 uint32_t extlen; 39 uint32_t extlen;
40 int error; 40 int error;
41 41
42 error = gfs2_extent_map(ip->i_vnode, blk, &new, &dblock, &extlen); 42 error = gfs2_extent_map(&ip->i_inode, blk, &new, &dblock, &extlen);
43 if (error) 43 if (error)
44 return error; 44 return error;
45 if (!dblock) { 45 if (!dblock) {
@@ -190,7 +190,7 @@ static int find_good_lh(struct gfs2_jdesc *jd, unsigned int *blk,
190 *blk = 0; 190 *blk = 0;
191 191
192 if (*blk == orig_blk) { 192 if (*blk == orig_blk) {
193 gfs2_consist_inode(jd->jd_inode->u.generic_ip); 193 gfs2_consist_inode(GFS2_I(jd->jd_inode));
194 return -EIO; 194 return -EIO;
195 } 195 }
196 } 196 }
@@ -224,7 +224,7 @@ static int jhead_scan(struct gfs2_jdesc *jd, struct gfs2_log_header *head)
224 continue; 224 continue;
225 225
226 if (lh.lh_sequence == head->lh_sequence) { 226 if (lh.lh_sequence == head->lh_sequence) {
227 gfs2_consist_inode(jd->jd_inode->u.generic_ip); 227 gfs2_consist_inode(GFS2_I(jd->jd_inode));
228 return -EIO; 228 return -EIO;
229 } 229 }
230 if (lh.lh_sequence < head->lh_sequence) 230 if (lh.lh_sequence < head->lh_sequence)
@@ -300,8 +300,7 @@ int gfs2_find_jhead(struct gfs2_jdesc *jd, struct gfs2_log_header *head)
300static int foreach_descriptor(struct gfs2_jdesc *jd, unsigned int start, 300static int foreach_descriptor(struct gfs2_jdesc *jd, unsigned int start,
301 unsigned int end, int pass) 301 unsigned int end, int pass)
302{ 302{
303 struct gfs2_inode *ip = jd->jd_inode->u.generic_ip; 303 struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode);
304 struct gfs2_sbd *sdp = ip->i_sbd;
305 struct buffer_head *bh; 304 struct buffer_head *bh;
306 struct gfs2_log_descriptor *ld; 305 struct gfs2_log_descriptor *ld;
307 int error = 0; 306 int error = 0;
@@ -330,7 +329,7 @@ static int foreach_descriptor(struct gfs2_jdesc *jd, unsigned int start,
330 continue; 329 continue;
331 } 330 }
332 if (error == 1) { 331 if (error == 1) {
333 gfs2_consist_inode(jd->jd_inode->u.generic_ip); 332 gfs2_consist_inode(GFS2_I(jd->jd_inode));
334 error = -EIO; 333 error = -EIO;
335 } 334 }
336 brelse(bh); 335 brelse(bh);
@@ -367,8 +366,8 @@ static int foreach_descriptor(struct gfs2_jdesc *jd, unsigned int start,
367 366
368static int clean_journal(struct gfs2_jdesc *jd, struct gfs2_log_header *head) 367static int clean_journal(struct gfs2_jdesc *jd, struct gfs2_log_header *head)
369{ 368{
370 struct gfs2_inode *ip = jd->jd_inode->u.generic_ip; 369 struct gfs2_inode *ip = GFS2_I(jd->jd_inode);
371 struct gfs2_sbd *sdp = ip->i_sbd; 370 struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode);
372 unsigned int lblock; 371 unsigned int lblock;
373 int new = 0; 372 int new = 0;
374 uint64_t dblock; 373 uint64_t dblock;
@@ -380,7 +379,7 @@ static int clean_journal(struct gfs2_jdesc *jd, struct gfs2_log_header *head)
380 379
381 lblock = head->lh_blkno; 380 lblock = head->lh_blkno;
382 gfs2_replay_incr_blk(sdp, &lblock); 381 gfs2_replay_incr_blk(sdp, &lblock);
383 error = gfs2_block_map(ip->i_vnode, lblock, &new, &dblock, &boundary); 382 error = gfs2_block_map(&ip->i_inode, lblock, &new, &dblock, &boundary);
384 if (error) 383 if (error)
385 return error; 384 return error;
386 if (!dblock) { 385 if (!dblock) {
@@ -426,8 +425,8 @@ static int clean_journal(struct gfs2_jdesc *jd, struct gfs2_log_header *head)
426 425
427int gfs2_recover_journal(struct gfs2_jdesc *jd) 426int gfs2_recover_journal(struct gfs2_jdesc *jd)
428{ 427{
429 struct gfs2_inode *ip = jd->jd_inode->u.generic_ip; 428 struct gfs2_inode *ip = GFS2_I(jd->jd_inode);
430 struct gfs2_sbd *sdp = ip->i_sbd; 429 struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode);
431 struct gfs2_log_header head; 430 struct gfs2_log_header head;
432 struct gfs2_holder j_gh, ji_gh, t_gh; 431 struct gfs2_holder j_gh, ji_gh, t_gh;
433 unsigned long t; 432 unsigned long t;