gfs2: clean_journal improperly set sd_log_flush_head
This patch fixes regressions in588bff95c9
. Due to that patch, function clean_journal was setting the value of sd_log_flush_head, but that's only valid if it is replaying the node's own journal. If it's replaying another node's journal, that's completely wrong and will lead to multiple problems. This patch tries to clean up the mess by passing the value of the logical journal block number into gfs2_write_log_header so the function can treat non-owned journals generically. For the local journal, the journal extent map is used for best performance. For other nodes from other journals, new function gfs2_lblk_to_dblk is called to figure it out using gfs2_iomap_get. This patch also tries to establish more consistency when passing journal block parameters by changing several unsigned int types to a consistent u32. Fixes:588bff95c9
("GFS2: Reduce code redundancy writing log headers") Signed-off-by: Bob Peterson <rpeterso@redhat.com> Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
This commit is contained in:

committed by
Andreas Gruenbacher

부모
7881ef3f33
커밋
7c70b89695
@@ -925,6 +925,32 @@ do_alloc:
|
||||
goto out;
|
||||
}
|
||||
|
||||
/**
|
||||
* gfs2_lblk_to_dblk - convert logical block to disk block
|
||||
* @inode: the inode of the file we're mapping
|
||||
* @lblock: the block relative to the start of the file
|
||||
* @dblock: the returned dblock, if no error
|
||||
*
|
||||
* This function maps a single block from a file logical block (relative to
|
||||
* the start of the file) to a file system absolute block using iomap.
|
||||
*
|
||||
* Returns: the absolute file system block, or an error
|
||||
*/
|
||||
int gfs2_lblk_to_dblk(struct inode *inode, u32 lblock, u64 *dblock)
|
||||
{
|
||||
struct iomap iomap = { };
|
||||
struct metapath mp = { .mp_aheight = 1, };
|
||||
loff_t pos = (loff_t)lblock << inode->i_blkbits;
|
||||
int ret;
|
||||
|
||||
ret = gfs2_iomap_get(inode, pos, i_blocksize(inode), 0, &iomap, &mp);
|
||||
release_metapath(&mp);
|
||||
if (ret == 0)
|
||||
*dblock = iomap.addr >> inode->i_blkbits;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int gfs2_write_lock(struct inode *inode)
|
||||
{
|
||||
struct gfs2_inode *ip = GFS2_I(inode);
|
||||
|
Reference in New Issue
Block a user