Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4

Pull ext4 updates from Ted Ts'o:
"Only miscellaneous cleanups and bug fixes for ext4 this cycle"

* tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
ext4: create ext4_kset dynamically
ext4: create ext4_feat kobject dynamically
ext4: release kobject/kset even when init/register fail
ext4: fix incorrect indentation of if statement
ext4: correct documentation for grpid mount option
ext4: use 'sbi' instead of 'EXT4_SB(sb)'
ext4: save error to disk in __ext4_grp_locked_error()
jbd2: fix sphinx kernel-doc build warnings
ext4: fix a race in the ext4 shutdown path
mbcache: make sure c_entry_count is not decremented past zero
ext4: no need flush workqueue before destroying it
ext4: fixed alignment and minor code cleanup in ext4.h
ext4: fix ENOSPC handling in DAX page fault handler
dax: pass detailed error code from dax_iomap_fault()
mbcache: revert "fs/mbcache.c: make count_objects() more robust"
mbcache: initialize entry->e_referenced in mb_cache_entry_create()
ext4: fix up remaining files with SPDX cleanups

+408 -365
+1 -1
Documentation/filesystems/ext4.txt
··· 232 232 data_err=abort Abort the journal if an error occurs in a file 233 233 data buffer in ordered mode. 234 234 235 - grpid Give objects the same group ID as their creator. 235 + grpid New objects have the group ID of their parent. 236 236 bsdgroups 237 237 238 238 nogrpid (*) New objects have the group ID of their creator.
+6 -3
fs/dax.c
··· 1095 1095 } 1096 1096 1097 1097 static int dax_iomap_pte_fault(struct vm_fault *vmf, pfn_t *pfnp, 1098 - const struct iomap_ops *ops) 1098 + int *iomap_errp, const struct iomap_ops *ops) 1099 1099 { 1100 1100 struct vm_area_struct *vma = vmf->vma; 1101 1101 struct address_space *mapping = vma->vm_file->f_mapping; ··· 1148 1148 * that we never have to deal with more than a single extent here. 1149 1149 */ 1150 1150 error = ops->iomap_begin(inode, pos, PAGE_SIZE, flags, &iomap); 1151 + if (iomap_errp) 1152 + *iomap_errp = error; 1151 1153 if (error) { 1152 1154 vmf_ret = dax_fault_return(error); 1153 1155 goto unlock_entry; ··· 1483 1481 * @vmf: The description of the fault 1484 1482 * @pe_size: Size of the page to fault in 1485 1483 * @pfnp: PFN to insert for synchronous faults if fsync is required 1484 + * @iomap_errp: Storage for detailed error code in case of error 1486 1485 * @ops: Iomap ops passed from the file system 1487 1486 * 1488 1487 * When a page fault occurs, filesystems may call this helper in ··· 1492 1489 * successfully. 1493 1490 */ 1494 1491 int dax_iomap_fault(struct vm_fault *vmf, enum page_entry_size pe_size, 1495 - pfn_t *pfnp, const struct iomap_ops *ops) 1492 + pfn_t *pfnp, int *iomap_errp, const struct iomap_ops *ops) 1496 1493 { 1497 1494 switch (pe_size) { 1498 1495 case PE_SIZE_PTE: 1499 - return dax_iomap_pte_fault(vmf, pfnp, ops); 1496 + return dax_iomap_pte_fault(vmf, pfnp, iomap_errp, ops); 1500 1497 case PE_SIZE_PMD: 1501 1498 return dax_iomap_pmd_fault(vmf, pfnp, ops); 1502 1499 default:
+1 -1
fs/ext2/file.c
··· 100 100 } 101 101 down_read(&ei->dax_sem); 102 102 103 - ret = dax_iomap_fault(vmf, PE_SIZE_PTE, NULL, &ext2_iomap_ops); 103 + ret = dax_iomap_fault(vmf, PE_SIZE_PTE, NULL, NULL, &ext2_iomap_ops); 104 104 105 105 up_read(&ei->dax_sem); 106 106 if (vmf->flags & FAULT_FLAG_WRITE)
+1 -1
fs/ext4/acl.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 1 + // SPDX-License-Identifier: GPL-2.0 2 2 /* 3 3 File: fs/ext4/acl.h 4 4
+2 -2
fs/ext4/balloc.c
··· 355 355 blk = ext4_inode_table(sb, desc); 356 356 offset = blk - group_first_block; 357 357 next_zero_bit = ext4_find_next_zero_bit(bh->b_data, 358 - EXT4_B2C(sbi, offset + EXT4_SB(sb)->s_itb_per_group), 358 + EXT4_B2C(sbi, offset + sbi->s_itb_per_group), 359 359 EXT4_B2C(sbi, offset)); 360 360 if (next_zero_bit < 361 - EXT4_B2C(sbi, offset + EXT4_SB(sb)->s_itb_per_group)) 361 + EXT4_B2C(sbi, offset + sbi->s_itb_per_group)) 362 362 /* bad bitmap for inode tables */ 363 363 return blk; 364 364 return 0;
+3 -3
fs/ext4/block_validity.c
··· 147 147 int ret; 148 148 149 149 if (!test_opt(sb, BLOCK_VALIDITY)) { 150 - if (EXT4_SB(sb)->system_blks.rb_node) 150 + if (sbi->system_blks.rb_node) 151 151 ext4_release_system_zone(sb); 152 152 return 0; 153 153 } 154 - if (EXT4_SB(sb)->system_blks.rb_node) 154 + if (sbi->system_blks.rb_node) 155 155 return 0; 156 156 157 157 for (i=0; i < ngroups; i++) { ··· 173 173 } 174 174 175 175 if (test_opt(sb, DEBUG)) 176 - debug_print_tree(EXT4_SB(sb)); 176 + debug_print_tree(sbi); 177 177 return 0; 178 178 } 179 179
+10 -12
fs/ext4/ext4.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 1 + // SPDX-License-Identifier: GPL-2.0 2 2 /* 3 3 * ext4.h 4 4 * ··· 611 611 /* 612 612 * Flags used by ext4_free_blocks 613 613 */ 614 - #define EXT4_FREE_BLOCKS_METADATA 0x0001 615 - #define EXT4_FREE_BLOCKS_FORGET 0x0002 616 - #define EXT4_FREE_BLOCKS_VALIDATED 0x0004 617 - #define EXT4_FREE_BLOCKS_NO_QUOT_UPDATE 0x0008 614 + #define EXT4_FREE_BLOCKS_METADATA 0x0001 615 + #define EXT4_FREE_BLOCKS_FORGET 0x0002 616 + #define EXT4_FREE_BLOCKS_VALIDATED 0x0004 617 + #define EXT4_FREE_BLOCKS_NO_QUOT_UPDATE 0x0008 618 618 #define EXT4_FREE_BLOCKS_NOFREE_FIRST_CLUSTER 0x0010 619 619 #define EXT4_FREE_BLOCKS_NOFREE_LAST_CLUSTER 0x0020 620 620 ··· 1986 1986 1987 1987 /* Legal values for the dx_root hash_version field: */ 1988 1988 1989 - #define DX_HASH_LEGACY 0 1990 - #define DX_HASH_HALF_MD4 1 1991 - #define DX_HASH_TEA 2 1992 - #define DX_HASH_LEGACY_UNSIGNED 3 1989 + #define DX_HASH_LEGACY 0 1990 + #define DX_HASH_HALF_MD4 1 1991 + #define DX_HASH_TEA 2 1992 + #define DX_HASH_LEGACY_UNSIGNED 3 1993 1993 #define DX_HASH_HALF_MD4_UNSIGNED 4 1994 1994 #define DX_HASH_TEA_UNSIGNED 5 1995 1995 ··· 2000 2000 struct shash_desc shash; 2001 2001 char ctx[4]; 2002 2002 } desc; 2003 - int err; 2004 2003 2005 2004 BUG_ON(crypto_shash_descsize(sbi->s_chksum_driver)!=sizeof(desc.ctx)); 2006 2005 ··· 2007 2008 desc.shash.flags = 0; 2008 2009 *(u32 *)desc.ctx = crc; 2009 2010 2010 - err = crypto_shash_update(&desc.shash, address, length); 2011 - BUG_ON(err); 2011 + BUG_ON(crypto_shash_update(&desc.shash, address, length)); 2012 2012 2013 2013 return *(u32 *)desc.ctx; 2014 2014 }
+1 -13
fs/ext4/ext4_extents.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2003-2006, Cluster File Systems, Inc, info@clusterfs.com 3 4 * Written by Alex Tomas <alex@clusterfs.com> 4 - * 5 - * This program is free software; you can redistribute it and/or modify 6 - * it under the terms of the GNU General Public License version 2 as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it will be useful, 10 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 - * GNU General Public License for more details. 13 - * 14 - * You should have received a copy of the GNU General Public License 15 - * along with this program; if not, write to the Free Software 16 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111- 17 5 */ 18 6 19 7 #ifndef _EXT4_EXTENTS
+1 -4
fs/ext4/ext4_jbd2.h
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * ext4_jbd2.h 3 4 * 4 5 * Written by Stephen C. Tweedie <sct@redhat.com>, 1999 5 6 * 6 7 * Copyright 1998--1999 Red Hat corp --- All Rights Reserved 7 - * 8 - * This file is part of the Linux kernel and is made available under 9 - * the terms of the GNU General Public License, version 2, or at your 10 - * option, any later version, incorporated herein by reference. 11 8 * 12 9 * Ext4-specific journaling extensions. 13 10 */
+1 -13
fs/ext4/extents.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2003-2006, Cluster File Systems, Inc, info@clusterfs.com 3 4 * Written by Alex Tomas <alex@clusterfs.com> ··· 6 5 * Architecture independence: 7 6 * Copyright (c) 2005, Bull S.A. 8 7 * Written by Pierre Peiffer <pierre.peiffer@bull.net> 9 - * 10 - * This program is free software; you can redistribute it and/or modify 11 - * it under the terms of the GNU General Public License version 2 as 12 - * published by the Free Software Foundation. 13 - * 14 - * This program is distributed in the hope that it will be useful, 15 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 - * GNU General Public License for more details. 18 - * 19 - * You should have received a copy of the GNU General Public License 20 - * along with this program; if not, write to the Free Software 21 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111- 22 8 */ 23 9 24 10 /*
+1 -1
fs/ext4/extents_status.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 1 + // SPDX-License-Identifier: GPL-2.0 2 2 /* 3 3 * fs/ext4/extents_status.h 4 4 *
+8 -2
fs/ext4/file.c
··· 280 280 static int ext4_dax_huge_fault(struct vm_fault *vmf, 281 281 enum page_entry_size pe_size) 282 282 { 283 - int result; 283 + int result, error = 0; 284 + int retries = 0; 284 285 handle_t *handle = NULL; 285 286 struct inode *inode = file_inode(vmf->vma->vm_file); 286 287 struct super_block *sb = inode->i_sb; ··· 305 304 sb_start_pagefault(sb); 306 305 file_update_time(vmf->vma->vm_file); 307 306 down_read(&EXT4_I(inode)->i_mmap_sem); 307 + retry: 308 308 handle = ext4_journal_start_sb(sb, EXT4_HT_WRITE_PAGE, 309 309 EXT4_DATA_TRANS_BLOCKS(sb)); 310 310 if (IS_ERR(handle)) { ··· 316 314 } else { 317 315 down_read(&EXT4_I(inode)->i_mmap_sem); 318 316 } 319 - result = dax_iomap_fault(vmf, pe_size, &pfn, &ext4_iomap_ops); 317 + result = dax_iomap_fault(vmf, pe_size, &pfn, &error, &ext4_iomap_ops); 320 318 if (write) { 321 319 ext4_journal_stop(handle); 320 + 321 + if ((result & VM_FAULT_ERROR) && error == -ENOSPC && 322 + ext4_should_retry_alloc(sb, &retries)) 323 + goto retry; 322 324 /* Handling synchronous page fault? */ 323 325 if (result & VM_FAULT_NEEDDSYNC) 324 326 result = dax_finish_sync_fault(vmf, pe_size, pfn);
+1 -14
fs/ext4/fsmap.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2017 Oracle. All Rights Reserved. 3 4 * 4 5 * Author: Darrick J. Wong <darrick.wong@oracle.com> 5 - * 6 - * This program is free software; you can redistribute it and/or 7 - * modify it under the terms of the GNU General Public License 8 - * as published by the Free Software Foundation; either version 2 9 - * of the License, or (at your option) any later version. 10 - * 11 - * This program is distributed in the hope that it would be useful, 12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 - * GNU General Public License for more details. 15 - * 16 - * You should have received a copy of the GNU General Public License 17 - * along with this program; if not, write the Free Software Foundation, 18 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. 19 6 */ 20 7 #include "ext4.h" 21 8 #include <linux/fsmap.h>
+1 -14
fs/ext4/fsmap.h
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2017 Oracle. All Rights Reserved. 3 4 * 4 5 * Author: Darrick J. Wong <darrick.wong@oracle.com> 5 - * 6 - * This program is free software; you can redistribute it and/or 7 - * modify it under the terms of the GNU General Public License 8 - * as published by the Free Software Foundation; either version 2 9 - * of the License, or (at your option) any later version. 10 - * 11 - * This program is distributed in the hope that it would be useful, 12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 - * GNU General Public License for more details. 15 - * 16 - * You should have received a copy of the GNU General Public License 17 - * along with this program; if not, write the Free Software Foundation, 18 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. 19 6 */ 20 7 #ifndef __EXT4_FSMAP_H__ 21 8 #define __EXT4_FSMAP_H__
+1 -5
fs/ext4/hash.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * linux/fs/ext4/hash.c 3 4 * 4 5 * Copyright (C) 2002 by Theodore Ts'o 5 - * 6 - * This file is released under the GPL v2. 7 - * 8 - * This file may be redistributed under the terms of the GNU Public 9 - * License. 10 6 */ 11 7 12 8 #include <linux/fs.h>
+2 -2
fs/ext4/ialloc.c
··· 303 303 /* Do this BEFORE marking the inode not in use or returning an error */ 304 304 ext4_clear_inode(inode); 305 305 306 - es = EXT4_SB(sb)->s_es; 306 + es = sbi->s_es; 307 307 if (ino < EXT4_FIRST_INO(sb) || ino > le32_to_cpu(es->s_inodes_count)) { 308 308 ext4_error(sb, "reserved or nonexistent inode %lu", ino); 309 309 goto error_return; ··· 1157 1157 ext4_clear_state_flags(ei); /* Only relevant on 32-bit archs */ 1158 1158 ext4_set_inode_state(inode, EXT4_STATE_NEW); 1159 1159 1160 - ei->i_extra_isize = EXT4_SB(sb)->s_want_extra_isize; 1160 + ei->i_extra_isize = sbi->s_want_extra_isize; 1161 1161 ei->i_inline_off = 0; 1162 1162 if (ext4_has_feature_inline_data(sb)) 1163 1163 ext4_set_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA);
+1 -9
fs/ext4/inline.c
··· 1 + // SPDX-License-Identifier: LGPL-2.1 1 2 /* 2 3 * Copyright (c) 2012 Taobao. 3 4 * Written by Tao Ma <boyu.mt@taobao.com> 4 - * 5 - * This program is free software; you can redistribute it and/or modify it 6 - * under the terms of version 2.1 of the GNU Lesser General Public License 7 - * as published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it will be useful, 10 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 - * GNU General Public License for more details. 13 5 */ 14 6 15 7 #include <linux/iomap.h>
+12 -4
fs/ext4/inode.c
··· 3768 3768 /* Credits for sb + inode write */ 3769 3769 handle = ext4_journal_start(inode, EXT4_HT_INODE, 2); 3770 3770 if (IS_ERR(handle)) { 3771 - /* This is really bad luck. We've written the data 3772 - * but cannot extend i_size. Bail out and pretend 3773 - * the write failed... */ 3774 - ret = PTR_ERR(handle); 3771 + /* 3772 + * We wrote the data but cannot extend 3773 + * i_size. Bail out. In async io case, we do 3774 + * not return error here because we have 3775 + * already submmitted the corresponding 3776 + * bio. Returning error here makes the caller 3777 + * think that this IO is done and failed 3778 + * resulting in race with bio's completion 3779 + * handler. 3780 + */ 3781 + if (!ret) 3782 + ret = PTR_ERR(handle); 3775 3783 if (inode->i_nlink) 3776 3784 ext4_orphan_del(NULL, inode); 3777 3785
+8 -20
fs/ext4/mballoc.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2003-2006, Cluster File Systems, Inc, info@clusterfs.com 3 4 * Written by Alex Tomas <alex@clusterfs.com> 4 - * 5 - * This program is free software; you can redistribute it and/or modify 6 - * it under the terms of the GNU General Public License version 2 as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it will be useful, 10 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 - * GNU General Public License for more details. 13 - * 14 - * You should have received a copy of the GNU General Public License 15 - * along with this program; if not, write to the Free Software 16 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111- 17 5 */ 18 6 19 7 ··· 757 769 clear_bit(EXT4_GROUP_INFO_NEED_INIT_BIT, &(grp->bb_state)); 758 770 759 771 period = get_cycles() - period; 760 - spin_lock(&EXT4_SB(sb)->s_bal_lock); 761 - EXT4_SB(sb)->s_mb_buddies_generated++; 762 - EXT4_SB(sb)->s_mb_generation_time += period; 763 - spin_unlock(&EXT4_SB(sb)->s_bal_lock); 772 + spin_lock(&sbi->s_bal_lock); 773 + sbi->s_mb_buddies_generated++; 774 + sbi->s_mb_generation_time += period; 775 + spin_unlock(&sbi->s_bal_lock); 764 776 } 765 777 766 778 static void mb_regenerate_buddy(struct ext4_buddy *e4b) ··· 1447 1459 ext4_fsblk_t blocknr; 1448 1460 1449 1461 blocknr = ext4_group_first_block_no(sb, e4b->bd_group); 1450 - blocknr += EXT4_C2B(EXT4_SB(sb), block); 1462 + blocknr += EXT4_C2B(sbi, block); 1451 1463 ext4_grp_locked_error(sb, e4b->bd_group, 1452 1464 inode ? inode->i_ino : 0, 1453 1465 blocknr, ··· 4838 4850 if (in_range(ext4_block_bitmap(sb, gdp), block, count) || 4839 4851 in_range(ext4_inode_bitmap(sb, gdp), block, count) || 4840 4852 in_range(block, ext4_inode_table(sb, gdp), 4841 - EXT4_SB(sb)->s_itb_per_group) || 4853 + sbi->s_itb_per_group) || 4842 4854 in_range(block + count - 1, ext4_inode_table(sb, gdp), 4843 - EXT4_SB(sb)->s_itb_per_group)) { 4855 + sbi->s_itb_per_group)) { 4844 4856 4845 4857 ext4_error(sb, "Freeing blocks in system zone - " 4846 4858 "Block = %llu, count = %lu", block, count);
+1 -1
fs/ext4/mballoc.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 1 + // SPDX-License-Identifier: GPL-2.0 2 2 /* 3 3 * fs/ext4/mballoc.h 4 4 *
+1 -8
fs/ext4/migrate.c
··· 1 + // SPDX-License-Identifier: LGPL-2.1 1 2 /* 2 3 * Copyright IBM Corporation, 2007 3 4 * Author Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> 4 - * 5 - * This program is free software; you can redistribute it and/or modify it 6 - * under the terms of version 2.1 of the GNU Lesser General Public License 7 - * as published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would be useful, but 10 - * WITHOUT ANY WARRANTY; without even the implied warranty of 11 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 5 * 13 6 */ 14 7
+1 -9
fs/ext4/move_extent.c
··· 1 + // SPDX-License-Identifier: LGPL-2.1 1 2 /* 2 3 * Copyright (c) 2008,2009 NEC Software Tohoku, Ltd. 3 4 * Written by Takashi Sato <t-sato@yk.jp.nec.com> 4 5 * Akira Fujita <a-fujita@rs.jp.nec.com> 5 - * 6 - * This program is free software; you can redistribute it and/or modify it 7 - * under the terms of version 2.1 of the GNU Lesser General Public License 8 - * as published by the Free Software Foundation. 9 - * 10 - * This program is distributed in the hope that it will be useful, 11 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 - * GNU General Public License for more details. 14 6 */ 15 7 16 8 #include <linux/fs.h>
+3 -3
fs/ext4/namei.c
··· 3222 3222 if (err) 3223 3223 return err; 3224 3224 3225 - if ((ext4_test_inode_flag(dir, EXT4_INODE_PROJINHERIT)) && 3226 - (!projid_eq(EXT4_I(dir)->i_projid, 3227 - EXT4_I(old_dentry->d_inode)->i_projid))) 3225 + if ((ext4_test_inode_flag(dir, EXT4_INODE_PROJINHERIT)) && 3226 + (!projid_eq(EXT4_I(dir)->i_projid, 3227 + EXT4_I(old_dentry->d_inode)->i_projid))) 3228 3228 return -EXDEV; 3229 3229 3230 3230 err = dquot_initialize(dir);
+1 -1
fs/ext4/resize.c
··· 1477 1477 goto exit_journal; 1478 1478 1479 1479 group = flex_gd->groups[0].group; 1480 - BUG_ON(group != EXT4_SB(sb)->s_groups_count); 1480 + BUG_ON(group != sbi->s_groups_count); 1481 1481 err = ext4_add_new_descs(handle, sb, group, 1482 1482 resize_inode, flex_gd->count); 1483 1483 if (err)
+5 -4
fs/ext4/super.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * linux/fs/ext4/super.c 3 4 * ··· 744 743 } 745 744 746 745 ext4_unlock_group(sb, grp); 746 + ext4_commit_super(sb, 1); 747 747 ext4_handle_error(sb); 748 748 /* 749 749 * We only get here in the ERRORS_RO case; relocking the group ··· 873 871 ext4_unregister_li_request(sb); 874 872 ext4_quota_off_umount(sb); 875 873 876 - flush_workqueue(sbi->rsv_conversion_wq); 877 874 destroy_workqueue(sbi->rsv_conversion_wq); 878 875 879 876 if (sbi->s_journal) { ··· 2678 2677 * compensate. 2679 2678 */ 2680 2679 if (sb->s_blocksize == 1024 && nr == 0 && 2681 - le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block) == 0) 2680 + le32_to_cpu(sbi->s_es->s_first_data_block) == 0) 2682 2681 has_super++; 2683 2682 2684 2683 return (has_super + ext4_group_first_block_no(sb, bg)); ··· 3123 3122 { 3124 3123 struct ext4_sb_info *sbi = EXT4_SB(sb); 3125 3124 struct ext4_li_request *elr = NULL; 3126 - ext4_group_t ngroups = EXT4_SB(sb)->s_groups_count; 3125 + ext4_group_t ngroups = sbi->s_groups_count; 3127 3126 int ret = 0; 3128 3127 3129 3128 mutex_lock(&ext4_li_mtx); ··· 4838 4837 bool needs_barrier = false; 4839 4838 struct ext4_sb_info *sbi = EXT4_SB(sb); 4840 4839 4841 - if (unlikely(ext4_forced_shutdown(EXT4_SB(sb)))) 4840 + if (unlikely(ext4_forced_shutdown(sbi))) 4842 4841 return 0; 4843 4842 4844 4843 trace_ext4_sync_fs(sb, wait);
+48 -19
fs/ext4/sysfs.c
··· 11 11 #include <linux/time.h> 12 12 #include <linux/fs.h> 13 13 #include <linux/seq_file.h> 14 + #include <linux/slab.h> 14 15 #include <linux/proc_fs.h> 15 16 16 17 #include "ext4.h" ··· 330 329 complete(&sbi->s_kobj_unregister); 331 330 } 332 331 332 + static void ext4_kset_release(struct kobject *kobj) 333 + { 334 + struct kset *kset = container_of(kobj, struct kset, kobj); 335 + 336 + kfree(kset); 337 + } 338 + 333 339 static const struct sysfs_ops ext4_attr_ops = { 334 340 .show = ext4_attr_show, 335 341 .store = ext4_attr_store, ··· 350 342 351 343 static struct kobj_type ext4_ktype = { 352 344 .sysfs_ops = &ext4_attr_ops, 345 + .release = ext4_kset_release, 353 346 }; 354 347 355 - static struct kset ext4_kset = { 356 - .kobj = {.ktype = &ext4_ktype}, 357 - }; 348 + static struct kset *ext4_kset; 358 349 359 350 static struct kobj_type ext4_feat_ktype = { 360 351 .default_attrs = ext4_feat_attrs, 361 352 .sysfs_ops = &ext4_attr_ops, 353 + .release = (void (*)(struct kobject *))kfree, 362 354 }; 363 355 364 - static struct kobject ext4_feat = { 365 - .kset = &ext4_kset, 366 - }; 356 + static struct kobject *ext4_feat; 367 357 368 358 #define PROC_FILE_SHOW_DEFN(name) \ 369 359 static int name##_open(struct inode *inode, struct file *file) \ ··· 398 392 const struct ext4_proc_files *p; 399 393 int err; 400 394 401 - sbi->s_kobj.kset = &ext4_kset; 395 + sbi->s_kobj.kset = ext4_kset; 402 396 init_completion(&sbi->s_kobj_unregister); 403 397 err = kobject_init_and_add(&sbi->s_kobj, &ext4_sb_ktype, NULL, 404 398 "%s", sb->s_id); 405 - if (err) 399 + if (err) { 400 + kobject_put(&sbi->s_kobj); 401 + wait_for_completion(&sbi->s_kobj_unregister); 406 402 return err; 403 + } 407 404 408 405 if (ext4_proc_root) 409 406 sbi->s_proc = proc_mkdir(sb->s_id, ext4_proc_root); ··· 436 427 { 437 428 int ret; 438 429 439 - kobject_set_name(&ext4_kset.kobj, "ext4"); 440 - ext4_kset.kobj.parent = fs_kobj; 441 - ret = kset_register(&ext4_kset); 442 - if (ret) 443 - return ret; 430 + ext4_kset = kzalloc(sizeof(*ext4_kset), GFP_KERNEL); 431 + if (!ext4_kset) 432 + return -ENOMEM; 444 433 445 - ret = kobject_init_and_add(&ext4_feat, &ext4_feat_ktype, 434 + kobject_set_name(&ext4_kset->kobj, "ext4"); 435 + ext4_kset->kobj.parent = fs_kobj; 436 + ext4_kset->kobj.ktype = &ext4_ktype; 437 + ret = kset_register(ext4_kset); 438 + if (ret) 439 + goto kset_err; 440 + 441 + ext4_feat = kzalloc(sizeof(*ext4_feat), GFP_KERNEL); 442 + if (!ext4_feat) { 443 + ret = -ENOMEM; 444 + goto kset_err; 445 + } 446 + 447 + ext4_feat->kset = ext4_kset; 448 + ret = kobject_init_and_add(ext4_feat, &ext4_feat_ktype, 446 449 NULL, "features"); 447 450 if (ret) 448 - kset_unregister(&ext4_kset); 449 - else 450 - ext4_proc_root = proc_mkdir(proc_dirname, NULL); 451 + goto feat_err; 452 + 453 + ext4_proc_root = proc_mkdir(proc_dirname, NULL); 454 + return ret; 455 + 456 + feat_err: 457 + kobject_put(ext4_feat); 458 + kset_err: 459 + kset_unregister(ext4_kset); 460 + ext4_kset = NULL; 451 461 return ret; 452 462 } 453 463 454 464 void ext4_exit_sysfs(void) 455 465 { 456 - kobject_put(&ext4_feat); 457 - kset_unregister(&ext4_kset); 466 + kobject_put(ext4_feat); 467 + kset_unregister(ext4_kset); 468 + ext4_kset = NULL; 458 469 remove_proc_entry(proc_dirname, NULL); 459 470 ext4_proc_root = NULL; 460 471 }
+1 -1
fs/ext4/truncate.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 1 + // SPDX-License-Identifier: GPL-2.0 2 2 /* 3 3 * linux/fs/ext4/truncate.h 4 4 *
+1 -1
fs/ext4/xattr.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 1 + // SPDX-License-Identifier: GPL-2.0 2 2 /* 3 3 File: fs/ext4/xattr.h 4 4
+1 -4
fs/jbd2/checkpoint.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * linux/fs/jbd2/checkpoint.c 3 4 * 4 5 * Written by Stephen C. Tweedie <sct@redhat.com>, 1999 5 6 * 6 7 * Copyright 1999 Red Hat Software --- All Rights Reserved 7 - * 8 - * This file is part of the Linux kernel and is made available under 9 - * the terms of the GNU General Public License, version 2, or at your 10 - * option, any later version, incorporated herein by reference. 11 8 * 12 9 * Checkpoint routines for the generic filesystem journaling code. 13 10 * Part of the ext2fs journaling system.
+1 -4
fs/jbd2/commit.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * linux/fs/jbd2/commit.c 3 4 * 4 5 * Written by Stephen C. Tweedie <sct@redhat.com>, 1998 5 6 * 6 7 * Copyright 1998 Red Hat corp --- All Rights Reserved 7 - * 8 - * This file is part of the Linux kernel and is made available under 9 - * the terms of the GNU General Public License, version 2, or at your 10 - * option, any later version, incorporated herein by reference. 11 8 * 12 9 * Journal commit routines for the generic filesystem journaling code; 13 10 * part of the ext2fs journaling system.
+1 -4
fs/jbd2/journal.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * linux/fs/jbd2/journal.c 3 4 * 4 5 * Written by Stephen C. Tweedie <sct@redhat.com>, 1998 5 6 * 6 7 * Copyright 1998 Red Hat corp --- All Rights Reserved 7 - * 8 - * This file is part of the Linux kernel and is made available under 9 - * the terms of the GNU General Public License, version 2, or at your 10 - * option, any later version, incorporated herein by reference. 11 8 * 12 9 * Generic filesystem journal-writing code; part of the ext2fs 13 10 * journaling system.
+1 -4
fs/jbd2/recovery.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * linux/fs/jbd2/recovery.c 3 4 * 4 5 * Written by Stephen C. Tweedie <sct@redhat.com>, 1999 5 6 * 6 7 * Copyright 1999-2000 Red Hat Software --- All Rights Reserved 7 - * 8 - * This file is part of the Linux kernel and is made available under 9 - * the terms of the GNU General Public License, version 2, or at your 10 - * option, any later version, incorporated herein by reference. 11 8 * 12 9 * Journal recovery routines for the generic filesystem journaling code; 13 10 * part of the ext2fs journaling system.
+1 -4
fs/jbd2/revoke.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * linux/fs/jbd2/revoke.c 3 4 * 4 5 * Written by Stephen C. Tweedie <sct@redhat.com>, 2000 5 6 * 6 7 * Copyright 2000 Red Hat corp --- All Rights Reserved 7 - * 8 - * This file is part of the Linux kernel and is made available under 9 - * the terms of the GNU General Public License, version 2, or at your 10 - * option, any later version, incorporated herein by reference. 11 8 * 12 9 * Journal revoke routines for the generic filesystem journaling code; 13 10 * part of the ext2fs journaling system.
+5 -5
fs/jbd2/transaction.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * linux/fs/jbd2/transaction.c 3 4 * 4 5 * Written by Stephen C. Tweedie <sct@redhat.com>, 1998 5 6 * 6 7 * Copyright 1998 Red Hat corp --- All Rights Reserved 7 - * 8 - * This file is part of the Linux kernel and is made available under 9 - * the terms of the GNU General Public License, version 2, or at your 10 - * option, any later version, incorporated herein by reference. 11 8 * 12 9 * Generic filesystem transaction handling code; part of the ext2fs 13 10 * journaling system. ··· 492 495 EXPORT_SYMBOL(jbd2_journal_free_reserved); 493 496 494 497 /** 495 - * int jbd2_journal_start_reserved(handle_t *handle) - start reserved handle 498 + * int jbd2_journal_start_reserved() - start reserved handle 496 499 * @handle: handle to start 500 + * @type: for handle statistics 501 + * @line_no: for handle statistics 497 502 * 498 503 * Start handle that has been previously reserved with jbd2_journal_reserve(). 499 504 * This attaches @handle to the running transaction (or creates one if there's ··· 625 626 * int jbd2_journal_restart() - restart a handle . 626 627 * @handle: handle to restart 627 628 * @nblocks: nr credits requested 629 + * @gfp_mask: memory allocation flags (for start_this_handle) 628 630 * 629 631 * Restart a handle for a multi-transaction filesystem 630 632 * operation.
+4 -4
fs/mbcache.c
··· 94 94 entry->e_key = key; 95 95 entry->e_value = value; 96 96 entry->e_reusable = reusable; 97 + entry->e_referenced = 0; 97 98 head = mb_cache_entry_head(cache, key); 98 99 hlist_bl_lock(head); 99 100 hlist_bl_for_each_entry(dup, dup_node, head, e_hash_list) { ··· 239 238 spin_lock(&cache->c_list_lock); 240 239 if (!list_empty(&entry->e_list)) { 241 240 list_del_init(&entry->e_list); 242 - cache->c_entry_count--; 241 + if (!WARN_ONCE(cache->c_entry_count == 0, 242 + "mbcache: attempt to decrement c_entry_count past zero")) 243 + cache->c_entry_count--; 243 244 atomic_dec(&entry->e_refcnt); 244 245 } 245 246 spin_unlock(&cache->c_list_lock); ··· 272 269 struct mb_cache *cache = container_of(shrink, struct mb_cache, 273 270 c_shrink); 274 271 275 - /* Unlikely, but not impossible */ 276 - if (unlikely(cache->c_entry_count < 0)) 277 - return 0; 278 272 return cache->c_entry_count; 279 273 } 280 274
+1 -1
fs/xfs/xfs_file.c
··· 1048 1048 if (IS_DAX(inode)) { 1049 1049 pfn_t pfn; 1050 1050 1051 - ret = dax_iomap_fault(vmf, pe_size, &pfn, &xfs_iomap_ops); 1051 + ret = dax_iomap_fault(vmf, pe_size, &pfn, NULL, &xfs_iomap_ops); 1052 1052 if (ret & VM_FAULT_NEEDDSYNC) 1053 1053 ret = dax_finish_sync_fault(vmf, pe_size, pfn); 1054 1054 } else {
+1 -1
include/linux/dax.h
··· 96 96 ssize_t dax_iomap_rw(struct kiocb *iocb, struct iov_iter *iter, 97 97 const struct iomap_ops *ops); 98 98 int dax_iomap_fault(struct vm_fault *vmf, enum page_entry_size pe_size, 99 - pfn_t *pfnp, const struct iomap_ops *ops); 99 + pfn_t *pfnp, int *errp, const struct iomap_ops *ops); 100 100 int dax_finish_sync_fault(struct vm_fault *vmf, enum page_entry_size pe_size, 101 101 pfn_t pfn); 102 102 int dax_delete_mapping_entry(struct address_space *mapping, pgoff_t index);
+268 -163
include/linux/jbd2.h
··· 418 418 #define JI_WAIT_DATA (1 << __JI_WAIT_DATA) 419 419 420 420 /** 421 - * struct jbd_inode is the structure linking inodes in ordered mode 422 - * present in a transaction so that we can sync them during commit. 421 + * struct jbd_inode - The jbd_inode type is the structure linking inodes in 422 + * ordered mode present in a transaction so that we can sync them during commit. 423 423 */ 424 424 struct jbd2_inode { 425 - /* Which transaction does this inode belong to? Either the running 426 - * transaction or the committing one. [j_list_lock] */ 425 + /** 426 + * @i_transaction: 427 + * 428 + * Which transaction does this inode belong to? Either the running 429 + * transaction or the committing one. [j_list_lock] 430 + */ 427 431 transaction_t *i_transaction; 428 432 429 - /* Pointer to the running transaction modifying inode's data in case 430 - * there is already a committing transaction touching it. [j_list_lock] */ 433 + /** 434 + * @i_next_transaction: 435 + * 436 + * Pointer to the running transaction modifying inode's data in case 437 + * there is already a committing transaction touching it. [j_list_lock] 438 + */ 431 439 transaction_t *i_next_transaction; 432 440 433 - /* List of inodes in the i_transaction [j_list_lock] */ 441 + /** 442 + * @i_list: List of inodes in the i_transaction [j_list_lock] 443 + */ 434 444 struct list_head i_list; 435 445 436 - /* VFS inode this inode belongs to [constant during the lifetime 437 - * of the structure] */ 446 + /** 447 + * @i_vfs_inode: 448 + * 449 + * VFS inode this inode belongs to [constant for lifetime of structure] 450 + */ 438 451 struct inode *i_vfs_inode; 439 452 440 - /* Flags of inode [j_list_lock] */ 453 + /** 454 + * @i_flags: Flags of inode [j_list_lock] 455 + */ 441 456 unsigned long i_flags; 442 457 }; 443 458 ··· 462 447 * struct handle_s - The handle_s type is the concrete type associated with 463 448 * handle_t. 464 449 * @h_transaction: Which compound transaction is this update a part of? 450 + * @h_journal: Which journal handle belongs to - used iff h_reserved set. 451 + * @h_rsv_handle: Handle reserved for finishing the logical operation. 465 452 * @h_buffer_credits: Number of remaining buffers we are allowed to dirty. 466 - * @h_ref: Reference count on this handle 467 - * @h_err: Field for caller's use to track errors through large fs operations 468 - * @h_sync: flag for sync-on-close 469 - * @h_jdata: flag to force data journaling 470 - * @h_aborted: flag indicating fatal error on handle 453 + * @h_ref: Reference count on this handle. 454 + * @h_err: Field for caller's use to track errors through large fs operations. 455 + * @h_sync: Flag for sync-on-close. 456 + * @h_jdata: Flag to force data journaling. 457 + * @h_reserved: Flag for handle for reserved credits. 458 + * @h_aborted: Flag indicating fatal error on handle. 459 + * @h_type: For handle statistics. 460 + * @h_line_no: For handle statistics. 461 + * @h_start_jiffies: Handle Start time. 462 + * @h_requested_credits: Holds @h_buffer_credits after handle is started. 463 + * @saved_alloc_context: Saved context while transaction is open. 471 464 **/ 472 465 473 466 /* Docbook can't yet cope with the bit fields, but will leave the documentation ··· 485 462 struct jbd2_journal_handle 486 463 { 487 464 union { 488 - /* Which compound transaction is this update a part of? */ 489 465 transaction_t *h_transaction; 490 466 /* Which journal handle belongs to - used iff h_reserved set */ 491 467 journal_t *h_journal; 492 468 }; 493 469 494 - /* Handle reserved for finishing the logical operation */ 495 470 handle_t *h_rsv_handle; 496 - 497 - /* Number of remaining buffers we are allowed to dirty: */ 498 471 int h_buffer_credits; 499 - 500 - /* Reference count on this handle */ 501 472 int h_ref; 502 - 503 - /* Field for caller's use to track errors through large fs */ 504 - /* operations */ 505 473 int h_err; 506 474 507 475 /* Flags [no locking] */ 508 - unsigned int h_sync: 1; /* sync-on-close */ 509 - unsigned int h_jdata: 1; /* force data journaling */ 510 - unsigned int h_reserved: 1; /* handle with reserved credits */ 511 - unsigned int h_aborted: 1; /* fatal error on handle */ 512 - unsigned int h_type: 8; /* for handle statistics */ 513 - unsigned int h_line_no: 16; /* for handle statistics */ 476 + unsigned int h_sync: 1; 477 + unsigned int h_jdata: 1; 478 + unsigned int h_reserved: 1; 479 + unsigned int h_aborted: 1; 480 + unsigned int h_type: 8; 481 + unsigned int h_line_no: 16; 514 482 515 483 unsigned long h_start_jiffies; 516 484 unsigned int h_requested_credits; ··· 743 729 /** 744 730 * struct journal_s - The journal_s type is the concrete type associated with 745 731 * journal_t. 746 - * @j_flags: General journaling state flags 747 - * @j_errno: Is there an outstanding uncleared error on the journal (from a 748 - * prior abort)? 749 - * @j_sb_buffer: First part of superblock buffer 750 - * @j_superblock: Second part of superblock buffer 751 - * @j_format_version: Version of the superblock format 752 - * @j_state_lock: Protect the various scalars in the journal 753 - * @j_barrier_count: Number of processes waiting to create a barrier lock 754 - * @j_barrier: The barrier lock itself 755 - * @j_running_transaction: The current running transaction.. 756 - * @j_committing_transaction: the transaction we are pushing to disk 757 - * @j_checkpoint_transactions: a linked circular list of all transactions 758 - * waiting for checkpointing 759 - * @j_wait_transaction_locked: Wait queue for waiting for a locked transaction 760 - * to start committing, or for a barrier lock to be released 761 - * @j_wait_done_commit: Wait queue for waiting for commit to complete 762 - * @j_wait_commit: Wait queue to trigger commit 763 - * @j_wait_updates: Wait queue to wait for updates to complete 764 - * @j_wait_reserved: Wait queue to wait for reserved buffer credits to drop 765 - * @j_checkpoint_mutex: Mutex for locking against concurrent checkpoints 766 - * @j_head: Journal head - identifies the first unused block in the journal 767 - * @j_tail: Journal tail - identifies the oldest still-used block in the 768 - * journal. 769 - * @j_free: Journal free - how many free blocks are there in the journal? 770 - * @j_first: The block number of the first usable block 771 - * @j_last: The block number one beyond the last usable block 772 - * @j_dev: Device where we store the journal 773 - * @j_blocksize: blocksize for the location where we store the journal. 774 - * @j_blk_offset: starting block offset for into the device where we store the 775 - * journal 776 - * @j_fs_dev: Device which holds the client fs. For internal journal this will 777 - * be equal to j_dev 778 - * @j_reserved_credits: Number of buffers reserved from the running transaction 779 - * @j_maxlen: Total maximum capacity of the journal region on disk. 780 - * @j_list_lock: Protects the buffer lists and internal buffer state. 781 - * @j_inode: Optional inode where we store the journal. If present, all journal 782 - * block numbers are mapped into this inode via bmap(). 783 - * @j_tail_sequence: Sequence number of the oldest transaction in the log 784 - * @j_transaction_sequence: Sequence number of the next transaction to grant 785 - * @j_commit_sequence: Sequence number of the most recently committed 786 - * transaction 787 - * @j_commit_request: Sequence number of the most recent transaction wanting 788 - * commit 789 - * @j_uuid: Uuid of client object. 790 - * @j_task: Pointer to the current commit thread for this journal 791 - * @j_max_transaction_buffers: Maximum number of metadata buffers to allow in a 792 - * single compound commit transaction 793 - * @j_commit_interval: What is the maximum transaction lifetime before we begin 794 - * a commit? 795 - * @j_commit_timer: The timer used to wakeup the commit thread 796 - * @j_revoke_lock: Protect the revoke table 797 - * @j_revoke: The revoke table - maintains the list of revoked blocks in the 798 - * current transaction. 799 - * @j_revoke_table: alternate revoke tables for j_revoke 800 - * @j_wbuf: array of buffer_heads for jbd2_journal_commit_transaction 801 - * @j_wbufsize: maximum number of buffer_heads allowed in j_wbuf, the 802 - * number that will fit in j_blocksize 803 - * @j_last_sync_writer: most recent pid which did a synchronous write 804 - * @j_history_lock: Protect the transactions statistics history 805 - * @j_proc_entry: procfs entry for the jbd statistics directory 806 - * @j_stats: Overall statistics 807 - * @j_private: An opaque pointer to fs-private information. 808 - * @j_trans_commit_map: Lockdep entity to track transaction commit dependencies 809 732 */ 810 - 811 733 struct journal_s 812 734 { 813 - /* General journaling state flags [j_state_lock] */ 735 + /** 736 + * @j_flags: General journaling state flags [j_state_lock] 737 + */ 814 738 unsigned long j_flags; 815 739 816 - /* 740 + /** 741 + * @j_errno: 742 + * 817 743 * Is there an outstanding uncleared error on the journal (from a prior 818 744 * abort)? [j_state_lock] 819 745 */ 820 746 int j_errno; 821 747 822 - /* The superblock buffer */ 748 + /** 749 + * @j_sb_buffer: The first part of the superblock buffer. 750 + */ 823 751 struct buffer_head *j_sb_buffer; 752 + 753 + /** 754 + * @j_superblock: The second part of the superblock buffer. 755 + */ 824 756 journal_superblock_t *j_superblock; 825 757 826 - /* Version of the superblock format */ 758 + /** 759 + * @j_format_version: Version of the superblock format. 760 + */ 827 761 int j_format_version; 828 762 829 - /* 830 - * Protect the various scalars in the journal 763 + /** 764 + * @j_state_lock: Protect the various scalars in the journal. 831 765 */ 832 766 rwlock_t j_state_lock; 833 767 834 - /* 768 + /** 769 + * @j_barrier_count: 770 + * 835 771 * Number of processes waiting to create a barrier lock [j_state_lock] 836 772 */ 837 773 int j_barrier_count; 838 774 839 - /* The barrier lock itself */ 775 + /** 776 + * @j_barrier: The barrier lock itself. 777 + */ 840 778 struct mutex j_barrier; 841 779 842 - /* 780 + /** 781 + * @j_running_transaction: 782 + * 843 783 * Transactions: The current running transaction... 844 784 * [j_state_lock] [caller holding open handle] 845 785 */ 846 786 transaction_t *j_running_transaction; 847 787 848 - /* 788 + /** 789 + * @j_committing_transaction: 790 + * 849 791 * the transaction we are pushing to disk 850 792 * [j_state_lock] [caller holding open handle] 851 793 */ 852 794 transaction_t *j_committing_transaction; 853 795 854 - /* 796 + /** 797 + * @j_checkpoint_transactions: 798 + * 855 799 * ... and a linked circular list of all transactions waiting for 856 800 * checkpointing. [j_list_lock] 857 801 */ 858 802 transaction_t *j_checkpoint_transactions; 859 803 860 - /* 804 + /** 805 + * @j_wait_transaction_locked: 806 + * 861 807 * Wait queue for waiting for a locked transaction to start committing, 862 - * or for a barrier lock to be released 808 + * or for a barrier lock to be released. 863 809 */ 864 810 wait_queue_head_t j_wait_transaction_locked; 865 811 866 - /* Wait queue for waiting for commit to complete */ 812 + /** 813 + * @j_wait_done_commit: Wait queue for waiting for commit to complete. 814 + */ 867 815 wait_queue_head_t j_wait_done_commit; 868 816 869 - /* Wait queue to trigger commit */ 817 + /** 818 + * @j_wait_commit: Wait queue to trigger commit. 819 + */ 870 820 wait_queue_head_t j_wait_commit; 871 821 872 - /* Wait queue to wait for updates to complete */ 822 + /** 823 + * @j_wait_updates: Wait queue to wait for updates to complete. 824 + */ 873 825 wait_queue_head_t j_wait_updates; 874 826 875 - /* Wait queue to wait for reserved buffer credits to drop */ 827 + /** 828 + * @j_wait_reserved: 829 + * 830 + * Wait queue to wait for reserved buffer credits to drop. 831 + */ 876 832 wait_queue_head_t j_wait_reserved; 877 833 878 - /* Semaphore for locking against concurrent checkpoints */ 834 + /** 835 + * @j_checkpoint_mutex: 836 + * 837 + * Semaphore for locking against concurrent checkpoints. 838 + */ 879 839 struct mutex j_checkpoint_mutex; 880 840 881 - /* 841 + /** 842 + * @j_chkpt_bhs: 843 + * 882 844 * List of buffer heads used by the checkpoint routine. This 883 845 * was moved from jbd2_log_do_checkpoint() to reduce stack 884 846 * usage. Access to this array is controlled by the 885 - * j_checkpoint_mutex. [j_checkpoint_mutex] 847 + * @j_checkpoint_mutex. [j_checkpoint_mutex] 886 848 */ 887 849 struct buffer_head *j_chkpt_bhs[JBD2_NR_BATCH]; 888 - 889 - /* 850 + 851 + /** 852 + * @j_head: 853 + * 890 854 * Journal head: identifies the first unused block in the journal. 891 855 * [j_state_lock] 892 856 */ 893 857 unsigned long j_head; 894 858 895 - /* 859 + /** 860 + * @j_tail: 861 + * 896 862 * Journal tail: identifies the oldest still-used block in the journal. 897 863 * [j_state_lock] 898 864 */ 899 865 unsigned long j_tail; 900 866 901 - /* 867 + /** 868 + * @j_free: 869 + * 902 870 * Journal free: how many free blocks are there in the journal? 903 871 * [j_state_lock] 904 872 */ 905 873 unsigned long j_free; 906 874 907 - /* 908 - * Journal start and end: the block numbers of the first usable block 909 - * and one beyond the last usable block in the journal. [j_state_lock] 875 + /** 876 + * @j_first: 877 + * 878 + * The block number of the first usable block in the journal 879 + * [j_state_lock]. 910 880 */ 911 881 unsigned long j_first; 882 + 883 + /** 884 + * @j_last: 885 + * 886 + * The block number one beyond the last usable block in the journal 887 + * [j_state_lock]. 888 + */ 912 889 unsigned long j_last; 913 890 914 - /* 915 - * Device, blocksize and starting block offset for the location where we 916 - * store the journal. 891 + /** 892 + * @j_dev: Device where we store the journal. 917 893 */ 918 894 struct block_device *j_dev; 895 + 896 + /** 897 + * @j_blocksize: Block size for the location where we store the journal. 898 + */ 919 899 int j_blocksize; 900 + 901 + /** 902 + * @j_blk_offset: 903 + * 904 + * Starting block offset into the device where we store the journal. 905 + */ 920 906 unsigned long long j_blk_offset; 907 + 908 + /** 909 + * @j_devname: Journal device name. 910 + */ 921 911 char j_devname[BDEVNAME_SIZE+24]; 922 912 923 - /* 913 + /** 914 + * @j_fs_dev: 915 + * 924 916 * Device which holds the client fs. For internal journal this will be 925 917 * equal to j_dev. 926 918 */ 927 919 struct block_device *j_fs_dev; 928 920 929 - /* Total maximum capacity of the journal region on disk. */ 921 + /** 922 + * @j_maxlen: Total maximum capacity of the journal region on disk. 923 + */ 930 924 unsigned int j_maxlen; 931 925 932 - /* Number of buffers reserved from the running transaction */ 926 + /** 927 + * @j_reserved_credits: 928 + * 929 + * Number of buffers reserved from the running transaction. 930 + */ 933 931 atomic_t j_reserved_credits; 934 932 935 - /* 936 - * Protects the buffer lists and internal buffer state. 933 + /** 934 + * @j_list_lock: Protects the buffer lists and internal buffer state. 937 935 */ 938 936 spinlock_t j_list_lock; 939 937 940 - /* Optional inode where we store the journal. If present, all */ 941 - /* journal block numbers are mapped into this inode via */ 942 - /* bmap(). */ 938 + /** 939 + * @j_inode: 940 + * 941 + * Optional inode where we store the journal. If present, all 942 + * journal block numbers are mapped into this inode via bmap(). 943 + */ 943 944 struct inode *j_inode; 944 945 945 - /* 946 + /** 947 + * @j_tail_sequence: 948 + * 946 949 * Sequence number of the oldest transaction in the log [j_state_lock] 947 950 */ 948 951 tid_t j_tail_sequence; 949 952 950 - /* 953 + /** 954 + * @j_transaction_sequence: 955 + * 951 956 * Sequence number of the next transaction to grant [j_state_lock] 952 957 */ 953 958 tid_t j_transaction_sequence; 954 959 955 - /* 960 + /** 961 + * @j_commit_sequence: 962 + * 956 963 * Sequence number of the most recently committed transaction 957 964 * [j_state_lock]. 958 965 */ 959 966 tid_t j_commit_sequence; 960 967 961 - /* 968 + /** 969 + * @j_commit_request: 970 + * 962 971 * Sequence number of the most recent transaction wanting commit 963 972 * [j_state_lock] 964 973 */ 965 974 tid_t j_commit_request; 966 975 967 - /* 976 + /** 977 + * @j_uuid: 978 + * 968 979 * Journal uuid: identifies the object (filesystem, LVM volume etc) 969 980 * backed by this journal. This will eventually be replaced by an array 970 981 * of uuids, allowing us to index multiple devices within a single ··· 997 958 */ 998 959 __u8 j_uuid[16]; 999 960 1000 - /* Pointer to the current commit thread for this journal */ 961 + /** 962 + * @j_task: Pointer to the current commit thread for this journal. 963 + */ 1001 964 struct task_struct *j_task; 1002 965 1003 - /* 966 + /** 967 + * @j_max_transaction_buffers: 968 + * 1004 969 * Maximum number of metadata buffers to allow in a single compound 1005 - * commit transaction 970 + * commit transaction. 1006 971 */ 1007 972 int j_max_transaction_buffers; 1008 973 1009 - /* 974 + /** 975 + * @j_commit_interval: 976 + * 1010 977 * What is the maximum transaction lifetime before we begin a commit? 1011 978 */ 1012 979 unsigned long j_commit_interval; 1013 980 1014 - /* The timer used to wakeup the commit thread: */ 981 + /** 982 + * @j_commit_timer: The timer used to wakeup the commit thread. 983 + */ 1015 984 struct timer_list j_commit_timer; 1016 985 1017 - /* 1018 - * The revoke table: maintains the list of revoked blocks in the 1019 - * current transaction. [j_revoke_lock] 986 + /** 987 + * @j_revoke_lock: Protect the revoke table. 1020 988 */ 1021 989 spinlock_t j_revoke_lock; 990 + 991 + /** 992 + * @j_revoke: 993 + * 994 + * The revoke table - maintains the list of revoked blocks in the 995 + * current transaction. 996 + */ 1022 997 struct jbd2_revoke_table_s *j_revoke; 998 + 999 + /** 1000 + * @j_revoke_table: Alternate revoke tables for j_revoke. 1001 + */ 1023 1002 struct jbd2_revoke_table_s *j_revoke_table[2]; 1024 1003 1025 - /* 1026 - * array of bhs for jbd2_journal_commit_transaction 1004 + /** 1005 + * @j_wbuf: Array of bhs for jbd2_journal_commit_transaction. 1027 1006 */ 1028 1007 struct buffer_head **j_wbuf; 1008 + 1009 + /** 1010 + * @j_wbufsize: 1011 + * 1012 + * Size of @j_wbuf array. 1013 + */ 1029 1014 int j_wbufsize; 1030 1015 1031 - /* 1032 - * this is the pid of hte last person to run a synchronous operation 1033 - * through the journal 1016 + /** 1017 + * @j_last_sync_writer: 1018 + * 1019 + * The pid of the last person to run a synchronous operation 1020 + * through the journal. 1034 1021 */ 1035 1022 pid_t j_last_sync_writer; 1036 1023 1037 - /* 1038 - * the average amount of time in nanoseconds it takes to commit a 1024 + /** 1025 + * @j_average_commit_time: 1026 + * 1027 + * The average amount of time in nanoseconds it takes to commit a 1039 1028 * transaction to disk. [j_state_lock] 1040 1029 */ 1041 1030 u64 j_average_commit_time; 1042 1031 1043 - /* 1044 - * minimum and maximum times that we should wait for 1045 - * additional filesystem operations to get batched into a 1046 - * synchronous handle in microseconds 1032 + /** 1033 + * @j_min_batch_time: 1034 + * 1035 + * Minimum time that we should wait for additional filesystem operations 1036 + * to get batched into a synchronous handle in microseconds. 1047 1037 */ 1048 1038 u32 j_min_batch_time; 1039 + 1040 + /** 1041 + * @j_max_batch_time: 1042 + * 1043 + * Maximum time that we should wait for additional filesystem operations 1044 + * to get batched into a synchronous handle in microseconds. 1045 + */ 1049 1046 u32 j_max_batch_time; 1050 1047 1051 - /* This function is called when a transaction is closed */ 1048 + /** 1049 + * @j_commit_callback: 1050 + * 1051 + * This function is called when a transaction is closed. 1052 + */ 1052 1053 void (*j_commit_callback)(journal_t *, 1053 1054 transaction_t *); 1054 1055 1055 1056 /* 1056 1057 * Journal statistics 1057 1058 */ 1059 + 1060 + /** 1061 + * @j_history_lock: Protect the transactions statistics history. 1062 + */ 1058 1063 spinlock_t j_history_lock; 1064 + 1065 + /** 1066 + * @j_proc_entry: procfs entry for the jbd statistics directory. 1067 + */ 1059 1068 struct proc_dir_entry *j_proc_entry; 1069 + 1070 + /** 1071 + * @j_stats: Overall statistics. 1072 + */ 1060 1073 struct transaction_stats_s j_stats; 1061 1074 1062 - /* Failed journal commit ID */ 1075 + /** 1076 + * @j_failed_commit: Failed journal commit ID. 1077 + */ 1063 1078 unsigned int j_failed_commit; 1064 1079 1065 - /* 1080 + /** 1081 + * @j_private: 1082 + * 1066 1083 * An opaque pointer to fs-private information. ext3 puts its 1067 - * superblock pointer here 1084 + * superblock pointer here. 1068 1085 */ 1069 1086 void *j_private; 1070 1087 1071 - /* Reference to checksum algorithm driver via cryptoapi */ 1088 + /** 1089 + * @j_chksum_driver: 1090 + * 1091 + * Reference to checksum algorithm driver via cryptoapi. 1092 + */ 1072 1093 struct crypto_shash *j_chksum_driver; 1073 1094 1074 - /* Precomputed journal UUID checksum for seeding other checksums */ 1095 + /** 1096 + * @j_csum_seed: 1097 + * 1098 + * Precomputed journal UUID checksum for seeding other checksums. 1099 + */ 1075 1100 __u32 j_csum_seed; 1076 1101 1077 1102 #ifdef CONFIG_DEBUG_LOCK_ALLOC 1078 - /* 1103 + /** 1104 + * @j_trans_commit_map: 1105 + * 1079 1106 * Lockdep entity to track transaction commit dependencies. Handles 1080 1107 * hold this "lock" for read, when we wait for commit, we acquire the 1081 1108 * "lock" for writing. This matches the properties of jbd2 journalling