Commit a62aa6f7 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'gfs2-for-5.6' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2

Pull gfs2 updates from Andreas Gruenbacher:

 - Fix some corner cases on filesystems with a block size < page size.

 - Fix a corner case that could expose incorrect access times over nfs.

 - Revert an otherwise sensible revoke accounting cleanup that causes
   assertion failures. The revoke accounting is whacky and needs to be
   fixed properly before we can add back this cleanup.

 - Various other minor cleanups.

In addition, please expect to see another pull request from Bob Peterson
about his gfs2 recovery patch queue shortly.

* tag 'gfs2-for-5.6' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2:
  Revert "gfs2: eliminate tr_num_revoke_rm"
  gfs2: remove unused LBIT macros
  fs/gfs2: remove unused IS_DINODE and IS_LEAF macros
  gfs2: Remove GFS2_MIN_LVB_SIZE define
  gfs2: Fix incorrect variable name
  gfs2: Avoid access time thrashing in gfs2_inode_lookup
  gfs2: minor cleanup: remove unneeded variable ret in gfs2_jdata_writepage
  gfs2: eliminate ssize parameter from gfs2_struct2blk
  gfs2: Another gfs2_find_jhead fix
parents 677b60dc a31b4ec5
...@@ -183,14 +183,12 @@ static int gfs2_jdata_writepage(struct page *page, struct writeback_control *wbc ...@@ -183,14 +183,12 @@ static int gfs2_jdata_writepage(struct page *page, struct writeback_control *wbc
struct inode *inode = page->mapping->host; struct inode *inode = page->mapping->host;
struct gfs2_inode *ip = GFS2_I(inode); struct gfs2_inode *ip = GFS2_I(inode);
struct gfs2_sbd *sdp = GFS2_SB(inode); struct gfs2_sbd *sdp = GFS2_SB(inode);
int ret;
if (gfs2_assert_withdraw(sdp, gfs2_glock_is_held_excl(ip->i_gl))) if (gfs2_assert_withdraw(sdp, gfs2_glock_is_held_excl(ip->i_gl)))
goto out; goto out;
if (PageChecked(page) || current->journal_info) if (PageChecked(page) || current->journal_info)
goto out_ignore; goto out_ignore;
ret = __gfs2_jdata_writepage(page, wbc); return __gfs2_jdata_writepage(page, wbc);
return ret;
out_ignore: out_ignore:
redirty_page_for_writepage(wbc, page); redirty_page_for_writepage(wbc, page);
......
...@@ -73,9 +73,6 @@ ...@@ -73,9 +73,6 @@
#include "bmap.h" #include "bmap.h"
#include "util.h" #include "util.h"
#define IS_LEAF 1 /* Hashed (leaf) directory */
#define IS_DINODE 2 /* Linear (stuffed dinode block) directory */
#define MAX_RA_BLOCKS 32 /* max read-ahead blocks */ #define MAX_RA_BLOCKS 32 /* max read-ahead blocks */
#define gfs2_disk_hash2offset(h) (((u64)(h)) >> 1) #define gfs2_disk_hash2offset(h) (((u64)(h)) >> 1)
......
...@@ -826,7 +826,7 @@ int gfs2_glock_get(struct gfs2_sbd *sdp, u64 number, ...@@ -826,7 +826,7 @@ int gfs2_glock_get(struct gfs2_sbd *sdp, u64 number,
memset(&gl->gl_lksb, 0, sizeof(struct dlm_lksb)); memset(&gl->gl_lksb, 0, sizeof(struct dlm_lksb));
if (glops->go_flags & GLOF_LVB) { if (glops->go_flags & GLOF_LVB) {
gl->gl_lksb.sb_lvbptr = kzalloc(GFS2_MIN_LVB_SIZE, GFP_NOFS); gl->gl_lksb.sb_lvbptr = kzalloc(GDLM_LVB_SIZE, GFP_NOFS);
if (!gl->gl_lksb.sb_lvbptr) { if (!gl->gl_lksb.sb_lvbptr) {
kmem_cache_free(cachep, gl); kmem_cache_free(cachep, gl);
return -ENOMEM; return -ENOMEM;
......
...@@ -95,7 +95,7 @@ static void gfs2_ail_empty_gl(struct gfs2_glock *gl) ...@@ -95,7 +95,7 @@ static void gfs2_ail_empty_gl(struct gfs2_glock *gl)
/* A shortened, inline version of gfs2_trans_begin() /* A shortened, inline version of gfs2_trans_begin()
* tr->alloced is not set since the transaction structure is * tr->alloced is not set since the transaction structure is
* on the stack */ * on the stack */
tr.tr_reserved = 1 + gfs2_struct2blk(sdp, tr.tr_revokes, sizeof(u64)); tr.tr_reserved = 1 + gfs2_struct2blk(sdp, tr.tr_revokes);
tr.tr_ip = _RET_IP_; tr.tr_ip = _RET_IP_;
if (gfs2_log_reserve(sdp, tr.tr_reserved) < 0) if (gfs2_log_reserve(sdp, tr.tr_reserved) < 0)
return; return;
......
...@@ -387,8 +387,6 @@ struct gfs2_glock { ...@@ -387,8 +387,6 @@ struct gfs2_glock {
struct rhash_head gl_node; struct rhash_head gl_node;
}; };
#define GFS2_MIN_LVB_SIZE 32 /* Min size of LVB that gfs2 supports */
enum { enum {
GIF_INVALID = 0, GIF_INVALID = 0,
GIF_QD_LOCKED = 1, GIF_QD_LOCKED = 1,
...@@ -505,6 +503,7 @@ struct gfs2_trans { ...@@ -505,6 +503,7 @@ struct gfs2_trans {
unsigned int tr_num_buf_rm; unsigned int tr_num_buf_rm;
unsigned int tr_num_databuf_rm; unsigned int tr_num_databuf_rm;
unsigned int tr_num_revoke; unsigned int tr_num_revoke;
unsigned int tr_num_revoke_rm;
struct list_head tr_list; struct list_head tr_list;
struct list_head tr_databuf; struct list_head tr_databuf;
...@@ -703,6 +702,7 @@ struct gfs2_sbd { ...@@ -703,6 +702,7 @@ struct gfs2_sbd {
u32 sd_fsb2bb_shift; u32 sd_fsb2bb_shift;
u32 sd_diptrs; /* Number of pointers in a dinode */ u32 sd_diptrs; /* Number of pointers in a dinode */
u32 sd_inptrs; /* Number of pointers in a indirect block */ u32 sd_inptrs; /* Number of pointers in a indirect block */
u32 sd_ldptrs; /* Number of pointers in a log descriptor block */
u32 sd_jbsize; /* Size of a journaled data block */ u32 sd_jbsize; /* Size of a journaled data block */
u32 sd_hash_bsize; /* sizeof(exhash block) */ u32 sd_hash_bsize; /* sizeof(exhash block) */
u32 sd_hash_bsize_shift; u32 sd_hash_bsize_shift;
...@@ -803,7 +803,7 @@ struct gfs2_sbd { ...@@ -803,7 +803,7 @@ struct gfs2_sbd {
struct gfs2_trans *sd_log_tr; struct gfs2_trans *sd_log_tr;
unsigned int sd_log_blks_reserved; unsigned int sd_log_blks_reserved;
int sd_log_commited_revoke; int sd_log_committed_revoke;
atomic_t sd_log_pinned; atomic_t sd_log_pinned;
unsigned int sd_log_num_revoke; unsigned int sd_log_num_revoke;
......
...@@ -136,7 +136,6 @@ struct inode *gfs2_inode_lookup(struct super_block *sb, unsigned int type, ...@@ -136,7 +136,6 @@ struct inode *gfs2_inode_lookup(struct super_block *sb, unsigned int type,
if (inode->i_state & I_NEW) { if (inode->i_state & I_NEW) {
struct gfs2_sbd *sdp = GFS2_SB(inode); struct gfs2_sbd *sdp = GFS2_SB(inode);
ip->i_no_formal_ino = no_formal_ino;
error = gfs2_glock_get(sdp, no_addr, &gfs2_inode_glops, CREATE, &ip->i_gl); error = gfs2_glock_get(sdp, no_addr, &gfs2_inode_glops, CREATE, &ip->i_gl);
if (unlikely(error)) if (unlikely(error))
...@@ -175,21 +174,22 @@ struct inode *gfs2_inode_lookup(struct super_block *sb, unsigned int type, ...@@ -175,21 +174,22 @@ struct inode *gfs2_inode_lookup(struct super_block *sb, unsigned int type,
gfs2_glock_put(io_gl); gfs2_glock_put(io_gl);
io_gl = NULL; io_gl = NULL;
/* Lowest possible timestamp; will be overwritten in gfs2_dinode_in. */
inode->i_atime.tv_sec = 1LL << (8 * sizeof(inode->i_atime.tv_sec) - 1);
inode->i_atime.tv_nsec = 0;
if (type == DT_UNKNOWN) { if (type == DT_UNKNOWN) {
/* Inode glock must be locked already */ /* Inode glock must be locked already */
error = gfs2_inode_refresh(GFS2_I(inode)); error = gfs2_inode_refresh(GFS2_I(inode));
if (error) if (error)
goto fail_refresh; goto fail_refresh;
} else { } else {
ip->i_no_formal_ino = no_formal_ino;
inode->i_mode = DT2IF(type); inode->i_mode = DT2IF(type);
} }
gfs2_set_iop(inode); gfs2_set_iop(inode);
/* Lowest possible timestamp; will be overwritten in gfs2_dinode_in. */
inode->i_atime.tv_sec = 1LL << (8 * sizeof(inode->i_atime.tv_sec) - 1);
inode->i_atime.tv_nsec = 0;
unlock_new_inode(inode); unlock_new_inode(inode);
} }
......
...@@ -37,7 +37,6 @@ static void gfs2_log_shutdown(struct gfs2_sbd *sdp); ...@@ -37,7 +37,6 @@ static void gfs2_log_shutdown(struct gfs2_sbd *sdp);
* gfs2_struct2blk - compute stuff * gfs2_struct2blk - compute stuff
* @sdp: the filesystem * @sdp: the filesystem
* @nstruct: the number of structures * @nstruct: the number of structures
* @ssize: the size of the structures
* *
* Compute the number of log descriptor blocks needed to hold a certain number * Compute the number of log descriptor blocks needed to hold a certain number
* of structures of a certain size. * of structures of a certain size.
...@@ -45,18 +44,16 @@ static void gfs2_log_shutdown(struct gfs2_sbd *sdp); ...@@ -45,18 +44,16 @@ static void gfs2_log_shutdown(struct gfs2_sbd *sdp);
* Returns: the number of blocks needed (minimum is always 1) * Returns: the number of blocks needed (minimum is always 1)
*/ */
unsigned int gfs2_struct2blk(struct gfs2_sbd *sdp, unsigned int nstruct, unsigned int gfs2_struct2blk(struct gfs2_sbd *sdp, unsigned int nstruct)
unsigned int ssize)
{ {
unsigned int blks; unsigned int blks;
unsigned int first, second; unsigned int first, second;
blks = 1; blks = 1;
first = (sdp->sd_sb.sb_bsize - sizeof(struct gfs2_log_descriptor)) / ssize; first = sdp->sd_ldptrs;
if (nstruct > first) { if (nstruct > first) {
second = (sdp->sd_sb.sb_bsize - second = sdp->sd_inptrs;
sizeof(struct gfs2_meta_header)) / ssize;
blks += DIV_ROUND_UP(nstruct - first, second); blks += DIV_ROUND_UP(nstruct - first, second);
} }
...@@ -472,9 +469,8 @@ static unsigned int calc_reserved(struct gfs2_sbd *sdp) ...@@ -472,9 +469,8 @@ static unsigned int calc_reserved(struct gfs2_sbd *sdp)
reserved += DIV_ROUND_UP(dbuf, databuf_limit(sdp)); reserved += DIV_ROUND_UP(dbuf, databuf_limit(sdp));
} }
if (sdp->sd_log_commited_revoke > 0) if (sdp->sd_log_committed_revoke > 0)
reserved += gfs2_struct2blk(sdp, sdp->sd_log_commited_revoke, reserved += gfs2_struct2blk(sdp, sdp->sd_log_committed_revoke);
sizeof(u64));
/* One for the overall header */ /* One for the overall header */
if (reserved) if (reserved)
reserved++; reserved++;
...@@ -829,7 +825,7 @@ void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl, u32 flags) ...@@ -829,7 +825,7 @@ void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl, u32 flags)
if (unlikely(state == SFS_FROZEN)) if (unlikely(state == SFS_FROZEN))
gfs2_assert_withdraw(sdp, !sdp->sd_log_num_revoke); gfs2_assert_withdraw(sdp, !sdp->sd_log_num_revoke);
gfs2_assert_withdraw(sdp, gfs2_assert_withdraw(sdp,
sdp->sd_log_num_revoke == sdp->sd_log_commited_revoke); sdp->sd_log_num_revoke == sdp->sd_log_committed_revoke);
gfs2_ordered_write(sdp); gfs2_ordered_write(sdp);
lops_before_commit(sdp, tr); lops_before_commit(sdp, tr);
...@@ -848,7 +844,7 @@ void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl, u32 flags) ...@@ -848,7 +844,7 @@ void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl, u32 flags)
gfs2_log_lock(sdp); gfs2_log_lock(sdp);
sdp->sd_log_head = sdp->sd_log_flush_head; sdp->sd_log_head = sdp->sd_log_flush_head;
sdp->sd_log_blks_reserved = 0; sdp->sd_log_blks_reserved = 0;
sdp->sd_log_commited_revoke = 0; sdp->sd_log_committed_revoke = 0;
spin_lock(&sdp->sd_ail_lock); spin_lock(&sdp->sd_ail_lock);
if (tr && !list_empty(&tr->tr_ail1_list)) { if (tr && !list_empty(&tr->tr_ail1_list)) {
...@@ -899,6 +895,7 @@ static void gfs2_merge_trans(struct gfs2_trans *old, struct gfs2_trans *new) ...@@ -899,6 +895,7 @@ static void gfs2_merge_trans(struct gfs2_trans *old, struct gfs2_trans *new)
old->tr_num_buf_rm += new->tr_num_buf_rm; old->tr_num_buf_rm += new->tr_num_buf_rm;
old->tr_num_databuf_rm += new->tr_num_databuf_rm; old->tr_num_databuf_rm += new->tr_num_databuf_rm;
old->tr_num_revoke += new->tr_num_revoke; old->tr_num_revoke += new->tr_num_revoke;
old->tr_num_revoke_rm += new->tr_num_revoke_rm;
list_splice_tail_init(&new->tr_databuf, &old->tr_databuf); list_splice_tail_init(&new->tr_databuf, &old->tr_databuf);
list_splice_tail_init(&new->tr_buf, &old->tr_buf); list_splice_tail_init(&new->tr_buf, &old->tr_buf);
...@@ -920,7 +917,7 @@ static void log_refund(struct gfs2_sbd *sdp, struct gfs2_trans *tr) ...@@ -920,7 +917,7 @@ static void log_refund(struct gfs2_sbd *sdp, struct gfs2_trans *tr)
set_bit(TR_ATTACHED, &tr->tr_flags); set_bit(TR_ATTACHED, &tr->tr_flags);
} }
sdp->sd_log_commited_revoke += tr->tr_num_revoke; sdp->sd_log_committed_revoke += tr->tr_num_revoke - tr->tr_num_revoke_rm;
reserved = calc_reserved(sdp); reserved = calc_reserved(sdp);
maxres = sdp->sd_log_blks_reserved + tr->tr_reserved; maxres = sdp->sd_log_blks_reserved + tr->tr_reserved;
gfs2_assert_withdraw(sdp, maxres >= reserved); gfs2_assert_withdraw(sdp, maxres >= reserved);
......
...@@ -60,9 +60,9 @@ static inline void gfs2_ordered_add_inode(struct gfs2_inode *ip) ...@@ -60,9 +60,9 @@ static inline void gfs2_ordered_add_inode(struct gfs2_inode *ip)
spin_unlock(&sdp->sd_ordered_lock); spin_unlock(&sdp->sd_ordered_lock);
} }
} }
extern void gfs2_ordered_del_inode(struct gfs2_inode *ip); extern void gfs2_ordered_del_inode(struct gfs2_inode *ip);
extern unsigned int gfs2_struct2blk(struct gfs2_sbd *sdp, unsigned int nstruct, extern unsigned int gfs2_struct2blk(struct gfs2_sbd *sdp, unsigned int nstruct);
unsigned int ssize);
extern void gfs2_log_release(struct gfs2_sbd *sdp, unsigned int blks); extern void gfs2_log_release(struct gfs2_sbd *sdp, unsigned int blks);
extern int gfs2_log_reserve(struct gfs2_sbd *sdp, unsigned int blks); extern int gfs2_log_reserve(struct gfs2_sbd *sdp, unsigned int blks);
......
...@@ -259,7 +259,7 @@ static struct bio *gfs2_log_alloc_bio(struct gfs2_sbd *sdp, u64 blkno, ...@@ -259,7 +259,7 @@ static struct bio *gfs2_log_alloc_bio(struct gfs2_sbd *sdp, u64 blkno,
struct super_block *sb = sdp->sd_vfs; struct super_block *sb = sdp->sd_vfs;
struct bio *bio = bio_alloc(GFP_NOIO, BIO_MAX_PAGES); struct bio *bio = bio_alloc(GFP_NOIO, BIO_MAX_PAGES);
bio->bi_iter.bi_sector = blkno * (sb->s_blocksize >> 9); bio->bi_iter.bi_sector = blkno << (sb->s_blocksize_bits - 9);
bio_set_dev(bio, sb->s_bdev); bio_set_dev(bio, sb->s_bdev);
bio->bi_end_io = end_io; bio->bi_end_io = end_io;
bio->bi_private = sdp; bio->bi_private = sdp;
...@@ -472,6 +472,20 @@ static void gfs2_jhead_process_page(struct gfs2_jdesc *jd, unsigned long index, ...@@ -472,6 +472,20 @@ static void gfs2_jhead_process_page(struct gfs2_jdesc *jd, unsigned long index,
put_page(page); /* Once more for find_or_create_page */ put_page(page); /* Once more for find_or_create_page */
} }
static struct bio *gfs2_chain_bio(struct bio *prev, unsigned int nr_iovecs)
{
struct bio *new;
new = bio_alloc(GFP_NOIO, nr_iovecs);
bio_copy_dev(new, prev);
new->bi_iter.bi_sector = bio_end_sector(prev);
new->bi_opf = prev->bi_opf;
new->bi_write_hint = prev->bi_write_hint;
bio_chain(new, prev);
submit_bio(prev);
return new;
}
/** /**
* gfs2_find_jhead - find the head of a log * gfs2_find_jhead - find the head of a log
* @jd: The journal descriptor * @jd: The journal descriptor
...@@ -488,15 +502,15 @@ int gfs2_find_jhead(struct gfs2_jdesc *jd, struct gfs2_log_header_host *head, ...@@ -488,15 +502,15 @@ int gfs2_find_jhead(struct gfs2_jdesc *jd, struct gfs2_log_header_host *head,
struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode); struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode);
struct address_space *mapping = jd->jd_inode->i_mapping; struct address_space *mapping = jd->jd_inode->i_mapping;
unsigned int block = 0, blocks_submitted = 0, blocks_read = 0; unsigned int block = 0, blocks_submitted = 0, blocks_read = 0;
unsigned int bsize = sdp->sd_sb.sb_bsize; unsigned int bsize = sdp->sd_sb.sb_bsize, off;
unsigned int bsize_shift = sdp->sd_sb.sb_bsize_shift; unsigned int bsize_shift = sdp->sd_sb.sb_bsize_shift;
unsigned int shift = PAGE_SHIFT - bsize_shift; unsigned int shift = PAGE_SHIFT - bsize_shift;
unsigned int readhead_blocks = BIO_MAX_PAGES << shift; unsigned int readahead_blocks = BIO_MAX_PAGES << shift;
struct gfs2_journal_extent *je; struct gfs2_journal_extent *je;
int sz, ret = 0; int sz, ret = 0;
struct bio *bio = NULL; struct bio *bio = NULL;
struct page *page = NULL; struct page *page = NULL;
bool done = false; bool bio_chained = false, done = false;
errseq_t since; errseq_t since;
memset(head, 0, sizeof(*head)); memset(head, 0, sizeof(*head));
...@@ -505,9 +519,9 @@ int gfs2_find_jhead(struct gfs2_jdesc *jd, struct gfs2_log_header_host *head, ...@@ -505,9 +519,9 @@ int gfs2_find_jhead(struct gfs2_jdesc *jd, struct gfs2_log_header_host *head,
since = filemap_sample_wb_err(mapping); since = filemap_sample_wb_err(mapping);
list_for_each_entry(je, &jd->extent_list, list) { list_for_each_entry(je, &jd->extent_list, list) {
for (; block < je->lblock + je->blocks; block++) { u64 dblock = je->dblock;
u64 dblock;
for (; block < je->lblock + je->blocks; block++, dblock++) {
if (!page) { if (!page) {
page = find_or_create_page(mapping, page = find_or_create_page(mapping,
block >> shift, GFP_NOFS); block >> shift, GFP_NOFS);
...@@ -516,35 +530,41 @@ int gfs2_find_jhead(struct gfs2_jdesc *jd, struct gfs2_log_header_host *head, ...@@ -516,35 +530,41 @@ int gfs2_find_jhead(struct gfs2_jdesc *jd, struct gfs2_log_header_host *head,
done = true; done = true;
goto out; goto out;
} }
off = 0;
} }
if (bio) { if (!bio || (bio_chained && !off)) {
unsigned int off; /* start new bio */
} else {
off = (block << bsize_shift) & ~PAGE_MASK;
sz = bio_add_page(bio, page, bsize, off); sz = bio_add_page(bio, page, bsize, off);
if (sz == bsize) { /* block added */ if (sz == bsize)
if (off + bsize == PAGE_SIZE) { goto block_added;
page = NULL; if (off) {
goto page_added; unsigned int blocks =
} (PAGE_SIZE - off) >> bsize_shift;
continue;
bio = gfs2_chain_bio(bio, blocks);
bio_chained = true;
goto add_block_to_new_bio;
} }
}
if (bio) {
blocks_submitted = block + 1; blocks_submitted = block + 1;
submit_bio(bio); submit_bio(bio);
bio = NULL;
} }
dblock = je->dblock + (block - je->lblock);
bio = gfs2_log_alloc_bio(sdp, dblock, gfs2_end_log_read); bio = gfs2_log_alloc_bio(sdp, dblock, gfs2_end_log_read);
bio->bi_opf = REQ_OP_READ; bio->bi_opf = REQ_OP_READ;
sz = bio_add_page(bio, page, bsize, 0); bio_chained = false;
gfs2_assert_warn(sdp, sz == bsize); add_block_to_new_bio:
if (bsize == PAGE_SIZE) sz = bio_add_page(bio, page, bsize, off);
BUG_ON(sz != bsize);
block_added:
off += bsize;
if (off == PAGE_SIZE)
page = NULL; page = NULL;
if (blocks_submitted < blocks_read + readahead_blocks) {
page_added:
if (blocks_submitted < blocks_read + readhead_blocks) {
/* Keep at least one bio in flight */ /* Keep at least one bio in flight */
continue; continue;
} }
...@@ -846,7 +866,7 @@ static void revoke_lo_before_commit(struct gfs2_sbd *sdp, struct gfs2_trans *tr) ...@@ -846,7 +866,7 @@ static void revoke_lo_before_commit(struct gfs2_sbd *sdp, struct gfs2_trans *tr)
if (!sdp->sd_log_num_revoke) if (!sdp->sd_log_num_revoke)
return; return;
length = gfs2_struct2blk(sdp, sdp->sd_log_num_revoke, sizeof(u64)); length = gfs2_struct2blk(sdp, sdp->sd_log_num_revoke);
page = gfs2_get_log_desc(sdp, GFS2_LOG_DESC_REVOKE, length, sdp->sd_log_num_revoke); page = gfs2_get_log_desc(sdp, GFS2_LOG_DESC_REVOKE, length, sdp->sd_log_num_revoke);
offset = sizeof(struct gfs2_log_descriptor); offset = sizeof(struct gfs2_log_descriptor);
......
...@@ -298,6 +298,8 @@ static int gfs2_read_sb(struct gfs2_sbd *sdp, int silent) ...@@ -298,6 +298,8 @@ static int gfs2_read_sb(struct gfs2_sbd *sdp, int silent)
sizeof(struct gfs2_dinode)) / sizeof(u64); sizeof(struct gfs2_dinode)) / sizeof(u64);
sdp->sd_inptrs = (sdp->sd_sb.sb_bsize - sdp->sd_inptrs = (sdp->sd_sb.sb_bsize -
sizeof(struct gfs2_meta_header)) / sizeof(u64); sizeof(struct gfs2_meta_header)) / sizeof(u64);
sdp->sd_ldptrs = (sdp->sd_sb.sb_bsize -
sizeof(struct gfs2_log_descriptor)) / sizeof(u64);
sdp->sd_jbsize = sdp->sd_sb.sb_bsize - sizeof(struct gfs2_meta_header); sdp->sd_jbsize = sdp->sd_sb.sb_bsize - sizeof(struct gfs2_meta_header);
sdp->sd_hash_bsize = sdp->sd_sb.sb_bsize / 2; sdp->sd_hash_bsize = sdp->sd_sb.sb_bsize / 2;
sdp->sd_hash_bsize_shift = sdp->sd_sb.sb_bsize_shift - 1; sdp->sd_hash_bsize_shift = sdp->sd_sb.sb_bsize_shift - 1;
......
...@@ -36,16 +36,6 @@ ...@@ -36,16 +36,6 @@
#define BFITNOENT ((u32)~0) #define BFITNOENT ((u32)~0)
#define NO_BLOCK ((u64)~0) #define NO_BLOCK ((u64)~0)
#if BITS_PER_LONG == 32
#define LBITMASK (0x55555555UL)
#define LBITSKIP55 (0x55555555UL)
#define LBITSKIP00 (0x00000000UL)
#else
#define LBITMASK (0x5555555555555555UL)
#define LBITSKIP55 (0x5555555555555555UL)
#define LBITSKIP00 (0x0000000000000000UL)
#endif
/* /*
* These routines are used by the resource group routines (rgrp.c) * These routines are used by the resource group routines (rgrp.c)
* to keep track of block allocation. Each block is represented by two * to keep track of block allocation. Each block is represented by two
......
...@@ -49,8 +49,7 @@ int gfs2_trans_begin(struct gfs2_sbd *sdp, unsigned int blocks, ...@@ -49,8 +49,7 @@ int gfs2_trans_begin(struct gfs2_sbd *sdp, unsigned int blocks,
if (blocks) if (blocks)
tr->tr_reserved += 6 + blocks; tr->tr_reserved += 6 + blocks;
if (revokes) if (revokes)
tr->tr_reserved += gfs2_struct2blk(sdp, revokes, tr->tr_reserved += gfs2_struct2blk(sdp, revokes);
sizeof(u64));
INIT_LIST_HEAD(&tr->tr_databuf); INIT_LIST_HEAD(&tr->tr_databuf);
INIT_LIST_HEAD(&tr->tr_buf); INIT_LIST_HEAD(&tr->tr_buf);
...@@ -77,10 +76,10 @@ static void gfs2_print_trans(struct gfs2_sbd *sdp, const struct gfs2_trans *tr) ...@@ -77,10 +76,10 @@ static void gfs2_print_trans(struct gfs2_sbd *sdp, const struct gfs2_trans *tr)
fs_warn(sdp, "blocks=%u revokes=%u reserved=%u touched=%u\n", fs_warn(sdp, "blocks=%u revokes=%u reserved=%u touched=%u\n",
tr->tr_blocks, tr->tr_revokes, tr->tr_reserved, tr->tr_blocks, tr->tr_revokes, tr->tr_reserved,
test_bit(TR_TOUCHED, &tr->tr_flags)); test_bit(TR_TOUCHED, &tr->tr_flags));
fs_warn(sdp, "Buf %u/%u Databuf %u/%u Revoke %u\n", fs_warn(sdp, "Buf %u/%u Databuf %u/%u Revoke %u/%u\n",
tr->tr_num_buf_new, tr->tr_num_buf_rm, tr->tr_num_buf_new, tr->tr_num_buf_rm,
tr->tr_num_databuf_new, tr->tr_num_databuf_rm, tr->tr_num_databuf_new, tr->tr_num_databuf_rm,
tr->tr_num_revoke); tr->tr_num_revoke, tr->tr_num_revoke_rm);
} }
void gfs2_trans_end(struct gfs2_sbd *sdp) void gfs2_trans_end(struct gfs2_sbd *sdp)
...@@ -265,7 +264,7 @@ void gfs2_trans_remove_revoke(struct gfs2_sbd *sdp, u64 blkno, unsigned int len) ...@@ -265,7 +264,7 @@ void gfs2_trans_remove_revoke(struct gfs2_sbd *sdp, u64 blkno, unsigned int len)
if (bd->bd_gl) if (bd->bd_gl)
gfs2_glock_remove_revoke(bd->bd_gl); gfs2_glock_remove_revoke(bd->bd_gl);
kmem_cache_free(gfs2_bufdata_cachep, bd); kmem_cache_free(gfs2_bufdata_cachep, bd);
tr->tr_num_revoke--; tr->tr_num_revoke_rm++;
if (--n == 0) if (--n == 0)
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment