X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=fs%2Fgfs2%2Flops.c;h=f8f6d4b56a0195fb546f669c1e5a227c9e607c70;hb=a67cdbd4579c387c021a17c7447da8b88f2a94f4;hp=08de8b7fb31622b27f8aedda0dfd0e884dfbb512;hpb=83b7a664a0c7c39ccfa4c72535dc1c001d4e7a18;p=linux-2.6 diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c index 08de8b7fb3..f8f6d4b56a 100644 --- a/fs/gfs2/lops.c +++ b/fs/gfs2/lops.c @@ -4,7 +4,7 @@ * * This copyrighted material is made available to anyone wishing to use, * modify, copy, or redistribute it subject to the terms and conditions - * of the GNU General Public License v.2. + * of the GNU General Public License version 2. */ #include @@ -118,7 +118,7 @@ static void buf_lo_before_commit(struct gfs2_sbd *sdp) unsigned n; __be64 *ptr; - offset += (sizeof(__be64) - 1); + offset += sizeof(__be64) - 1; offset &= ~(sizeof(__be64) - 1); limit = (sdp->sd_sb.sb_bsize - offset)/sizeof(__be64); /* for 4k blocks, limit = 503 */ @@ -202,7 +202,7 @@ static int buf_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start, struct gfs2_glock *gl = ip->i_gl; unsigned int blks = be32_to_cpu(ld->ld_data1); struct buffer_head *bh_log, *bh_ip; - uint64_t blkno; + u64 blkno; int error = 0; if (pass != 1 || be32_to_cpu(ld->ld_type) != GFS2_LOG_DESC_METADATA) @@ -219,8 +219,8 @@ static int buf_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start, continue; error = gfs2_replay_read_block(jd, start, &bh_log); - if (error) - return error; + if (error) + return error; bh_ip = gfs2_meta_new(gl, blkno); memcpy(bh_ip->b_data, bh_log->b_data, bh_log->b_size); @@ -248,8 +248,7 @@ static void buf_lo_after_scan(struct gfs2_jdesc *jd, int error, int pass) struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode); if (error) { - gfs2_meta_sync(ip->i_gl, - DIO_START | DIO_WAIT); + gfs2_meta_sync(ip->i_gl, DIO_START | DIO_WAIT); return; } if (pass != 1) @@ -294,7 +293,7 @@ static void revoke_lo_before_commit(struct gfs2_sbd *sdp) ld->ld_header.mh_format = cpu_to_be32(GFS2_FORMAT_LD); ld->ld_type = cpu_to_be32(GFS2_LOG_DESC_REVOKE); ld->ld_length = cpu_to_be32(gfs2_struct2blk(sdp, sdp->sd_log_num_revoke, - sizeof(uint64_t))); + sizeof(u64))); ld->ld_data1 = cpu_to_be32(sdp->sd_log_num_revoke); ld->ld_data2 = cpu_to_be32(0); memset(ld->ld_reserved, 0, sizeof(ld->ld_reserved)); @@ -305,7 +304,7 @@ static void revoke_lo_before_commit(struct gfs2_sbd *sdp) list_del_init(&rv->rv_le.le_list); sdp->sd_log_num_revoke--; - if (offset + sizeof(uint64_t) > sdp->sd_sb.sb_bsize) { + if (offset + sizeof(u64) > sdp->sd_sb.sb_bsize) { set_buffer_dirty(bh); ll_rw_block(WRITE, 1, &bh); @@ -320,7 +319,7 @@ static void revoke_lo_before_commit(struct gfs2_sbd *sdp) *(__be64 *)(bh->b_data + offset) = cpu_to_be64(rv->rv_blkno); kfree(rv); - offset += sizeof(uint64_t); + offset += sizeof(u64); } gfs2_assert_withdraw(sdp, !sdp->sd_log_num_revoke); @@ -349,7 +348,7 @@ static int revoke_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start, unsigned int revokes = be32_to_cpu(ld->ld_data1); struct buffer_head *bh; unsigned int offset; - uint64_t blkno; + u64 blkno; int first = 1; int error; @@ -366,7 +365,7 @@ static int revoke_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start, if (!first) gfs2_metatype_check(sdp, bh, GFS2_METATYPE_LB); - while (offset + sizeof(uint64_t) <= sdp->sd_sb.sb_bsize) { + while (offset + sizeof(u64) <= sdp->sd_sb.sb_bsize) { blkno = be64_to_cpu(*(__be64 *)(bh->b_data + offset)); error = gfs2_revoke_add(sdp, blkno, start); @@ -377,7 +376,7 @@ static int revoke_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start, if (!--revokes) break; - offset += sizeof(uint64_t); + offset += sizeof(u64); } brelse(bh); @@ -519,7 +518,7 @@ static void databuf_lo_before_commit(struct gfs2_sbd *sdp) unsigned int num, n; __be64 *ptr = NULL; - offset += (2*sizeof(__be64) - 1); + offset += 2*sizeof(__be64) - 1; offset &= ~(2*sizeof(__be64) - 1); limit = (sdp->sd_sb.sb_bsize - offset)/sizeof(__be64); @@ -592,6 +591,17 @@ static void databuf_lo_before_commit(struct gfs2_sbd *sdp) gfs2_log_lock(sdp); if (n++ > num) break; + } else if (!bd1->bd_bh) { + total_dbuf--; + sdp->sd_log_num_databuf--; + list_del_init(&bd1->bd_le.le_list); + if (bd1 == bd2) { + bd2 = NULL; + bd2 = list_prepare_entry(bd2, + &sdp->sd_log_le_databuf, + bd_le.le_list); + } + kmem_cache_free(gfs2_bufdata_cachep, bd1); } } gfs2_log_unlock(sdp); @@ -666,8 +676,8 @@ static int databuf_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start, struct gfs2_glock *gl = ip->i_gl; unsigned int blks = be32_to_cpu(ld->ld_data1); struct buffer_head *bh_log, *bh_ip; - uint64_t blkno; - uint64_t esc; + u64 blkno; + u64 esc; int error = 0; if (pass != 1 || be32_to_cpu(ld->ld_type) != GFS2_LOG_DESC_JDATA) @@ -750,7 +760,7 @@ static void databuf_lo_after_commit(struct gfs2_sbd *sdp, struct gfs2_ail *ai) const struct gfs2_log_operations gfs2_glock_lops = { .lo_add = glock_lo_add, .lo_after_commit = glock_lo_after_commit, - .lo_name = "glock" + .lo_name = "glock", }; const struct gfs2_log_operations gfs2_buf_lops = { @@ -761,7 +771,7 @@ const struct gfs2_log_operations gfs2_buf_lops = { .lo_before_scan = buf_lo_before_scan, .lo_scan_elements = buf_lo_scan_elements, .lo_after_scan = buf_lo_after_scan, - .lo_name = "buf" + .lo_name = "buf", }; const struct gfs2_log_operations gfs2_revoke_lops = { @@ -770,13 +780,13 @@ const struct gfs2_log_operations gfs2_revoke_lops = { .lo_before_scan = revoke_lo_before_scan, .lo_scan_elements = revoke_lo_scan_elements, .lo_after_scan = revoke_lo_after_scan, - .lo_name = "revoke" + .lo_name = "revoke", }; const struct gfs2_log_operations gfs2_rg_lops = { .lo_add = rg_lo_add, .lo_after_commit = rg_lo_after_commit, - .lo_name = "rg" + .lo_name = "rg", }; const struct gfs2_log_operations gfs2_databuf_lops = { @@ -786,7 +796,7 @@ const struct gfs2_log_operations gfs2_databuf_lops = { .lo_after_commit = databuf_lo_after_commit, .lo_scan_elements = databuf_lo_scan_elements, .lo_after_scan = databuf_lo_after_scan, - .lo_name = "databuf" + .lo_name = "databuf", }; const struct gfs2_log_operations *gfs2_log_ops[] = { @@ -795,6 +805,6 @@ const struct gfs2_log_operations *gfs2_log_ops[] = { &gfs2_revoke_lops, &gfs2_rg_lops, &gfs2_databuf_lops, - NULL + NULL, };