2
0
mirror of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2025-09-04 20:19:47 +08:00

gfs2: No more gfs2_find_jhead caching

We are no longer calling gfs2_find_jhead() on the same log twice, so
there is no more reason for keeping the log contents cached across those
calls.  In addition, log head lookup and log header writing didn't go
through the same address space and so the caching wasn't even fully
working, anyway.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
This commit is contained in:
Andreas Gruenbacher 2025-05-16 02:58:02 +02:00
parent 93bd5edbd6
commit e320050eb7
6 changed files with 7 additions and 10 deletions

View File

@ -601,7 +601,7 @@ static int freeze_go_xmote_bh(struct gfs2_glock *gl)
if (test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags)) { if (test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags)) {
j_gl->gl_ops->go_inval(j_gl, DIO_METADATA); j_gl->gl_ops->go_inval(j_gl, DIO_METADATA);
error = gfs2_find_jhead(sdp->sd_jdesc, &head, false); error = gfs2_find_jhead(sdp->sd_jdesc, &head);
if (gfs2_assert_withdraw_delayed(sdp, !error)) if (gfs2_assert_withdraw_delayed(sdp, !error))
return error; return error;
if (gfs2_assert_withdraw_delayed(sdp, head.lh_flags & if (gfs2_assert_withdraw_delayed(sdp, head.lh_flags &

View File

@ -496,15 +496,13 @@ static struct bio *gfs2_chain_bio(struct bio *prev, unsigned int nr_iovecs)
* 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
* @head: The log descriptor for the head of the log is returned here * @head: The log descriptor for the head of the log is returned here
* @keep_cache: If set inode pages will not be truncated
* *
* Do a search of a journal by reading it in large chunks using bios and find * Do a search of a journal by reading it in large chunks using bios and find
* the valid log entry with the highest sequence number. (i.e. the log head) * the valid log entry with the highest sequence number. (i.e. the log head)
* *
* Returns: 0 on success, errno otherwise * Returns: 0 on success, errno otherwise
*/ */
int gfs2_find_jhead(struct gfs2_jdesc *jd, struct gfs2_log_header_host *head, int gfs2_find_jhead(struct gfs2_jdesc *jd, struct gfs2_log_header_host *head)
bool keep_cache)
{ {
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;
@ -593,7 +591,6 @@ out:
if (!ret) if (!ret)
ret = filemap_check_wb_err(mapping, since); ret = filemap_check_wb_err(mapping, since);
if (!keep_cache)
truncate_inode_pages(mapping, 0); truncate_inode_pages(mapping, 0);
return ret; return ret;

View File

@ -20,7 +20,7 @@ void gfs2_log_write(struct gfs2_sbd *sdp, struct gfs2_jdesc *jd,
void gfs2_log_submit_bio(struct bio **biop, blk_opf_t opf); void gfs2_log_submit_bio(struct bio **biop, blk_opf_t opf);
void gfs2_pin(struct gfs2_sbd *sdp, struct buffer_head *bh); void gfs2_pin(struct gfs2_sbd *sdp, struct buffer_head *bh);
int gfs2_find_jhead(struct gfs2_jdesc *jd, int gfs2_find_jhead(struct gfs2_jdesc *jd,
struct gfs2_log_header_host *head, bool keep_cache); struct gfs2_log_header_host *head);
void gfs2_drain_revokes(struct gfs2_sbd *sdp); void gfs2_drain_revokes(struct gfs2_sbd *sdp);
static inline unsigned int buf_limit(struct gfs2_sbd *sdp) static inline unsigned int buf_limit(struct gfs2_sbd *sdp)

View File

@ -454,7 +454,7 @@ void gfs2_recover_func(struct work_struct *work)
if (error) if (error)
goto fail_gunlock_ji; goto fail_gunlock_ji;
error = gfs2_find_jhead(jd, &head, true); error = gfs2_find_jhead(jd, &head);
if (error) if (error)
goto fail_gunlock_ji; goto fail_gunlock_ji;
t_jhd = ktime_get(); t_jhd = ktime_get();

View File

@ -360,7 +360,7 @@ static int gfs2_lock_fs_check_clean(struct gfs2_sbd *sdp)
error = gfs2_jdesc_check(jd); error = gfs2_jdesc_check(jd);
if (error) if (error)
break; break;
error = gfs2_find_jhead(jd, &lh, false); error = gfs2_find_jhead(jd, &lh);
if (error) if (error)
break; break;
if (!(lh.lh_flags & GFS2_LOG_HEAD_UNMOUNT)) { if (!(lh.lh_flags & GFS2_LOG_HEAD_UNMOUNT)) {

View File

@ -73,7 +73,7 @@ int check_journal_clean(struct gfs2_sbd *sdp, struct gfs2_jdesc *jd,
"mount.\n"); "mount.\n");
goto out_unlock; goto out_unlock;
} }
error = gfs2_find_jhead(jd, &head, false); error = gfs2_find_jhead(jd, &head);
if (error) { if (error) {
if (verbose) if (verbose)
fs_err(sdp, "Error parsing journal for spectator " fs_err(sdp, "Error parsing journal for spectator "