aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-04-04 16:09:42 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-04-04 16:09:42 -0400
commit2bd99df54f43b659ddaab8922adbaf3bcf3753ed (patch)
tree5a12962375b3b755f3b8b8420490f0275858dcf2
parent94514bbe9e5c402c4232af158a295a8fdfd72a2c (diff)
parent5e86d9d122d0d6fae00d9dff41c22d6f4d09f566 (diff)
Merge tag 'gfs2-4.17.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2
Pull gfs2 updates from Bob Peterson: "We've only got nine GFS2 patches for this merge window: - report journal recovery times more accurately during journal replay (Abhi Das) - fix fallocate chunk size (Andreas Gruenbacher) - correctly dirty inodes during rename (Andreas Gruenbacher) - improve the comment for function gfs2_block_map (Andreas Gruenbacher) - improve kernel trace point iomap end: The physical block address was added (Andreas Gruenbacher) - fix a nasty file system corruption bug that surfaced in xfstests 476 in punch-hole/truncate (Andreas Gruenbacher) - fix a problem Christoph Helwig pointed out, namely, that GFS2 was misusing the IOMAP_ZERO flag. The zeroing of new blocks was moved to the proper fallocate code (Andreas Gruenbacher) - declare function gfs2_remove_from_ail as static (Bob Peterson) - only set PageChecked for jdata page writes (Bob Peterson)" * tag 'gfs2-4.17.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2: gfs2: time journal recovery steps accurately gfs2: Zero out fallocated blocks in fallocate_chunk gfs2: Check for the end of metadata in punch_hole gfs2: gfs2_iomap_end tracepoint: log block address gfs2: Improve gfs2_block_map comment GFS2: Only set PageChecked for jdata pages GFS2: Make function gfs2_remove_from_ail static gfs2: Dirty source inode during rename gfs2: Fix fallocate chunk size
-rw-r--r--fs/gfs2/aops.c8
-rw-r--r--fs/gfs2/bmap.c38
-rw-r--r--fs/gfs2/dir.c13
-rw-r--r--fs/gfs2/file.c34
-rw-r--r--fs/gfs2/incore.h3
-rw-r--r--fs/gfs2/inode.c10
-rw-r--r--fs/gfs2/log.c2
-rw-r--r--fs/gfs2/log.h1
-rw-r--r--fs/gfs2/quota.h2
-rw-r--r--fs/gfs2/recovery.c20
-rw-r--r--fs/gfs2/trace_gfs2.h9
11 files changed, 68 insertions, 72 deletions
diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c
index 2f725b4a386b..f58716567972 100644
--- a/fs/gfs2/aops.c
+++ b/fs/gfs2/aops.c
@@ -940,13 +940,13 @@ failed:
940} 940}
941 941
942/** 942/**
943 * gfs2_set_page_dirty - Page dirtying function 943 * jdata_set_page_dirty - Page dirtying function
944 * @page: The page to dirty 944 * @page: The page to dirty
945 * 945 *
946 * Returns: 1 if it dirtyed the page, or 0 otherwise 946 * Returns: 1 if it dirtyed the page, or 0 otherwise
947 */ 947 */
948 948
949static int gfs2_set_page_dirty(struct page *page) 949static int jdata_set_page_dirty(struct page *page)
950{ 950{
951 SetPageChecked(page); 951 SetPageChecked(page);
952 return __set_page_dirty_buffers(page); 952 return __set_page_dirty_buffers(page);
@@ -1214,7 +1214,7 @@ static const struct address_space_operations gfs2_ordered_aops = {
1214 .readpages = gfs2_readpages, 1214 .readpages = gfs2_readpages,
1215 .write_begin = gfs2_write_begin, 1215 .write_begin = gfs2_write_begin,
1216 .write_end = gfs2_write_end, 1216 .write_end = gfs2_write_end,
1217 .set_page_dirty = gfs2_set_page_dirty, 1217 .set_page_dirty = __set_page_dirty_buffers,
1218 .bmap = gfs2_bmap, 1218 .bmap = gfs2_bmap,
1219 .invalidatepage = gfs2_invalidatepage, 1219 .invalidatepage = gfs2_invalidatepage,
1220 .releasepage = gfs2_releasepage, 1220 .releasepage = gfs2_releasepage,
@@ -1231,7 +1231,7 @@ static const struct address_space_operations gfs2_jdata_aops = {
1231 .readpages = gfs2_readpages, 1231 .readpages = gfs2_readpages,
1232 .write_begin = gfs2_write_begin, 1232 .write_begin = gfs2_write_begin,
1233 .write_end = gfs2_write_end, 1233 .write_end = gfs2_write_end,
1234 .set_page_dirty = gfs2_set_page_dirty, 1234 .set_page_dirty = jdata_set_page_dirty,
1235 .bmap = gfs2_bmap, 1235 .bmap = gfs2_bmap,
1236 .invalidatepage = gfs2_invalidatepage, 1236 .invalidatepage = gfs2_invalidatepage,
1237 .releasepage = gfs2_releasepage, 1237 .releasepage = gfs2_releasepage,
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
index 51f940e76c5e..685c305cbeb6 100644
--- a/fs/gfs2/bmap.c
+++ b/fs/gfs2/bmap.c
@@ -491,14 +491,12 @@ static int gfs2_iomap_alloc(struct inode *inode, struct iomap *iomap,
491{ 491{
492 struct gfs2_inode *ip = GFS2_I(inode); 492 struct gfs2_inode *ip = GFS2_I(inode);
493 struct gfs2_sbd *sdp = GFS2_SB(inode); 493 struct gfs2_sbd *sdp = GFS2_SB(inode);
494 struct super_block *sb = sdp->sd_vfs;
495 struct buffer_head *dibh = mp->mp_bh[0]; 494 struct buffer_head *dibh = mp->mp_bh[0];
496 u64 bn; 495 u64 bn;
497 unsigned n, i, blks, alloced = 0, iblks = 0, branch_start = 0; 496 unsigned n, i, blks, alloced = 0, iblks = 0, branch_start = 0;
498 unsigned dblks = 0; 497 unsigned dblks = 0;
499 unsigned ptrs_per_blk; 498 unsigned ptrs_per_blk;
500 const unsigned end_of_metadata = mp->mp_fheight - 1; 499 const unsigned end_of_metadata = mp->mp_fheight - 1;
501 int ret;
502 enum alloc_state state; 500 enum alloc_state state;
503 __be64 *ptr; 501 __be64 *ptr;
504 __be64 zero_bn = 0; 502 __be64 zero_bn = 0;
@@ -607,15 +605,6 @@ static int gfs2_iomap_alloc(struct inode *inode, struct iomap *iomap,
607 iomap->flags |= IOMAP_F_NEW; 605 iomap->flags |= IOMAP_F_NEW;
608 while (n-- > 0) 606 while (n-- > 0)
609 *ptr++ = cpu_to_be64(bn++); 607 *ptr++ = cpu_to_be64(bn++);
610 if (flags & IOMAP_ZERO) {
611 ret = sb_issue_zeroout(sb, iomap->addr >> inode->i_blkbits,
612 dblks, GFP_NOFS);
613 if (ret) {
614 fs_err(sdp,
615 "Failed to zero data buffers\n");
616 flags &= ~IOMAP_ZERO;
617 }
618 }
619 break; 608 break;
620 } 609 }
621 } while (iomap->addr == IOMAP_NULL_ADDR); 610 } while (iomap->addr == IOMAP_NULL_ADDR);
@@ -812,15 +801,22 @@ do_alloc:
812} 801}
813 802
814/** 803/**
815 * gfs2_block_map - Map a block from an inode to a disk block 804 * gfs2_block_map - Map one or more blocks of an inode to a disk block
816 * @inode: The inode 805 * @inode: The inode
817 * @lblock: The logical block number 806 * @lblock: The logical block number
818 * @bh_map: The bh to be mapped 807 * @bh_map: The bh to be mapped
819 * @create: True if its ok to alloc blocks to satify the request 808 * @create: True if its ok to alloc blocks to satify the request
820 * 809 *
821 * Sets buffer_mapped() if successful, sets buffer_boundary() if a 810 * The size of the requested mapping is defined in bh_map->b_size.
822 * read of metadata will be required before the next block can be 811 *
823 * mapped. Sets buffer_new() if new blocks were allocated. 812 * Clears buffer_mapped(bh_map) and leaves bh_map->b_size unchanged
813 * when @lblock is not mapped. Sets buffer_mapped(bh_map) and
814 * bh_map->b_size to indicate the size of the mapping when @lblock and
815 * successive blocks are mapped, up to the requested size.
816 *
817 * Sets buffer_boundary() if a read of metadata will be required
818 * before the next block can be mapped. Sets buffer_new() if new
819 * blocks were allocated.
824 * 820 *
825 * Returns: errno 821 * Returns: errno
826 */ 822 */
@@ -839,8 +835,6 @@ int gfs2_block_map(struct inode *inode, sector_t lblock,
839 835
840 if (create) 836 if (create)
841 flags |= IOMAP_WRITE; 837 flags |= IOMAP_WRITE;
842 if (buffer_zeronew(bh_map))
843 flags |= IOMAP_ZERO;
844 ret = gfs2_iomap_begin(inode, (loff_t)lblock << inode->i_blkbits, 838 ret = gfs2_iomap_begin(inode, (loff_t)lblock << inode->i_blkbits,
845 bh_map->b_size, flags, &iomap); 839 bh_map->b_size, flags, &iomap);
846 if (ret) { 840 if (ret) {
@@ -1344,6 +1338,7 @@ static inline bool walk_done(struct gfs2_sbd *sdp,
1344static int punch_hole(struct gfs2_inode *ip, u64 offset, u64 length) 1338static int punch_hole(struct gfs2_inode *ip, u64 offset, u64 length)
1345{ 1339{
1346 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); 1340 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
1341 u64 maxsize = sdp->sd_heightsize[ip->i_height];
1347 struct metapath mp = {}; 1342 struct metapath mp = {};
1348 struct buffer_head *dibh, *bh; 1343 struct buffer_head *dibh, *bh;
1349 struct gfs2_holder rd_gh; 1344 struct gfs2_holder rd_gh;
@@ -1359,6 +1354,14 @@ static int punch_hole(struct gfs2_inode *ip, u64 offset, u64 length)
1359 u64 prev_bnr = 0; 1354 u64 prev_bnr = 0;
1360 __be64 *start, *end; 1355 __be64 *start, *end;
1361 1356
1357 if (offset >= maxsize) {
1358 /*
1359 * The starting point lies beyond the allocated meta-data;
1360 * there are no blocks do deallocate.
1361 */
1362 return 0;
1363 }
1364
1362 /* 1365 /*
1363 * The start position of the hole is defined by lblock, start_list, and 1366 * The start position of the hole is defined by lblock, start_list, and
1364 * start_aligned. The end position of the hole is defined by lend, 1367 * start_aligned. The end position of the hole is defined by lend,
@@ -1372,7 +1375,6 @@ static int punch_hole(struct gfs2_inode *ip, u64 offset, u64 length)
1372 */ 1375 */
1373 1376
1374 if (length) { 1377 if (length) {
1375 u64 maxsize = sdp->sd_heightsize[ip->i_height];
1376 u64 end_offset = offset + length; 1378 u64 end_offset = offset + length;
1377 u64 lend; 1379 u64 lend;
1378 1380
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
index 7c21aea0266b..d9fb0ad6cc30 100644
--- a/fs/gfs2/dir.c
+++ b/fs/gfs2/dir.c
@@ -1940,7 +1940,6 @@ int gfs2_dir_mvino(struct gfs2_inode *dip, const struct qstr *filename,
1940{ 1940{
1941 struct buffer_head *bh; 1941 struct buffer_head *bh;
1942 struct gfs2_dirent *dent; 1942 struct gfs2_dirent *dent;
1943 int error;
1944 1943
1945 dent = gfs2_dirent_search(&dip->i_inode, filename, gfs2_dirent_find, &bh); 1944 dent = gfs2_dirent_search(&dip->i_inode, filename, gfs2_dirent_find, &bh);
1946 if (!dent) { 1945 if (!dent) {
@@ -1953,18 +1952,10 @@ int gfs2_dir_mvino(struct gfs2_inode *dip, const struct qstr *filename,
1953 gfs2_trans_add_meta(dip->i_gl, bh); 1952 gfs2_trans_add_meta(dip->i_gl, bh);
1954 gfs2_inum_out(nip, dent); 1953 gfs2_inum_out(nip, dent);
1955 dent->de_type = cpu_to_be16(new_type); 1954 dent->de_type = cpu_to_be16(new_type);
1956 1955 brelse(bh);
1957 if (dip->i_diskflags & GFS2_DIF_EXHASH) {
1958 brelse(bh);
1959 error = gfs2_meta_inode_buffer(dip, &bh);
1960 if (error)
1961 return error;
1962 gfs2_trans_add_meta(dip->i_gl, bh);
1963 }
1964 1956
1965 dip->i_inode.i_mtime = dip->i_inode.i_ctime = current_time(&dip->i_inode); 1957 dip->i_inode.i_mtime = dip->i_inode.i_ctime = current_time(&dip->i_inode);
1966 gfs2_dinode_out(dip, bh->b_data); 1958 mark_inode_dirty_sync(&dip->i_inode);
1967 brelse(bh);
1968 return 0; 1959 return 0;
1969} 1960}
1970 1961
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c
index 4f88e201b3f0..4b71f021a9e2 100644
--- a/fs/gfs2/file.c
+++ b/fs/gfs2/file.c
@@ -729,11 +729,12 @@ static ssize_t gfs2_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
729static int fallocate_chunk(struct inode *inode, loff_t offset, loff_t len, 729static int fallocate_chunk(struct inode *inode, loff_t offset, loff_t len,
730 int mode) 730 int mode)
731{ 731{
732 struct super_block *sb = inode->i_sb;
732 struct gfs2_inode *ip = GFS2_I(inode); 733 struct gfs2_inode *ip = GFS2_I(inode);
734 loff_t end = offset + len;
733 struct buffer_head *dibh; 735 struct buffer_head *dibh;
736 struct iomap iomap;
734 int error; 737 int error;
735 unsigned int nr_blks;
736 sector_t lblock = offset >> inode->i_blkbits;
737 738
738 error = gfs2_meta_inode_buffer(ip, &dibh); 739 error = gfs2_meta_inode_buffer(ip, &dibh);
739 if (unlikely(error)) 740 if (unlikely(error))
@@ -747,21 +748,19 @@ static int fallocate_chunk(struct inode *inode, loff_t offset, loff_t len,
747 goto out; 748 goto out;
748 } 749 }
749 750
750 while (len) { 751 while (offset < end) {
751 struct buffer_head bh_map = { .b_state = 0, .b_blocknr = 0 }; 752 error = gfs2_iomap_begin(inode, offset, end - offset,
752 bh_map.b_size = len; 753 IOMAP_WRITE, &iomap);
753 set_buffer_zeronew(&bh_map); 754 if (error)
754
755 error = gfs2_block_map(inode, lblock, &bh_map, 1);
756 if (unlikely(error))
757 goto out; 755 goto out;
758 len -= bh_map.b_size; 756 offset = iomap.offset + iomap.length;
759 nr_blks = bh_map.b_size >> inode->i_blkbits; 757 if (iomap.type != IOMAP_HOLE)
760 lblock += nr_blks;
761 if (!buffer_new(&bh_map))
762 continue; 758 continue;
763 if (unlikely(!buffer_zeronew(&bh_map))) { 759 error = sb_issue_zeroout(sb, iomap.addr >> inode->i_blkbits,
764 error = -EIO; 760 iomap.length >> inode->i_blkbits,
761 GFP_NOFS);
762 if (error) {
763 fs_err(GFS2_SB(inode), "Failed to zero data buffers\n");
765 goto out; 764 goto out;
766 } 765 }
767 } 766 }
@@ -809,7 +808,7 @@ static long __gfs2_fallocate(struct file *file, int mode, loff_t offset, loff_t
809 struct gfs2_inode *ip = GFS2_I(inode); 808 struct gfs2_inode *ip = GFS2_I(inode);
810 struct gfs2_alloc_parms ap = { .aflags = 0, }; 809 struct gfs2_alloc_parms ap = { .aflags = 0, };
811 unsigned int data_blocks = 0, ind_blocks = 0, rblocks; 810 unsigned int data_blocks = 0, ind_blocks = 0, rblocks;
812 loff_t bytes, max_bytes, max_blks = UINT_MAX; 811 loff_t bytes, max_bytes, max_blks;
813 int error; 812 int error;
814 const loff_t pos = offset; 813 const loff_t pos = offset;
815 const loff_t count = len; 814 const loff_t count = len;
@@ -861,7 +860,8 @@ static long __gfs2_fallocate(struct file *file, int mode, loff_t offset, loff_t
861 return error; 860 return error;
862 /* ap.allowed tells us how many blocks quota will allow 861 /* ap.allowed tells us how many blocks quota will allow
863 * us to write. Check if this reduces max_blks */ 862 * us to write. Check if this reduces max_blks */
864 if (ap.allowed && ap.allowed < max_blks) 863 max_blks = UINT_MAX;
864 if (ap.allowed)
865 max_blks = ap.allowed; 865 max_blks = ap.allowed;
866 866
867 error = gfs2_inplace_reserve(ip, &ap); 867 error = gfs2_inplace_reserve(ip, &ap);
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h
index e0557b8a590a..1b6b1e3f5caf 100644
--- a/fs/gfs2/incore.h
+++ b/fs/gfs2/incore.h
@@ -130,15 +130,12 @@ static inline bool gfs2_rbm_eq(const struct gfs2_rbm *rbm1,
130enum gfs2_state_bits { 130enum gfs2_state_bits {
131 BH_Pinned = BH_PrivateStart, 131 BH_Pinned = BH_PrivateStart,
132 BH_Escaped = BH_PrivateStart + 1, 132 BH_Escaped = BH_PrivateStart + 1,
133 BH_Zeronew = BH_PrivateStart + 2,
134}; 133};
135 134
136BUFFER_FNS(Pinned, pinned) 135BUFFER_FNS(Pinned, pinned)
137TAS_BUFFER_FNS(Pinned, pinned) 136TAS_BUFFER_FNS(Pinned, pinned)
138BUFFER_FNS(Escaped, escaped) 137BUFFER_FNS(Escaped, escaped)
139TAS_BUFFER_FNS(Escaped, escaped) 138TAS_BUFFER_FNS(Escaped, escaped)
140BUFFER_FNS(Zeronew, zeronew)
141TAS_BUFFER_FNS(Zeronew, zeronew)
142 139
143struct gfs2_bufdata { 140struct gfs2_bufdata {
144 struct buffer_head *bd_bh; 141 struct buffer_head *bd_bh;
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index 59e0560180ec..8700eb815638 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -1326,19 +1326,11 @@ static int gfs2_ok_to_move(struct gfs2_inode *this, struct gfs2_inode *to)
1326static int update_moved_ino(struct gfs2_inode *ip, struct gfs2_inode *ndip, 1326static int update_moved_ino(struct gfs2_inode *ip, struct gfs2_inode *ndip,
1327 int dir_rename) 1327 int dir_rename)
1328{ 1328{
1329 int error;
1330 struct buffer_head *dibh;
1331
1332 if (dir_rename) 1329 if (dir_rename)
1333 return gfs2_dir_mvino(ip, &gfs2_qdotdot, ndip, DT_DIR); 1330 return gfs2_dir_mvino(ip, &gfs2_qdotdot, ndip, DT_DIR);
1334 1331
1335 error = gfs2_meta_inode_buffer(ip, &dibh);
1336 if (error)
1337 return error;
1338 ip->i_inode.i_ctime = current_time(&ip->i_inode); 1332 ip->i_inode.i_ctime = current_time(&ip->i_inode);
1339 gfs2_trans_add_meta(ip->i_gl, dibh); 1333 mark_inode_dirty_sync(&ip->i_inode);
1340 gfs2_dinode_out(ip, dibh->b_data);
1341 brelse(dibh);
1342 return 0; 1334 return 0;
1343} 1335}
1344 1336
diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c
index cf6b46247df4..0248835625f1 100644
--- a/fs/gfs2/log.c
+++ b/fs/gfs2/log.c
@@ -73,7 +73,7 @@ unsigned int gfs2_struct2blk(struct gfs2_sbd *sdp, unsigned int nstruct,
73 * 73 *
74 */ 74 */
75 75
76void gfs2_remove_from_ail(struct gfs2_bufdata *bd) 76static void gfs2_remove_from_ail(struct gfs2_bufdata *bd)
77{ 77{
78 bd->bd_tr = NULL; 78 bd->bd_tr = NULL;
79 list_del_init(&bd->bd_ail_st_list); 79 list_del_init(&bd->bd_ail_st_list);
diff --git a/fs/gfs2/log.h b/fs/gfs2/log.h
index 93b52ac1ca1f..1862e310a067 100644
--- a/fs/gfs2/log.h
+++ b/fs/gfs2/log.h
@@ -70,7 +70,6 @@ extern void gfs2_write_log_header(struct gfs2_sbd *sdp, struct gfs2_jdesc *jd,
70extern void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl, 70extern void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl,
71 u32 type); 71 u32 type);
72extern void gfs2_log_commit(struct gfs2_sbd *sdp, struct gfs2_trans *trans); 72extern void gfs2_log_commit(struct gfs2_sbd *sdp, struct gfs2_trans *trans);
73extern void gfs2_remove_from_ail(struct gfs2_bufdata *bd);
74extern void gfs2_ail1_flush(struct gfs2_sbd *sdp, struct writeback_control *wbc); 73extern void gfs2_ail1_flush(struct gfs2_sbd *sdp, struct writeback_control *wbc);
75 74
76extern void gfs2_log_shutdown(struct gfs2_sbd *sdp); 75extern void gfs2_log_shutdown(struct gfs2_sbd *sdp);
diff --git a/fs/gfs2/quota.h b/fs/gfs2/quota.h
index 5e47c935a515..836f29480be6 100644
--- a/fs/gfs2/quota.h
+++ b/fs/gfs2/quota.h
@@ -45,6 +45,8 @@ static inline int gfs2_quota_lock_check(struct gfs2_inode *ip,
45{ 45{
46 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); 46 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
47 int ret; 47 int ret;
48
49 ap->allowed = UINT_MAX; /* Assume we are permitted a whole lot */
48 if (sdp->sd_args.ar_quota == GFS2_QUOTA_OFF) 50 if (sdp->sd_args.ar_quota == GFS2_QUOTA_OFF)
49 return 0; 51 return 0;
50 ret = gfs2_quota_lock(ip, NO_UID_QUOTA_CHANGE, NO_GID_QUOTA_CHANGE); 52 ret = gfs2_quota_lock(ip, NO_UID_QUOTA_CHANGE, NO_GID_QUOTA_CHANGE);
diff --git a/fs/gfs2/recovery.c b/fs/gfs2/recovery.c
index b6b258998bcd..d8b622c375ab 100644
--- a/fs/gfs2/recovery.c
+++ b/fs/gfs2/recovery.c
@@ -15,6 +15,7 @@
15#include <linux/gfs2_ondisk.h> 15#include <linux/gfs2_ondisk.h>
16#include <linux/crc32.h> 16#include <linux/crc32.h>
17#include <linux/crc32c.h> 17#include <linux/crc32c.h>
18#include <linux/ktime.h>
18 19
19#include "gfs2.h" 20#include "gfs2.h"
20#include "incore.h" 21#include "incore.h"
@@ -409,12 +410,13 @@ void gfs2_recover_func(struct work_struct *work)
409 struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode); 410 struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode);
410 struct gfs2_log_header_host head; 411 struct gfs2_log_header_host head;
411 struct gfs2_holder j_gh, ji_gh, thaw_gh; 412 struct gfs2_holder j_gh, ji_gh, thaw_gh;
412 unsigned long t; 413 ktime_t t_start, t_jlck, t_jhd, t_tlck, t_rep;
413 int ro = 0; 414 int ro = 0;
414 unsigned int pass; 415 unsigned int pass;
415 int error; 416 int error;
416 int jlocked = 0; 417 int jlocked = 0;
417 418
419 t_start = ktime_get();
418 if (sdp->sd_args.ar_spectator || 420 if (sdp->sd_args.ar_spectator ||
419 (jd->jd_jid != sdp->sd_lockstruct.ls_jid)) { 421 (jd->jd_jid != sdp->sd_lockstruct.ls_jid)) {
420 fs_info(sdp, "jid=%u: Trying to acquire journal lock...\n", 422 fs_info(sdp, "jid=%u: Trying to acquire journal lock...\n",
@@ -446,6 +448,7 @@ void gfs2_recover_func(struct work_struct *work)
446 fs_info(sdp, "jid=%u, already locked for use\n", jd->jd_jid); 448 fs_info(sdp, "jid=%u, already locked for use\n", jd->jd_jid);
447 } 449 }
448 450
451 t_jlck = ktime_get();
449 fs_info(sdp, "jid=%u: Looking at journal...\n", jd->jd_jid); 452 fs_info(sdp, "jid=%u: Looking at journal...\n", jd->jd_jid);
450 453
451 error = gfs2_jdesc_check(jd); 454 error = gfs2_jdesc_check(jd);
@@ -455,13 +458,12 @@ void gfs2_recover_func(struct work_struct *work)
455 error = gfs2_find_jhead(jd, &head); 458 error = gfs2_find_jhead(jd, &head);
456 if (error) 459 if (error)
457 goto fail_gunlock_ji; 460 goto fail_gunlock_ji;
461 t_jhd = ktime_get();
458 462
459 if (!(head.lh_flags & GFS2_LOG_HEAD_UNMOUNT)) { 463 if (!(head.lh_flags & GFS2_LOG_HEAD_UNMOUNT)) {
460 fs_info(sdp, "jid=%u: Acquiring the transaction lock...\n", 464 fs_info(sdp, "jid=%u: Acquiring the transaction lock...\n",
461 jd->jd_jid); 465 jd->jd_jid);
462 466
463 t = jiffies;
464
465 /* Acquire a shared hold on the freeze lock */ 467 /* Acquire a shared hold on the freeze lock */
466 468
467 error = gfs2_glock_nq_init(sdp->sd_freeze_gl, LM_ST_SHARED, 469 error = gfs2_glock_nq_init(sdp->sd_freeze_gl, LM_ST_SHARED,
@@ -495,6 +497,7 @@ void gfs2_recover_func(struct work_struct *work)
495 goto fail_gunlock_thaw; 497 goto fail_gunlock_thaw;
496 } 498 }
497 499
500 t_tlck = ktime_get();
498 fs_info(sdp, "jid=%u: Replaying journal...\n", jd->jd_jid); 501 fs_info(sdp, "jid=%u: Replaying journal...\n", jd->jd_jid);
499 502
500 for (pass = 0; pass < 2; pass++) { 503 for (pass = 0; pass < 2; pass++) {
@@ -509,9 +512,14 @@ void gfs2_recover_func(struct work_struct *work)
509 clean_journal(jd, &head); 512 clean_journal(jd, &head);
510 513
511 gfs2_glock_dq_uninit(&thaw_gh); 514 gfs2_glock_dq_uninit(&thaw_gh);
512 t = DIV_ROUND_UP(jiffies - t, HZ); 515 t_rep = ktime_get();
513 fs_info(sdp, "jid=%u: Journal replayed in %lus\n", 516 fs_info(sdp, "jid=%u: Journal replayed in %lldms [jlck:%lldms, "
514 jd->jd_jid, t); 517 "jhead:%lldms, tlck:%lldms, replay:%lldms]\n",
518 jd->jd_jid, ktime_ms_delta(t_rep, t_start),
519 ktime_ms_delta(t_jlck, t_start),
520 ktime_ms_delta(t_jhd, t_jlck),
521 ktime_ms_delta(t_tlck, t_jhd),
522 ktime_ms_delta(t_rep, t_tlck));
515 } 523 }
516 524
517 gfs2_recovery_done(sdp, jd->jd_jid, LM_RD_SUCCESS); 525 gfs2_recovery_done(sdp, jd->jd_jid, LM_RD_SUCCESS);
diff --git a/fs/gfs2/trace_gfs2.h b/fs/gfs2/trace_gfs2.h
index b9318b49ff8f..cb10b95efe0f 100644
--- a/fs/gfs2/trace_gfs2.h
+++ b/fs/gfs2/trace_gfs2.h
@@ -515,6 +515,7 @@ TRACE_EVENT(gfs2_iomap_end,
515 __field( u64, inum ) 515 __field( u64, inum )
516 __field( loff_t, offset ) 516 __field( loff_t, offset )
517 __field( ssize_t, length ) 517 __field( ssize_t, length )
518 __field( sector_t, pblock )
518 __field( u16, flags ) 519 __field( u16, flags )
519 __field( u16, type ) 520 __field( u16, type )
520 __field( int, ret ) 521 __field( int, ret )
@@ -525,16 +526,20 @@ TRACE_EVENT(gfs2_iomap_end,
525 __entry->inum = ip->i_no_addr; 526 __entry->inum = ip->i_no_addr;
526 __entry->offset = iomap->offset; 527 __entry->offset = iomap->offset;
527 __entry->length = iomap->length; 528 __entry->length = iomap->length;
529 __entry->pblock = iomap->addr == IOMAP_NULL_ADDR ? 0 :
530 (iomap->addr >> ip->i_inode.i_blkbits);
528 __entry->flags = iomap->flags; 531 __entry->flags = iomap->flags;
529 __entry->type = iomap->type; 532 __entry->type = iomap->type;
530 __entry->ret = ret; 533 __entry->ret = ret;
531 ), 534 ),
532 535
533 TP_printk("%u,%u bmap %llu iomap end %llu/%lu ty:%d flags:%08x rc:%d", 536 TP_printk("%u,%u bmap %llu iomap end %llu/%lu to %llu ty:%d flags:%08x rc:%d",
534 MAJOR(__entry->dev), MINOR(__entry->dev), 537 MAJOR(__entry->dev), MINOR(__entry->dev),
535 (unsigned long long)__entry->inum, 538 (unsigned long long)__entry->inum,
536 (unsigned long long)__entry->offset, 539 (unsigned long long)__entry->offset,
537 (unsigned long)__entry->length, (u16)__entry->type, 540 (unsigned long)__entry->length,
541 (long long)__entry->pblock,
542 (u16)__entry->type,
538 (u16)__entry->flags, __entry->ret) 543 (u16)__entry->flags, __entry->ret)
539); 544);
540 545