aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/lops.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/lops.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/lops.c')
-rw-r--r--fs/gfs2/lops.c30
1 files changed, 13 insertions, 17 deletions
diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c
index e4c75a74df5b..a76f1a778920 100644
--- a/fs/gfs2/lops.c
+++ b/fs/gfs2/lops.c
@@ -184,8 +184,7 @@ static void buf_lo_after_commit(struct gfs2_sbd *sdp, struct gfs2_ail *ai)
184static void buf_lo_before_scan(struct gfs2_jdesc *jd, 184static void buf_lo_before_scan(struct gfs2_jdesc *jd,
185 struct gfs2_log_header *head, int pass) 185 struct gfs2_log_header *head, int pass)
186{ 186{
187 struct gfs2_inode *ip = jd->jd_inode->u.generic_ip; 187 struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode);
188 struct gfs2_sbd *sdp = ip->i_sbd;
189 188
190 if (pass != 0) 189 if (pass != 0)
191 return; 190 return;
@@ -198,8 +197,8 @@ static int buf_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start,
198 struct gfs2_log_descriptor *ld, __be64 *ptr, 197 struct gfs2_log_descriptor *ld, __be64 *ptr,
199 int pass) 198 int pass)
200{ 199{
201 struct gfs2_inode *ip = jd->jd_inode->u.generic_ip; 200 struct gfs2_inode *ip = GFS2_I(jd->jd_inode);
202 struct gfs2_sbd *sdp = ip->i_sbd; 201 struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode);
203 struct gfs2_glock *gl = ip->i_gl; 202 struct gfs2_glock *gl = ip->i_gl;
204 unsigned int blks = be32_to_cpu(ld->ld_data1); 203 unsigned int blks = be32_to_cpu(ld->ld_data1);
205 struct buffer_head *bh_log, *bh_ip; 204 struct buffer_head *bh_log, *bh_ip;
@@ -245,8 +244,8 @@ static int buf_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start,
245 244
246static void buf_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass) 245static void buf_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass)
247{ 246{
248 struct gfs2_inode *ip = jd->jd_inode->u.generic_ip; 247 struct gfs2_inode *ip = GFS2_I(jd->jd_inode);
249 struct gfs2_sbd *sdp = ip->i_sbd; 248 struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode);
250 249
251 if (error) { 250 if (error) {
252 gfs2_meta_sync(ip->i_gl, 251 gfs2_meta_sync(ip->i_gl,
@@ -332,8 +331,7 @@ static void revoke_lo_before_commit(struct gfs2_sbd *sdp)
332static void revoke_lo_before_scan(struct gfs2_jdesc *jd, 331static void revoke_lo_before_scan(struct gfs2_jdesc *jd,
333 struct gfs2_log_header *head, int pass) 332 struct gfs2_log_header *head, int pass)
334{ 333{
335 struct gfs2_inode *ip = jd->jd_inode->u.generic_ip; 334 struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode);
336 struct gfs2_sbd *sdp = ip->i_sbd;
337 335
338 if (pass != 0) 336 if (pass != 0)
339 return; 337 return;
@@ -346,8 +344,7 @@ static int revoke_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start,
346 struct gfs2_log_descriptor *ld, __be64 *ptr, 344 struct gfs2_log_descriptor *ld, __be64 *ptr,
347 int pass) 345 int pass)
348{ 346{
349 struct gfs2_inode *ip = jd->jd_inode->u.generic_ip; 347 struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode);
350 struct gfs2_sbd *sdp = ip->i_sbd;
351 unsigned int blks = be32_to_cpu(ld->ld_length); 348 unsigned int blks = be32_to_cpu(ld->ld_length);
352 unsigned int revokes = be32_to_cpu(ld->ld_data1); 349 unsigned int revokes = be32_to_cpu(ld->ld_data1);
353 struct buffer_head *bh; 350 struct buffer_head *bh;
@@ -393,8 +390,7 @@ static int revoke_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start,
393 390
394static void revoke_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass) 391static void revoke_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass)
395{ 392{
396 struct gfs2_inode *ip = jd->jd_inode->u.generic_ip; 393 struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode);
397 struct gfs2_sbd *sdp = ip->i_sbd;
398 394
399 if (error) { 395 if (error) {
400 gfs2_revoke_clean(sdp); 396 gfs2_revoke_clean(sdp);
@@ -465,7 +461,7 @@ static void databuf_lo_add(struct gfs2_sbd *sdp, struct gfs2_log_element *le)
465 struct gfs2_bufdata *bd = container_of(le, struct gfs2_bufdata, bd_le); 461 struct gfs2_bufdata *bd = container_of(le, struct gfs2_bufdata, bd_le);
466 struct gfs2_trans *tr = current->journal_info; 462 struct gfs2_trans *tr = current->journal_info;
467 struct address_space *mapping = bd->bd_bh->b_page->mapping; 463 struct address_space *mapping = bd->bd_bh->b_page->mapping;
468 struct gfs2_inode *ip = mapping->host->u.generic_ip; 464 struct gfs2_inode *ip = GFS2_I(mapping->host);
469 465
470 tr->tr_touched = 1; 466 tr->tr_touched = 1;
471 if (!list_empty(&bd->bd_list_tr) && 467 if (!list_empty(&bd->bd_list_tr) &&
@@ -665,8 +661,8 @@ static int databuf_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start,
665 struct gfs2_log_descriptor *ld, 661 struct gfs2_log_descriptor *ld,
666 __be64 *ptr, int pass) 662 __be64 *ptr, int pass)
667{ 663{
668 struct gfs2_inode *ip = jd->jd_inode->u.generic_ip; 664 struct gfs2_inode *ip = GFS2_I(jd->jd_inode);
669 struct gfs2_sbd *sdp = ip->i_sbd; 665 struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode);
670 struct gfs2_glock *gl = ip->i_gl; 666 struct gfs2_glock *gl = ip->i_gl;
671 unsigned int blks = be32_to_cpu(ld->ld_data1); 667 unsigned int blks = be32_to_cpu(ld->ld_data1);
672 struct buffer_head *bh_log, *bh_ip; 668 struct buffer_head *bh_log, *bh_ip;
@@ -716,8 +712,8 @@ static int databuf_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start,
716 712
717static void databuf_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass) 713static void databuf_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass)
718{ 714{
719 struct gfs2_inode *ip = jd->jd_inode->u.generic_ip; 715 struct gfs2_inode *ip = GFS2_I(jd->jd_inode);
720 struct gfs2_sbd *sdp = ip->i_sbd; 716 struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode);
721 717
722 if (error) { 718 if (error) {
723 gfs2_meta_sync(ip->i_gl, 719 gfs2_meta_sync(ip->i_gl,