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

Merge tag 'xfs-4.18-merge-10' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux

Pull more xfs updates from Darrick Wong:
"Here's the second round of patches for XFS for 4.18. Most of the
commits are small cleanups, bug fixes, and continued strengthening of
metadata verifiers; the bulk of the diff is the conversion of the
fs/xfs/ tree to use SPDX tags.

This series has been run through a full xfstests run over the weekend
and through a quick xfstests run against this morning's master, with
no major failures reported.

Summary:

- Strengthen metadata checking to avoid ASSERTing on bad disk
contents

- Validate btree records that are being retrieved for clients

- Strengthen root inode verification

- Convert license blurbs to SPDX tags

- Enable changing DAX flag on directories

- Fix some writeback deadlocks in reflink

- Refactor out some old xfs helpers

- Move type verifiers to a separate file

- Fix some fuzzer crashes

- Various other bug fixes"

* tag 'xfs-4.18-merge-10' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux: (31 commits)
xfs: update incore per-AG inode count
xfs: replace do_mod with native operations
xfs: don't call xfs_da_shrink_inode with NULL bp
xfs: clean up MIN/MAX
xfs: move various type verifiers to common file
xfs: xfs_reflink_convert_cow() memory allocation deadlock
xfs: setup VFS i_rwsem lockdep state correctly
xfs: fix string handling in label get/set functions
xfs: convert to SPDX license tags
xfs: validate btree records on retrieval
xfs: push corruption -> ESTALE conversion to xfs_nfs_get_inode()
xfs: verify root inode more thoroughly
xfs: verify COW extent size hint is valid in inode verifier
xfs: verify extent size hint is valid in inode verifier
xfs: catch bad stripe alignment configurations
iomap: fsync swap files before iterating mappings
xfs: use xfs_trans_getsb in xfs_sync_sb_buf
xfs: don't assert on corrupted unlinked inode list
xfs: explicitly pass buffer size to xfs_corruption_error
xfs: don't assert when on-disk btree pointers are garbage
...

+940 -3196
+5 -1
fs/iomap.c
··· 1388 1388 loff_t len = ALIGN_DOWN(i_size_read(inode), PAGE_SIZE); 1389 1389 loff_t ret; 1390 1390 1391 - ret = filemap_write_and_wait(inode->i_mapping); 1391 + /* 1392 + * Persist all file mapping metadata so that we won't have any 1393 + * IOMAP_F_DIRTY iomaps. 1394 + */ 1395 + ret = vfs_fsync(swap_file, 1); 1392 1396 if (ret) 1393 1397 return ret; 1394 1398
+2 -13
fs/xfs/Makefile
··· 1 + # SPDX-License-Identifier: GPL-2.0 1 2 # 2 3 # Copyright (c) 2000-2005 Silicon Graphics, Inc. 3 4 # All Rights Reserved. 4 - # 5 - # This program is free software; you can redistribute it and/or 6 - # modify it under the terms of the GNU General Public License as 7 - # published by the Free Software Foundation. 8 - # 9 - # This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 # 18 6 19 7 ccflags-y += -I$(src) # needed for trace events ··· 50 62 xfs_sb.o \ 51 63 xfs_symlink_remote.o \ 52 64 xfs_trans_resv.o \ 65 + xfs_types.o \ 53 66 ) 54 67 # xfs_rtbitmap is shared with libxfs 55 68 xfs-$(CONFIG_XFS_RT) += $(addprefix libxfs/, \
+1 -13
fs/xfs/kmem.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include <linux/mm.h> 19 7 #include <linux/sched/mm.h>
+1 -13
fs/xfs/kmem.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_SUPPORT_KMEM_H__ 19 7 #define __XFS_SUPPORT_KMEM_H__
+1 -15
fs/xfs/libxfs/xfs_ag_resv.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2016 Oracle. All Rights Reserved. 3 - * 4 4 * 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 5 */ 20 6 #include "xfs.h" 21 7 #include "xfs_fs.h"
+1 -15
fs/xfs/libxfs/xfs_ag_resv.h
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2016 Oracle. All Rights Reserved. 3 - * 4 4 * 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 5 */ 20 6 #ifndef __XFS_AG_RESV_H__ 21 7 #define __XFS_AG_RESV_H__
+28 -67
fs/xfs/libxfs/xfs_alloc.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2002,2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include "xfs.h" 19 7 #include "xfs_fs.h" ··· 215 227 xfs_extlen_t *len, /* output: length of extent */ 216 228 int *stat) /* output: success/failure */ 217 229 { 230 + struct xfs_mount *mp = cur->bc_mp; 231 + xfs_agnumber_t agno = cur->bc_private.a.agno; 218 232 union xfs_btree_rec *rec; 219 233 int error; 220 234 221 235 error = xfs_btree_get_rec(cur, &rec, stat); 222 - if (!error && *stat == 1) { 223 - *bno = be32_to_cpu(rec->alloc.ar_startblock); 224 - *len = be32_to_cpu(rec->alloc.ar_blockcount); 225 - } 226 - return error; 236 + if (error || !(*stat)) 237 + return error; 238 + if (rec->alloc.ar_blockcount == 0) 239 + goto out_bad_rec; 240 + 241 + *bno = be32_to_cpu(rec->alloc.ar_startblock); 242 + *len = be32_to_cpu(rec->alloc.ar_blockcount); 243 + 244 + /* check for valid extent range, including overflow */ 245 + if (!xfs_verify_agbno(mp, agno, *bno)) 246 + goto out_bad_rec; 247 + if (*bno > *bno + *len) 248 + goto out_bad_rec; 249 + if (!xfs_verify_agbno(mp, agno, *bno + *len - 1)) 250 + goto out_bad_rec; 251 + 252 + return 0; 253 + 254 + out_bad_rec: 255 + xfs_warn(mp, 256 + "%s Freespace BTree record corruption in AG %d detected!", 257 + cur->bc_btnum == XFS_BTNUM_BNO ? "Block" : "Size", agno); 258 + xfs_warn(mp, 259 + "start block 0x%x block count 0x%x", *bno, *len); 260 + return -EFSCORRUPTED; 227 261 } 228 262 229 263 /* ··· 3121 3111 query.priv = priv; 3122 3112 query.fn = fn; 3123 3113 return xfs_btree_query_all(cur, xfs_alloc_query_range_helper, &query); 3124 - } 3125 - 3126 - /* Find the size of the AG, in blocks. */ 3127 - xfs_agblock_t 3128 - xfs_ag_block_count( 3129 - struct xfs_mount *mp, 3130 - xfs_agnumber_t agno) 3131 - { 3132 - ASSERT(agno < mp->m_sb.sb_agcount); 3133 - 3134 - if (agno < mp->m_sb.sb_agcount - 1) 3135 - return mp->m_sb.sb_agblocks; 3136 - return mp->m_sb.sb_dblocks - (agno * mp->m_sb.sb_agblocks); 3137 - } 3138 - 3139 - /* 3140 - * Verify that an AG block number pointer neither points outside the AG 3141 - * nor points at static metadata. 3142 - */ 3143 - bool 3144 - xfs_verify_agbno( 3145 - struct xfs_mount *mp, 3146 - xfs_agnumber_t agno, 3147 - xfs_agblock_t agbno) 3148 - { 3149 - xfs_agblock_t eoag; 3150 - 3151 - eoag = xfs_ag_block_count(mp, agno); 3152 - if (agbno >= eoag) 3153 - return false; 3154 - if (agbno <= XFS_AGFL_BLOCK(mp)) 3155 - return false; 3156 - return true; 3157 - } 3158 - 3159 - /* 3160 - * Verify that an FS block number pointer neither points outside the 3161 - * filesystem nor points at static AG metadata. 3162 - */ 3163 - bool 3164 - xfs_verify_fsbno( 3165 - struct xfs_mount *mp, 3166 - xfs_fsblock_t fsbno) 3167 - { 3168 - xfs_agnumber_t agno = XFS_FSB_TO_AGNO(mp, fsbno); 3169 - 3170 - if (agno >= mp->m_sb.sb_agcount) 3171 - return false; 3172 - return xfs_verify_agbno(mp, agno, XFS_FSB_TO_AGBNO(mp, fsbno)); 3173 3114 } 3174 3115 3175 3116 /* Is there a record covering a given extent? */
+1 -17
fs/xfs/libxfs/xfs_alloc.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2002,2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_ALLOC_H__ 19 7 #define __XFS_ALLOC_H__ ··· 242 254 xfs_alloc_query_range_fn fn, void *priv); 243 255 int xfs_alloc_query_all(struct xfs_btree_cur *cur, xfs_alloc_query_range_fn fn, 244 256 void *priv); 245 - xfs_agblock_t xfs_ag_block_count(struct xfs_mount *mp, xfs_agnumber_t agno); 246 - bool xfs_verify_agbno(struct xfs_mount *mp, xfs_agnumber_t agno, 247 - xfs_agblock_t agbno); 248 - bool xfs_verify_fsbno(struct xfs_mount *mp, xfs_fsblock_t fsbno); 249 257 250 258 int xfs_alloc_has_record(struct xfs_btree_cur *cur, xfs_agblock_t bno, 251 259 xfs_extlen_t len, bool *exist);
+1 -14
fs/xfs/libxfs/xfs_alloc_btree.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2001,2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include "xfs.h" 19 7 #include "xfs_fs.h" ··· 230 242 struct xfs_agf *agf = XFS_BUF_TO_AGF(cur->bc_private.a.agbp); 231 243 232 244 ASSERT(cur->bc_private.a.agno == be32_to_cpu(agf->agf_seqno)); 233 - ASSERT(agf->agf_roots[cur->bc_btnum] != 0); 234 245 235 246 ptr->s = agf->agf_roots[cur->bc_btnum]; 236 247 }
+1 -13
fs/xfs/libxfs/xfs_alloc_btree.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000,2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_ALLOC_BTREE_H__ 19 7 #define __XFS_ALLOC_BTREE_H__
+1 -13
fs/xfs/libxfs/xfs_attr.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include "xfs.h" 19 7 #include "xfs_fs.h"
+4 -17
fs/xfs/libxfs/xfs_attr_leaf.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2005 Silicon Graphics, Inc. 3 4 * Copyright (c) 2013 Red Hat, Inc. 4 5 * All Rights Reserved. 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 as 8 - * published by the Free Software Foundation. 9 - * 10 - * This program is distributed in the hope that it would 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 - * 15 - * You should have received a copy of the GNU General Public License 16 - * along with this program; if not, write the Free Software Foundation, 17 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 6 */ 19 7 #include "xfs.h" 20 8 #include "xfs_fs.h" ··· 465 477 * A data fork btree root must have space for at least 466 478 * MINDBTPTRS key/ptr pairs if the data fork is small or empty. 467 479 */ 468 - minforkoff = MAX(dsize, XFS_BMDR_SPACE_CALC(MINDBTPTRS)); 480 + minforkoff = max(dsize, XFS_BMDR_SPACE_CALC(MINDBTPTRS)); 469 481 minforkoff = roundup(minforkoff, 8) >> 3; 470 482 471 483 /* attr fork btree root can have at least this many key/ptr pairs */ ··· 791 803 ASSERT(blkno == 0); 792 804 error = xfs_attr3_leaf_create(args, blkno, &bp); 793 805 if (error) { 794 - error = xfs_da_shrink_inode(args, 0, bp); 795 - bp = NULL; 796 - if (error) 806 + /* xfs_attr3_leaf_create may not have instantiated a block */ 807 + if (bp && (xfs_da_shrink_inode(args, 0, bp) != 0)) 797 808 goto out; 798 809 xfs_idata_realloc(dp, size, XFS_ATTR_FORK); /* try to put */ 799 810 memcpy(ifp->if_u1.if_data, tmpbuffer, size); /* it back */
+1 -13
fs/xfs/libxfs/xfs_attr_leaf.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000,2002-2003,2005 Silicon Graphics, Inc. 3 4 * Copyright (c) 2013 Red Hat, Inc. 4 5 * All Rights Reserved. 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 as 8 - * published by the Free Software Foundation. 9 - * 10 - * This program is distributed in the hope that it would 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 - * 15 - * You should have received a copy of the GNU General Public License 16 - * along with this program; if not, write the Free Software Foundation, 17 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 6 */ 19 7 #ifndef __XFS_ATTR_LEAF_H__ 20 8 #define __XFS_ATTR_LEAF_H__
+1 -13
fs/xfs/libxfs/xfs_attr_remote.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2005 Silicon Graphics, Inc. 3 4 * Copyright (c) 2013 Red Hat, Inc. 4 5 * All Rights Reserved. 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 as 8 - * published by the Free Software Foundation. 9 - * 10 - * This program is distributed in the hope that it would 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 - * 15 - * You should have received a copy of the GNU General Public License 16 - * along with this program; if not, write the Free Software Foundation, 17 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 6 */ 19 7 #include "xfs.h" 20 8 #include "xfs_fs.h"
+1 -13
fs/xfs/libxfs/xfs_attr_remote.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2013 Red Hat, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_ATTR_REMOTE_H__ 19 7 #define __XFS_ATTR_REMOTE_H__
+1 -13
fs/xfs/libxfs/xfs_attr_sf.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000,2002,2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_ATTR_SF_H__ 19 7 #define __XFS_ATTR_SF_H__
+1 -13
fs/xfs/libxfs/xfs_bit.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include "xfs.h" 19 7 #include "xfs_log_format.h"
+1 -13
fs/xfs/libxfs/xfs_bit.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000,2002,2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_BIT_H__ 19 7 #define __XFS_BIT_H__
+25 -29
fs/xfs/libxfs/xfs_bmap.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2006 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include "xfs.h" 19 7 #include "xfs_fs.h" ··· 1236 1248 1237 1249 num_recs = xfs_btree_get_numrecs(block); 1238 1250 if (unlikely(i + num_recs > nextents)) { 1239 - ASSERT(i + num_recs <= nextents); 1240 1251 xfs_warn(ip->i_mount, 1241 1252 "corrupt dinode %Lu, (btree extents).", 1242 1253 (unsigned long long) ip->i_ino); ··· 2923 2936 * perform this alignment, or if a truncate shot us in the 2924 2937 * foot. 2925 2938 */ 2926 - temp = do_mod(orig_off, extsz); 2939 + div_u64_rem(orig_off, extsz, &temp); 2927 2940 if (temp) { 2928 2941 align_alen += temp; 2929 2942 align_off -= temp; ··· 3467 3480 xfs_rmap_skip_owner_update(&args.oinfo); 3468 3481 3469 3482 /* Trim the allocation back to the maximum an AG can fit. */ 3470 - args.maxlen = MIN(ap->length, mp->m_ag_max_usable); 3483 + args.maxlen = min(ap->length, mp->m_ag_max_usable); 3471 3484 args.firstblock = *ap->firstblock; 3472 3485 blen = 0; 3473 3486 if (nullfb) { ··· 3497 3510 /* apply extent size hints if obtained earlier */ 3498 3511 if (align) { 3499 3512 args.prod = align; 3500 - if ((args.mod = (xfs_extlen_t)do_mod(ap->offset, args.prod))) 3501 - args.mod = (xfs_extlen_t)(args.prod - args.mod); 3513 + div_u64_rem(ap->offset, args.prod, &args.mod); 3514 + if (args.mod) 3515 + args.mod = args.prod - args.mod; 3502 3516 } else if (mp->m_sb.sb_blocksize >= PAGE_SIZE) { 3503 3517 args.prod = 1; 3504 3518 args.mod = 0; 3505 3519 } else { 3506 3520 args.prod = PAGE_SIZE >> mp->m_sb.sb_blocklog; 3507 - if ((args.mod = (xfs_extlen_t)(do_mod(ap->offset, args.prod)))) 3508 - args.mod = (xfs_extlen_t)(args.prod - args.mod); 3521 + div_u64_rem(ap->offset, args.prod, &args.mod); 3522 + if (args.mod) 3523 + args.mod = args.prod - args.mod; 3509 3524 } 3510 3525 /* 3511 3526 * If we are not low on available data blocks, and the ··· 4955 4966 if (whichfork == XFS_DATA_FORK && XFS_IS_REALTIME_INODE(ip)) { 4956 4967 xfs_fsblock_t bno; 4957 4968 xfs_filblks_t len; 4969 + xfs_extlen_t mod; 4958 4970 4959 - ASSERT(do_mod(del->br_blockcount, mp->m_sb.sb_rextsize) == 0); 4960 - ASSERT(do_mod(del->br_startblock, mp->m_sb.sb_rextsize) == 0); 4961 - bno = del->br_startblock; 4962 - len = del->br_blockcount; 4963 - do_div(bno, mp->m_sb.sb_rextsize); 4964 - do_div(len, mp->m_sb.sb_rextsize); 4971 + bno = div_u64_rem(del->br_startblock, mp->m_sb.sb_rextsize, 4972 + &mod); 4973 + ASSERT(mod == 0); 4974 + len = div_u64_rem(del->br_blockcount, mp->m_sb.sb_rextsize, 4975 + &mod); 4976 + ASSERT(mod == 0); 4977 + 4965 4978 error = xfs_rtfree_extent(tp, bno, (xfs_extlen_t)len); 4966 4979 if (error) 4967 4980 goto done; ··· 5300 5309 del.br_blockcount = max_len; 5301 5310 } 5302 5311 5312 + if (!isrt) 5313 + goto delete; 5314 + 5303 5315 sum = del.br_startblock + del.br_blockcount; 5304 - if (isrt && 5305 - (mod = do_mod(sum, mp->m_sb.sb_rextsize))) { 5316 + div_u64_rem(sum, mp->m_sb.sb_rextsize, &mod); 5317 + if (mod) { 5306 5318 /* 5307 5319 * Realtime extent not lined up at the end. 5308 5320 * The extent could have been split into written ··· 5352 5358 goto error0; 5353 5359 goto nodelete; 5354 5360 } 5355 - if (isrt && (mod = do_mod(del.br_startblock, mp->m_sb.sb_rextsize))) { 5361 + div_u64_rem(del.br_startblock, mp->m_sb.sb_rextsize, &mod); 5362 + if (mod) { 5356 5363 /* 5357 5364 * Realtime extent is lined up at the end but not 5358 5365 * at the front. We'll get rid of full extents if ··· 5422 5427 } 5423 5428 } 5424 5429 5430 + delete: 5425 5431 if (wasdel) { 5426 5432 error = xfs_bmap_del_extent_delay(ip, whichfork, &icur, 5427 5433 &got, &del);
+1 -13
fs/xfs/libxfs/xfs_bmap.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2006 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_BMAP_H__ 19 7 #define __XFS_BMAP_H__
+1 -13
fs/xfs/libxfs/xfs_bmap_btree.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include "xfs.h" 19 7 #include "xfs_fs.h"
+1 -13
fs/xfs/libxfs/xfs_bmap_btree.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000,2002-2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_BMAP_BTREE_H__ 19 7 #define __XFS_BMAP_BTREE_H__
+88 -83
fs/xfs/libxfs/xfs_btree.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2002,2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include "xfs.h" 19 7 #include "xfs_fs.h" ··· 222 234 return xfs_verify_agbno(cur->bc_mp, cur->bc_private.a.agno, agbno); 223 235 } 224 236 225 - #ifdef DEBUG 226 237 /* 227 238 * Check that a given (indexed) btree pointer at a certain level of a 228 239 * btree is valid and doesn't point past where it should. ··· 234 247 int level) 235 248 { 236 249 if (cur->bc_flags & XFS_BTREE_LONG_PTRS) { 237 - XFS_WANT_CORRUPTED_RETURN(cur->bc_mp, 238 - xfs_btree_check_lptr(cur, 239 - be64_to_cpu((&ptr->l)[index]), level)); 250 + if (xfs_btree_check_lptr(cur, be64_to_cpu((&ptr->l)[index]), 251 + level)) 252 + return 0; 253 + xfs_err(cur->bc_mp, 254 + "Inode %llu fork %d: Corrupt btree %d pointer at level %d index %d.", 255 + cur->bc_private.b.ip->i_ino, 256 + cur->bc_private.b.whichfork, cur->bc_btnum, 257 + level, index); 240 258 } else { 241 - XFS_WANT_CORRUPTED_RETURN(cur->bc_mp, 242 - xfs_btree_check_sptr(cur, 243 - be32_to_cpu((&ptr->s)[index]), level)); 259 + if (xfs_btree_check_sptr(cur, be32_to_cpu((&ptr->s)[index]), 260 + level)) 261 + return 0; 262 + xfs_err(cur->bc_mp, 263 + "AG %u: Corrupt btree %d pointer at level %d index %d.", 264 + cur->bc_private.a.agno, cur->bc_btnum, 265 + level, index); 244 266 } 245 267 246 - return 0; 268 + return -EFSCORRUPTED; 247 269 } 270 + 271 + #ifdef DEBUG 272 + # define xfs_btree_debug_check_ptr xfs_btree_check_ptr 273 + #else 274 + # define xfs_btree_debug_check_ptr(...) (0) 248 275 #endif 249 276 250 277 /* ··· 989 988 return xfs_btree_readahead_sblock(cur, lr, block); 990 989 } 991 990 992 - STATIC xfs_daddr_t 991 + STATIC int 993 992 xfs_btree_ptr_to_daddr( 994 993 struct xfs_btree_cur *cur, 995 - union xfs_btree_ptr *ptr) 994 + union xfs_btree_ptr *ptr, 995 + xfs_daddr_t *daddr) 996 996 { 997 + xfs_fsblock_t fsbno; 998 + xfs_agblock_t agbno; 999 + int error; 1000 + 1001 + error = xfs_btree_check_ptr(cur, ptr, 0, 1); 1002 + if (error) 1003 + return error; 1004 + 997 1005 if (cur->bc_flags & XFS_BTREE_LONG_PTRS) { 998 - ASSERT(ptr->l != cpu_to_be64(NULLFSBLOCK)); 999 - 1000 - return XFS_FSB_TO_DADDR(cur->bc_mp, be64_to_cpu(ptr->l)); 1006 + fsbno = be64_to_cpu(ptr->l); 1007 + *daddr = XFS_FSB_TO_DADDR(cur->bc_mp, fsbno); 1001 1008 } else { 1002 - ASSERT(cur->bc_private.a.agno != NULLAGNUMBER); 1003 - ASSERT(ptr->s != cpu_to_be32(NULLAGBLOCK)); 1004 - 1005 - return XFS_AGB_TO_DADDR(cur->bc_mp, cur->bc_private.a.agno, 1006 - be32_to_cpu(ptr->s)); 1009 + agbno = be32_to_cpu(ptr->s); 1010 + *daddr = XFS_AGB_TO_DADDR(cur->bc_mp, cur->bc_private.a.agno, 1011 + agbno); 1007 1012 } 1013 + 1014 + return 0; 1008 1015 } 1009 1016 1010 1017 /* ··· 1027 1018 union xfs_btree_ptr *ptr, 1028 1019 xfs_extlen_t count) 1029 1020 { 1030 - xfs_buf_readahead(cur->bc_mp->m_ddev_targp, 1031 - xfs_btree_ptr_to_daddr(cur, ptr), 1021 + xfs_daddr_t daddr; 1022 + 1023 + if (xfs_btree_ptr_to_daddr(cur, ptr, &daddr)) 1024 + return; 1025 + xfs_buf_readahead(cur->bc_mp->m_ddev_targp, daddr, 1032 1026 cur->bc_mp->m_bsize * count, cur->bc_ops->buf_ops); 1033 1027 } 1034 1028 ··· 1294 1282 { 1295 1283 struct xfs_mount *mp = cur->bc_mp; 1296 1284 xfs_daddr_t d; 1285 + int error; 1297 1286 1298 1287 /* need to sort out how callers deal with failures first */ 1299 1288 ASSERT(!(flags & XBF_TRYLOCK)); 1300 1289 1301 - d = xfs_btree_ptr_to_daddr(cur, ptr); 1290 + error = xfs_btree_ptr_to_daddr(cur, ptr, &d); 1291 + if (error) 1292 + return error; 1302 1293 *bpp = xfs_trans_get_buf(cur->bc_tp, mp->m_ddev_targp, d, 1303 1294 mp->m_bsize, flags); 1304 1295 ··· 1332 1317 /* need to sort out how callers deal with failures first */ 1333 1318 ASSERT(!(flags & XBF_TRYLOCK)); 1334 1319 1335 - d = xfs_btree_ptr_to_daddr(cur, ptr); 1320 + error = xfs_btree_ptr_to_daddr(cur, ptr, &d); 1321 + if (error) 1322 + return error; 1336 1323 error = xfs_trans_read_buf(mp, cur->bc_tp, mp->m_ddev_targp, d, 1337 1324 mp->m_bsize, flags, bpp, 1338 1325 cur->bc_ops->buf_ops); ··· 1781 1764 struct xfs_btree_block **blkp) /* return btree block */ 1782 1765 { 1783 1766 struct xfs_buf *bp; /* buffer pointer for btree block */ 1767 + xfs_daddr_t daddr; 1784 1768 int error = 0; 1785 1769 1786 1770 /* special case the root block if in an inode */ ··· 1798 1780 * Otherwise throw it away and get a new one. 1799 1781 */ 1800 1782 bp = cur->bc_bufs[level]; 1801 - if (bp && XFS_BUF_ADDR(bp) == xfs_btree_ptr_to_daddr(cur, pp)) { 1783 + error = xfs_btree_ptr_to_daddr(cur, pp, &daddr); 1784 + if (error) 1785 + return error; 1786 + if (bp && XFS_BUF_ADDR(bp) == daddr) { 1802 1787 *blkp = XFS_BUF_TO_BLOCK(bp); 1803 1788 return 0; 1804 1789 } ··· 1917 1896 high = xfs_btree_get_numrecs(block); 1918 1897 if (!high) { 1919 1898 /* Block is empty, must be an empty leaf. */ 1920 - ASSERT(level == 0 && cur->bc_nlevels == 1); 1899 + if (level != 0 || cur->bc_nlevels != 1) { 1900 + XFS_CORRUPTION_ERROR(__func__, 1901 + XFS_ERRLEVEL_LOW, 1902 + cur->bc_mp, block, 1903 + sizeof(*block)); 1904 + return -EFSCORRUPTED; 1905 + } 1921 1906 1922 1907 cur->bc_ptrs[0] = dir != XFS_LOOKUP_LE; 1923 1908 *stat = 0; ··· 1973 1946 keyno = 1; 1974 1947 pp = xfs_btree_ptr_addr(cur, keyno, block); 1975 1948 1976 - #ifdef DEBUG 1977 - error = xfs_btree_check_ptr(cur, pp, 0, level); 1949 + error = xfs_btree_debug_check_ptr(cur, pp, 0, level); 1978 1950 if (error) 1979 1951 goto error0; 1980 - #endif 1952 + 1981 1953 cur->bc_ptrs[level] = keyno; 1982 1954 } 1983 1955 } ··· 2380 2354 2381 2355 lpp = xfs_btree_ptr_addr(cur, lrecs, left); 2382 2356 rpp = xfs_btree_ptr_addr(cur, 1, right); 2383 - #ifdef DEBUG 2384 - error = xfs_btree_check_ptr(cur, rpp, 0, level); 2357 + 2358 + error = xfs_btree_debug_check_ptr(cur, rpp, 0, level); 2385 2359 if (error) 2386 2360 goto error0; 2387 - #endif 2361 + 2388 2362 xfs_btree_copy_keys(cur, lkp, rkp, 1); 2389 2363 xfs_btree_copy_ptrs(cur, lpp, rpp, 1); 2390 2364 ··· 2419 2393 XFS_BTREE_STATS_ADD(cur, moves, rrecs - 1); 2420 2394 if (level > 0) { 2421 2395 /* It's a nonleaf. operate on keys and ptrs */ 2422 - #ifdef DEBUG 2423 2396 int i; /* loop index */ 2424 2397 2425 2398 for (i = 0; i < rrecs; i++) { 2426 - error = xfs_btree_check_ptr(cur, rpp, i + 1, level); 2399 + error = xfs_btree_debug_check_ptr(cur, rpp, i + 1, level); 2427 2400 if (error) 2428 2401 goto error0; 2429 2402 } 2430 - #endif 2403 + 2431 2404 xfs_btree_shift_keys(cur, 2432 2405 xfs_btree_key_addr(cur, 2, right), 2433 2406 -1, rrecs); ··· 2566 2541 rkp = xfs_btree_key_addr(cur, 1, right); 2567 2542 rpp = xfs_btree_ptr_addr(cur, 1, right); 2568 2543 2569 - #ifdef DEBUG 2570 2544 for (i = rrecs - 1; i >= 0; i--) { 2571 - error = xfs_btree_check_ptr(cur, rpp, i, level); 2545 + error = xfs_btree_debug_check_ptr(cur, rpp, i, level); 2572 2546 if (error) 2573 2547 goto error0; 2574 2548 } 2575 - #endif 2576 2549 2577 2550 xfs_btree_shift_keys(cur, rkp, 1, rrecs); 2578 2551 xfs_btree_shift_ptrs(cur, rpp, 1, rrecs); 2579 2552 2580 - #ifdef DEBUG 2581 - error = xfs_btree_check_ptr(cur, lpp, 0, level); 2553 + error = xfs_btree_debug_check_ptr(cur, lpp, 0, level); 2582 2554 if (error) 2583 2555 goto error0; 2584 - #endif 2585 2556 2586 2557 /* Now put the new data in, and log it. */ 2587 2558 xfs_btree_copy_keys(cur, rkp, lkp, 1); ··· 2682 2661 int rrecs; 2683 2662 int src_index; 2684 2663 int error; /* error return value */ 2685 - #ifdef DEBUG 2686 2664 int i; 2687 - #endif 2688 2665 2689 2666 XFS_BTREE_STATS_INC(cur, split); 2690 2667 ··· 2748 2729 rkp = xfs_btree_key_addr(cur, 1, right); 2749 2730 rpp = xfs_btree_ptr_addr(cur, 1, right); 2750 2731 2751 - #ifdef DEBUG 2752 2732 for (i = src_index; i < rrecs; i++) { 2753 - error = xfs_btree_check_ptr(cur, lpp, i, level); 2733 + error = xfs_btree_debug_check_ptr(cur, lpp, i, level); 2754 2734 if (error) 2755 2735 goto error0; 2756 2736 } 2757 - #endif 2758 2737 2759 2738 /* Copy the keys & pointers to the new block. */ 2760 2739 xfs_btree_copy_keys(cur, rkp, lkp, rrecs); ··· 2940 2923 union xfs_btree_ptr nptr; /* new block addr */ 2941 2924 int level; /* btree level */ 2942 2925 int error; /* error return code */ 2943 - #ifdef DEBUG 2944 2926 int i; /* loop counter */ 2945 - #endif 2946 2927 2947 2928 XFS_BTREE_STATS_INC(cur, newroot); 2948 2929 ··· 2987 2972 xfs_btree_copy_keys(cur, ckp, kp, xfs_btree_get_numrecs(cblock)); 2988 2973 2989 2974 cpp = xfs_btree_ptr_addr(cur, 1, cblock); 2990 - #ifdef DEBUG 2991 2975 for (i = 0; i < be16_to_cpu(cblock->bb_numrecs); i++) { 2992 - error = xfs_btree_check_ptr(cur, pp, i, level); 2976 + error = xfs_btree_debug_check_ptr(cur, pp, i, level); 2993 2977 if (error) 2994 2978 goto error0; 2995 2979 } 2996 - #endif 2980 + 2997 2981 xfs_btree_copy_ptrs(cur, cpp, pp, xfs_btree_get_numrecs(cblock)); 2998 2982 2999 - #ifdef DEBUG 3000 - error = xfs_btree_check_ptr(cur, &nptr, 0, level); 2983 + error = xfs_btree_debug_check_ptr(cur, &nptr, 0, level); 3001 2984 if (error) 3002 2985 goto error0; 3003 - #endif 2986 + 3004 2987 xfs_btree_copy_ptrs(cur, pp, &nptr, 1); 3005 2988 3006 2989 xfs_iroot_realloc(cur->bc_private.b.ip, ··· 3242 3229 int ptr; /* key/record index */ 3243 3230 int numrecs;/* number of records */ 3244 3231 int error; /* error return value */ 3245 - #ifdef DEBUG 3246 3232 int i; 3247 - #endif 3248 3233 xfs_daddr_t old_bn; 3249 3234 3250 3235 ncur = NULL; ··· 3332 3321 kp = xfs_btree_key_addr(cur, ptr, block); 3333 3322 pp = xfs_btree_ptr_addr(cur, ptr, block); 3334 3323 3335 - #ifdef DEBUG 3336 3324 for (i = numrecs - ptr; i >= 0; i--) { 3337 - error = xfs_btree_check_ptr(cur, pp, i, level); 3325 + error = xfs_btree_debug_check_ptr(cur, pp, i, level); 3338 3326 if (error) 3339 3327 return error; 3340 3328 } 3341 - #endif 3342 3329 3343 3330 xfs_btree_shift_keys(cur, kp, 1, numrecs - ptr + 1); 3344 3331 xfs_btree_shift_ptrs(cur, pp, 1, numrecs - ptr + 1); 3345 3332 3346 - #ifdef DEBUG 3347 - error = xfs_btree_check_ptr(cur, ptrp, 0, level); 3333 + error = xfs_btree_debug_check_ptr(cur, ptrp, 0, level); 3348 3334 if (error) 3349 3335 goto error0; 3350 - #endif 3351 3336 3352 3337 /* Now put the new data in, bump numrecs and log it. */ 3353 3338 xfs_btree_copy_keys(cur, kp, key, 1); ··· 3531 3524 int error; 3532 3525 #ifdef DEBUG 3533 3526 union xfs_btree_ptr ptr; 3534 - int i; 3535 3527 #endif 3528 + int i; 3536 3529 3537 3530 ASSERT(cur->bc_flags & XFS_BTREE_ROOT_IN_INODE); 3538 3531 ASSERT(cur->bc_nlevels > 1); ··· 3588 3581 3589 3582 pp = xfs_btree_ptr_addr(cur, 1, block); 3590 3583 cpp = xfs_btree_ptr_addr(cur, 1, cblock); 3591 - #ifdef DEBUG 3584 + 3592 3585 for (i = 0; i < numrecs; i++) { 3593 - error = xfs_btree_check_ptr(cur, cpp, i, level - 1); 3586 + error = xfs_btree_debug_check_ptr(cur, cpp, i, level - 1); 3594 3587 if (error) 3595 3588 return error; 3596 3589 } 3597 - #endif 3590 + 3598 3591 xfs_btree_copy_ptrs(cur, pp, cpp, numrecs); 3599 3592 3600 3593 error = xfs_btree_free_block(cur, cbp); ··· 3728 3721 lkp = xfs_btree_key_addr(cur, ptr + 1, block); 3729 3722 lpp = xfs_btree_ptr_addr(cur, ptr + 1, block); 3730 3723 3731 - #ifdef DEBUG 3732 3724 for (i = 0; i < numrecs - ptr; i++) { 3733 - error = xfs_btree_check_ptr(cur, lpp, i, level); 3725 + error = xfs_btree_debug_check_ptr(cur, lpp, i, level); 3734 3726 if (error) 3735 3727 goto error0; 3736 3728 } 3737 - #endif 3738 3729 3739 3730 if (ptr < numrecs) { 3740 3731 xfs_btree_shift_keys(cur, lkp, -1, numrecs - ptr); ··· 4065 4060 lpp = xfs_btree_ptr_addr(cur, lrecs + 1, left); 4066 4061 rkp = xfs_btree_key_addr(cur, 1, right); 4067 4062 rpp = xfs_btree_ptr_addr(cur, 1, right); 4068 - #ifdef DEBUG 4063 + 4069 4064 for (i = 1; i < rrecs; i++) { 4070 - error = xfs_btree_check_ptr(cur, rpp, i, level); 4065 + error = xfs_btree_debug_check_ptr(cur, rpp, i, level); 4071 4066 if (error) 4072 4067 goto error0; 4073 4068 } 4074 - #endif 4069 + 4075 4070 xfs_btree_copy_keys(cur, lkp, rkp, rrecs); 4076 4071 xfs_btree_copy_ptrs(cur, lpp, rpp, rrecs); 4077 4072
+1 -13
fs/xfs/libxfs/xfs_btree.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2001,2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_BTREE_H__ 19 7 #define __XFS_BTREE_H__
+7 -17
fs/xfs/libxfs/xfs_da_btree.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2005 Silicon Graphics, Inc. 3 4 * Copyright (c) 2013 Red Hat, Inc. 4 5 * All Rights Reserved. 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 as 8 - * published by the Free Software Foundation. 9 - * 10 - * This program is distributed in the hope that it would 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 - * 15 - * You should have received a copy of the GNU General Public License 16 - * along with this program; if not, write the Free Software Foundation, 17 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 6 */ 19 7 #include "xfs.h" 20 8 #include "xfs_fs.h" ··· 293 305 type = XFS_BLFT_DIR_LEAFN_BUF; 294 306 break; 295 307 default: 296 - type = 0; 297 - ASSERT(0); 298 - break; 308 + XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, 309 + tp->t_mountp, info, sizeof(*info)); 310 + xfs_trans_brelse(tp, *bpp); 311 + *bpp = NULL; 312 + return -EFSCORRUPTED; 299 313 } 300 314 xfs_trans_buf_set_type(tp, *bpp, type); 301 315 } ··· 2081 2091 */ 2082 2092 mapp = kmem_alloc(sizeof(*mapp) * count, KM_SLEEP); 2083 2093 for (b = *bno, mapi = 0; b < *bno + count; ) { 2084 - nmap = MIN(XFS_BMAP_MAX_NMAP, count); 2094 + nmap = min(XFS_BMAP_MAX_NMAP, count); 2085 2095 c = (int)(*bno + count - b); 2086 2096 error = xfs_bmapi_write(tp, dp, b, c, 2087 2097 xfs_bmapi_aflag(w)|XFS_BMAPI_METADATA,
+1 -13
fs/xfs/libxfs/xfs_da_btree.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000,2002,2005 Silicon Graphics, Inc. 3 4 * Copyright (c) 2013 Red Hat, Inc. 4 5 * All Rights Reserved. 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 as 8 - * published by the Free Software Foundation. 9 - * 10 - * This program is distributed in the hope that it would 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 - * 15 - * You should have received a copy of the GNU General Public License 16 - * along with this program; if not, write the Free Software Foundation, 17 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 6 */ 19 7 #ifndef __XFS_DA_BTREE_H__ 20 8 #define __XFS_DA_BTREE_H__
+1 -13
fs/xfs/libxfs/xfs_da_format.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000,2002,2005 Silicon Graphics, Inc. 3 4 * Copyright (c) 2013 Red Hat, Inc. 4 5 * All Rights Reserved. 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 as 8 - * published by the Free Software Foundation. 9 - * 10 - * This program is distributed in the hope that it would 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 - * 15 - * You should have received a copy of the GNU General Public License 16 - * along with this program; if not, write the Free Software Foundation, 17 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 6 */ 19 7 #include "xfs.h" 20 8 #include "xfs_fs.h"
+1 -13
fs/xfs/libxfs/xfs_da_format.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2001,2005 Silicon Graphics, Inc. 3 4 * Copyright (c) 2013 Red Hat, Inc. 4 5 * All Rights Reserved. 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 as 8 - * published by the Free Software Foundation. 9 - * 10 - * This program is distributed in the hope that it would 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 - * 15 - * You should have received a copy of the GNU General Public License 16 - * along with this program; if not, write the Free Software Foundation, 17 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 6 */ 19 7 #ifndef __XFS_DA_FORMAT_H__ 20 8 #define __XFS_DA_FORMAT_H__
+1 -15
fs/xfs/libxfs/xfs_defer.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2016 Oracle. All Rights Reserved. 3 - * 4 4 * 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 5 */ 20 6 #include "xfs.h" 21 7 #include "xfs_fs.h"
+1 -15
fs/xfs/libxfs/xfs_defer.h
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2016 Oracle. All Rights Reserved. 3 - * 4 4 * 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 5 */ 20 6 #ifndef __XFS_DEFER_H__ 21 7 #define __XFS_DEFER_H__
+1 -13
fs/xfs/libxfs/xfs_dir2.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2001,2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include "xfs.h" 19 7 #include "xfs_fs.h"
+1 -13
fs/xfs/libxfs/xfs_dir2.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2001,2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_DIR2_H__ 19 7 #define __XFS_DIR2_H__
+5 -17
fs/xfs/libxfs/xfs_dir2_block.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc. 3 4 * Copyright (c) 2013 Red Hat, Inc. 4 5 * All Rights Reserved. 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 as 8 - * published by the Free Software Foundation. 9 - * 10 - * This program is distributed in the hope that it would 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 - * 15 - * You should have received a copy of the GNU General Public License 16 - * along with this program; if not, write the Free Software Foundation, 17 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 6 */ 19 7 #include "xfs.h" 20 8 #include "xfs_fs.h" ··· 502 514 if (mid - lowstale) 503 515 memmove(&blp[lowstale], &blp[lowstale + 1], 504 516 (mid - lowstale) * sizeof(*blp)); 505 - lfloglow = MIN(lowstale, lfloglow); 506 - lfloghigh = MAX(mid, lfloghigh); 517 + lfloglow = min(lowstale, lfloglow); 518 + lfloghigh = max(mid, lfloghigh); 507 519 } 508 520 /* 509 521 * Move entries toward the high-numbered stale entry. ··· 514 526 if (highstale - mid) 515 527 memmove(&blp[mid + 1], &blp[mid], 516 528 (highstale - mid) * sizeof(*blp)); 517 - lfloglow = MIN(mid, lfloglow); 518 - lfloghigh = MAX(highstale, lfloghigh); 529 + lfloglow = min(mid, lfloglow); 530 + lfloghigh = max(highstale, lfloghigh); 519 531 } 520 532 be32_add_cpu(&btp->stale, -1); 521 533 }
+73 -51
fs/xfs/libxfs/xfs_dir2_data.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2002,2005 Silicon Graphics, Inc. 3 4 * Copyright (c) 2013 Red Hat, Inc. 4 5 * All Rights Reserved. 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 as 8 - * published by the Free Software Foundation. 9 - * 10 - * This program is distributed in the hope that it would 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 - * 15 - * You should have received a copy of the GNU General Public License 16 - * along with this program; if not, write the Free Software Foundation, 17 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 6 */ 19 7 #include "xfs.h" 20 8 #include "xfs_fs.h" ··· 20 32 #include "xfs_buf_item.h" 21 33 #include "xfs_cksum.h" 22 34 #include "xfs_log.h" 35 + 36 + static xfs_failaddr_t xfs_dir2_data_freefind_verify( 37 + struct xfs_dir2_data_hdr *hdr, struct xfs_dir2_data_free *bf, 38 + struct xfs_dir2_data_unused *dup, 39 + struct xfs_dir2_data_free **bf_ent); 23 40 24 41 /* 25 42 * Check the consistency of the data block. ··· 140 147 * doesn't need to be there. 141 148 */ 142 149 if (be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG) { 150 + xfs_failaddr_t fa; 151 + 143 152 if (lastfree != 0) 144 153 return __this_address; 145 154 if (endp < p + be16_to_cpu(dup->length)) ··· 149 154 if (be16_to_cpu(*xfs_dir2_data_unused_tag_p(dup)) != 150 155 (char *)dup - (char *)hdr) 151 156 return __this_address; 152 - dfp = xfs_dir2_data_freefind(hdr, bf, dup); 157 + fa = xfs_dir2_data_freefind_verify(hdr, bf, dup, &dfp); 158 + if (fa) 159 + return fa; 153 160 if (dfp) { 154 161 i = (int)(dfp - bf); 155 162 if ((freeseen & (1 << i)) != 0) ··· 239 242 if (!fa) 240 243 return; 241 244 xfs_corruption_error(__func__, XFS_ERRLEVEL_LOW, dp->i_mount, 242 - bp->b_addr, __FILE__, __LINE__, fa); 245 + bp->b_addr, BBTOB(bp->b_length), __FILE__, __LINE__, 246 + fa); 243 247 ASSERT(0); 244 248 } 245 249 #endif ··· 379 381 } 380 382 381 383 /* 384 + * Find the bestfree entry that exactly coincides with unused directory space 385 + * or a verifier error because the bestfree data are bad. 386 + */ 387 + static xfs_failaddr_t 388 + xfs_dir2_data_freefind_verify( 389 + struct xfs_dir2_data_hdr *hdr, 390 + struct xfs_dir2_data_free *bf, 391 + struct xfs_dir2_data_unused *dup, 392 + struct xfs_dir2_data_free **bf_ent) 393 + { 394 + struct xfs_dir2_data_free *dfp; 395 + xfs_dir2_data_aoff_t off; 396 + bool matched = false; 397 + bool seenzero = false; 398 + 399 + *bf_ent = NULL; 400 + off = (xfs_dir2_data_aoff_t)((char *)dup - (char *)hdr); 401 + 402 + /* 403 + * Validate some consistency in the bestfree table. 404 + * Check order, non-overlapping entries, and if we find the 405 + * one we're looking for it has to be exact. 406 + */ 407 + for (dfp = &bf[0]; dfp < &bf[XFS_DIR2_DATA_FD_COUNT]; dfp++) { 408 + if (!dfp->offset) { 409 + if (dfp->length) 410 + return __this_address; 411 + seenzero = true; 412 + continue; 413 + } 414 + if (seenzero) 415 + return __this_address; 416 + if (be16_to_cpu(dfp->offset) == off) { 417 + matched = true; 418 + if (dfp->length != dup->length) 419 + return __this_address; 420 + } else if (be16_to_cpu(dfp->offset) > off) { 421 + if (off + be16_to_cpu(dup->length) > 422 + be16_to_cpu(dfp->offset)) 423 + return __this_address; 424 + } else { 425 + if (be16_to_cpu(dfp->offset) + 426 + be16_to_cpu(dfp->length) > off) 427 + return __this_address; 428 + } 429 + if (!matched && 430 + be16_to_cpu(dfp->length) < be16_to_cpu(dup->length)) 431 + return __this_address; 432 + if (dfp > &bf[0] && 433 + be16_to_cpu(dfp[-1].length) < be16_to_cpu(dfp[0].length)) 434 + return __this_address; 435 + } 436 + 437 + /* Looks ok so far; now try to match up with a bestfree entry. */ 438 + *bf_ent = xfs_dir2_data_freefind(hdr, bf, dup); 439 + return NULL; 440 + } 441 + 442 + /* 382 443 * Given a data block and an unused entry from that block, 383 444 * return the bestfree entry if any that corresponds to it. 384 445 */ ··· 449 392 { 450 393 xfs_dir2_data_free_t *dfp; /* bestfree entry */ 451 394 xfs_dir2_data_aoff_t off; /* offset value needed */ 452 - #ifdef DEBUG 453 - int matched; /* matched the value */ 454 - int seenzero; /* saw a 0 bestfree entry */ 455 - #endif 456 395 457 396 off = (xfs_dir2_data_aoff_t)((char *)dup - (char *)hdr); 458 397 459 - #ifdef DEBUG 460 - /* 461 - * Validate some consistency in the bestfree table. 462 - * Check order, non-overlapping entries, and if we find the 463 - * one we're looking for it has to be exact. 464 - */ 465 - ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) || 466 - hdr->magic == cpu_to_be32(XFS_DIR3_DATA_MAGIC) || 467 - hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC) || 468 - hdr->magic == cpu_to_be32(XFS_DIR3_BLOCK_MAGIC)); 469 - for (dfp = &bf[0], seenzero = matched = 0; 470 - dfp < &bf[XFS_DIR2_DATA_FD_COUNT]; 471 - dfp++) { 472 - if (!dfp->offset) { 473 - ASSERT(!dfp->length); 474 - seenzero = 1; 475 - continue; 476 - } 477 - ASSERT(seenzero == 0); 478 - if (be16_to_cpu(dfp->offset) == off) { 479 - matched = 1; 480 - ASSERT(dfp->length == dup->length); 481 - } else if (off < be16_to_cpu(dfp->offset)) 482 - ASSERT(off + be16_to_cpu(dup->length) <= be16_to_cpu(dfp->offset)); 483 - else 484 - ASSERT(be16_to_cpu(dfp->offset) + be16_to_cpu(dfp->length) <= off); 485 - ASSERT(matched || be16_to_cpu(dfp->length) >= be16_to_cpu(dup->length)); 486 - if (dfp > &bf[0]) 487 - ASSERT(be16_to_cpu(dfp[-1].length) >= be16_to_cpu(dfp[0].length)); 488 - } 489 - #endif 490 398 /* 491 399 * If this is smaller than the smallest bestfree entry, 492 400 * it can't be there since they're sorted. ··· 1146 1124 return 0; 1147 1125 corrupt: 1148 1126 xfs_corruption_error(__func__, XFS_ERRLEVEL_LOW, args->dp->i_mount, 1149 - hdr, __FILE__, __LINE__, fa); 1127 + hdr, sizeof(*hdr), __FILE__, __LINE__, fa); 1150 1128 return -EFSCORRUPTED; 1151 1129 } 1152 1130
+7 -19
fs/xfs/libxfs/xfs_dir2_leaf.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc. 3 4 * Copyright (c) 2013 Red Hat, Inc. 4 5 * All Rights Reserved. 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 as 8 - * published by the Free Software Foundation. 9 - * 10 - * This program is distributed in the hope that it would 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 - * 15 - * You should have received a copy of the GNU General Public License 16 - * along with this program; if not, write the Free Software Foundation, 17 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 6 */ 19 7 #include "xfs.h" 20 8 #include "xfs_fs.h" ··· 69 81 if (!fa) 70 82 return; 71 83 xfs_corruption_error(__func__, XFS_ERRLEVEL_LOW, dp->i_mount, 72 - bp->b_addr, __FILE__, __LINE__, fa); 84 + bp->b_addr, BBTOB(bp->b_length), __FILE__, __LINE__, 85 + fa); 73 86 ASSERT(0); 74 87 } 75 88 #else ··· 590 601 (index - lowstale - 1) * 591 602 sizeof(xfs_dir2_leaf_entry_t)); 592 603 } 593 - *lfloglow = MIN(lowstale, *lfloglow); 594 - *lfloghigh = MAX(index - 1, *lfloghigh); 604 + *lfloglow = min(lowstale, *lfloglow); 605 + *lfloghigh = max(index - 1, *lfloghigh); 595 606 leafhdr->stale--; 596 607 return &ents[index - 1]; 597 608 } ··· 610 621 memmove(&ents[index + 1], &ents[index], 611 622 (highstale - index) * sizeof(xfs_dir2_leaf_entry_t)); 612 623 } 613 - *lfloglow = MIN(index, *lfloglow); 614 - *lfloghigh = MAX(highstale, *lfloghigh); 624 + *lfloglow = min(index, *lfloglow); 625 + *lfloghigh = max(highstale, *lfloghigh); 615 626 leafhdr->stale--; 616 627 return &ents[index]; 617 628 } ··· 861 872 */ 862 873 dup = (xfs_dir2_data_unused_t *) 863 874 ((char *)hdr + be16_to_cpu(bf[0].offset)); 864 - ASSERT(be16_to_cpu(dup->length) >= length); 865 875 needscan = needlog = 0; 866 876 /* 867 877 * Mark the initial part of our freespace in use for the new entry.
+3 -14
fs/xfs/libxfs/xfs_dir2_node.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2005 Silicon Graphics, Inc. 3 4 * Copyright (c) 2013 Red Hat, Inc. 4 5 * All Rights Reserved. 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 as 8 - * published by the Free Software Foundation. 9 - * 10 - * This program is distributed in the hope that it would 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 - * 15 - * You should have received a copy of the GNU General Public License 16 - * along with this program; if not, write the Free Software Foundation, 17 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 6 */ 19 7 #include "xfs.h" 20 8 #include "xfs_fs.h" ··· 72 84 if (!fa) 73 85 return; 74 86 xfs_corruption_error(__func__, XFS_ERRLEVEL_LOW, dp->i_mount, 75 - bp->b_addr, __FILE__, __LINE__, fa); 87 + bp->b_addr, BBTOB(bp->b_length), __FILE__, __LINE__, 88 + fa); 76 89 ASSERT(0); 77 90 } 78 91 #else
+1 -13
fs/xfs/libxfs/xfs_dir2_priv.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2001,2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_DIR2_PRIV_H__ 19 7 #define __XFS_DIR2_PRIV_H__
+1 -13
fs/xfs/libxfs/xfs_dir2_sf.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include "xfs.h" 19 7 #include "xfs_fs.h"
+1 -13
fs/xfs/libxfs/xfs_dquot_buf.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2006 Silicon Graphics, Inc. 3 4 * Copyright (c) 2013 Red Hat, Inc. 4 5 * All Rights Reserved. 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 as 8 - * published by the Free Software Foundation. 9 - * 10 - * This program is distributed in the hope that it would 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 - * 15 - * You should have received a copy of the GNU General Public License 16 - * along with this program; if not, write the Free Software Foundation, 17 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 6 */ 19 7 #include "xfs.h" 20 8 #include "xfs_fs.h"
+1 -14
fs/xfs/libxfs/xfs_errortag.h
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (c) 2000-2002,2005 Silicon Graphics, Inc. 3 4 * Copyright (C) 2017 Oracle. 4 5 * All Rights Reserved. 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 __XFS_ERRORTAG_H_ 21 8 #define __XFS_ERRORTAG_H_
+1 -13
fs/xfs/libxfs/xfs_format.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_FORMAT_H__ 19 7 #define __XFS_FORMAT_H__
+1 -13
fs/xfs/libxfs/xfs_fs.h
··· 1 + // SPDX-License-Identifier: LGPL-2.1 1 2 /* 2 3 * Copyright (c) 1995-2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms 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, 10 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 - * GNU Lesser General Public License for more details. 13 - * 14 - * You should have received a copy of the GNU Lesser General Public License 15 - * along with this program; if not, write the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_FS_H__ 19 7 #define __XFS_FS_H__
+41 -119
fs/xfs/libxfs/xfs_ialloc.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2002,2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include "xfs.h" 19 7 #include "xfs_fs.h" ··· 121 133 struct xfs_inobt_rec_incore *irec, 122 134 int *stat) 123 135 { 136 + struct xfs_mount *mp = cur->bc_mp; 137 + xfs_agnumber_t agno = cur->bc_private.a.agno; 124 138 union xfs_btree_rec *rec; 125 139 int error; 140 + uint64_t realfree; 126 141 127 142 error = xfs_btree_get_rec(cur, &rec, stat); 128 143 if (error || *stat == 0) 129 144 return error; 130 145 131 - xfs_inobt_btrec_to_irec(cur->bc_mp, rec, irec); 146 + xfs_inobt_btrec_to_irec(mp, rec, irec); 147 + 148 + if (!xfs_verify_agino(mp, agno, irec->ir_startino)) 149 + goto out_bad_rec; 150 + if (irec->ir_count < XFS_INODES_PER_HOLEMASK_BIT || 151 + irec->ir_count > XFS_INODES_PER_CHUNK) 152 + goto out_bad_rec; 153 + if (irec->ir_freecount > XFS_INODES_PER_CHUNK) 154 + goto out_bad_rec; 155 + 156 + /* if there are no holes, return the first available offset */ 157 + if (!xfs_inobt_issparse(irec->ir_holemask)) 158 + realfree = irec->ir_free; 159 + else 160 + realfree = irec->ir_free & xfs_inobt_irec_to_allocmask(irec); 161 + if (hweight64(realfree) != irec->ir_freecount) 162 + goto out_bad_rec; 132 163 133 164 return 0; 165 + 166 + out_bad_rec: 167 + xfs_warn(mp, 168 + "%s Inode BTree record corruption in AG %d detected!", 169 + cur->bc_btnum == XFS_BTNUM_INO ? "Used" : "Free", agno); 170 + xfs_warn(mp, 171 + "start inode 0x%x, count 0x%x, free 0x%x freemask 0x%llx, holemask 0x%x", 172 + irec->ir_startino, irec->ir_count, irec->ir_freecount, 173 + irec->ir_free, irec->ir_holemask); 174 + return -EFSCORRUPTED; 134 175 } 135 176 136 177 /* ··· 897 880 be32_add_cpu(&agi->agi_freecount, newlen); 898 881 pag = xfs_perag_get(args.mp, agno); 899 882 pag->pagi_freecount += newlen; 883 + pag->pagi_count += newlen; 900 884 xfs_perag_put(pag); 901 885 agi->agi_newino = cpu_to_be32(newino); 902 886 ··· 1992 1974 xfs_ialloc_log_agi(tp, agbp, XFS_AGI_COUNT | XFS_AGI_FREECOUNT); 1993 1975 pag = xfs_perag_get(mp, agno); 1994 1976 pag->pagi_freecount -= ilen - 1; 1977 + pag->pagi_count -= ilen; 1995 1978 xfs_perag_put(pag); 1996 1979 xfs_trans_mod_sb(tp, XFS_TRANS_SB_ICOUNT, -ilen); 1997 1980 xfs_trans_mod_sb(tp, XFS_TRANS_SB_IFREE, -(ilen - 1)); ··· 2496 2477 } 2497 2478 } 2498 2479 2499 - #ifdef DEBUG 2500 - STATIC void 2501 - xfs_check_agi_unlinked( 2502 - struct xfs_agi *agi) 2503 - { 2504 - int i; 2505 - 2506 - for (i = 0; i < XFS_AGI_UNLINKED_BUCKETS; i++) 2507 - ASSERT(agi->agi_unlinked[i]); 2508 - } 2509 - #else 2510 - #define xfs_check_agi_unlinked(agi) 2511 - #endif 2512 - 2513 2480 static xfs_failaddr_t 2514 2481 xfs_agi_verify( 2515 2482 struct xfs_buf *bp) 2516 2483 { 2517 2484 struct xfs_mount *mp = bp->b_target->bt_mount; 2518 2485 struct xfs_agi *agi = XFS_BUF_TO_AGI(bp); 2486 + int i; 2519 2487 2520 2488 if (xfs_sb_version_hascrc(&mp->m_sb)) { 2521 2489 if (!uuid_equal(&agi->agi_uuid, &mp->m_sb.sb_meta_uuid)) ··· 2538 2532 if (bp->b_pag && be32_to_cpu(agi->agi_seqno) != bp->b_pag->pag_agno) 2539 2533 return __this_address; 2540 2534 2541 - xfs_check_agi_unlinked(agi); 2535 + for (i = 0; i < XFS_AGI_UNLINKED_BUCKETS; i++) { 2536 + if (agi->agi_unlinked[i] == NULLAGINO) 2537 + continue; 2538 + if (!xfs_verify_ino(mp, be32_to_cpu(agi->agi_unlinked[i]))) 2539 + return __this_address; 2540 + } 2541 + 2542 2542 return NULL; 2543 2543 } 2544 2544 ··· 2674 2662 if (bp) 2675 2663 xfs_trans_brelse(tp, bp); 2676 2664 return 0; 2677 - } 2678 - 2679 - /* Calculate the first and last possible inode number in an AG. */ 2680 - void 2681 - xfs_ialloc_agino_range( 2682 - struct xfs_mount *mp, 2683 - xfs_agnumber_t agno, 2684 - xfs_agino_t *first, 2685 - xfs_agino_t *last) 2686 - { 2687 - xfs_agblock_t bno; 2688 - xfs_agblock_t eoag; 2689 - 2690 - eoag = xfs_ag_block_count(mp, agno); 2691 - 2692 - /* 2693 - * Calculate the first inode, which will be in the first 2694 - * cluster-aligned block after the AGFL. 2695 - */ 2696 - bno = round_up(XFS_AGFL_BLOCK(mp) + 1, 2697 - xfs_ialloc_cluster_alignment(mp)); 2698 - *first = XFS_OFFBNO_TO_AGINO(mp, bno, 0); 2699 - 2700 - /* 2701 - * Calculate the last inode, which will be at the end of the 2702 - * last (aligned) cluster that can be allocated in the AG. 2703 - */ 2704 - bno = round_down(eoag, xfs_ialloc_cluster_alignment(mp)); 2705 - *last = XFS_OFFBNO_TO_AGINO(mp, bno, 0) - 1; 2706 - } 2707 - 2708 - /* 2709 - * Verify that an AG inode number pointer neither points outside the AG 2710 - * nor points at static metadata. 2711 - */ 2712 - bool 2713 - xfs_verify_agino( 2714 - struct xfs_mount *mp, 2715 - xfs_agnumber_t agno, 2716 - xfs_agino_t agino) 2717 - { 2718 - xfs_agino_t first; 2719 - xfs_agino_t last; 2720 - 2721 - xfs_ialloc_agino_range(mp, agno, &first, &last); 2722 - return agino >= first && agino <= last; 2723 - } 2724 - 2725 - /* 2726 - * Verify that an FS inode number pointer neither points outside the 2727 - * filesystem nor points at static AG metadata. 2728 - */ 2729 - bool 2730 - xfs_verify_ino( 2731 - struct xfs_mount *mp, 2732 - xfs_ino_t ino) 2733 - { 2734 - xfs_agnumber_t agno = XFS_INO_TO_AGNO(mp, ino); 2735 - xfs_agino_t agino = XFS_INO_TO_AGINO(mp, ino); 2736 - 2737 - if (agno >= mp->m_sb.sb_agcount) 2738 - return false; 2739 - if (XFS_AGINO_TO_INO(mp, agno, agino) != ino) 2740 - return false; 2741 - return xfs_verify_agino(mp, agno, agino); 2742 - } 2743 - 2744 - /* Is this an internal inode number? */ 2745 - bool 2746 - xfs_internal_inum( 2747 - struct xfs_mount *mp, 2748 - xfs_ino_t ino) 2749 - { 2750 - return ino == mp->m_sb.sb_rbmino || ino == mp->m_sb.sb_rsumino || 2751 - (xfs_sb_version_hasquota(&mp->m_sb) && 2752 - xfs_is_quota_inode(&mp->m_sb, ino)); 2753 - } 2754 - 2755 - /* 2756 - * Verify that a directory entry's inode number doesn't point at an internal 2757 - * inode, empty space, or static AG metadata. 2758 - */ 2759 - bool 2760 - xfs_verify_dir_ino( 2761 - struct xfs_mount *mp, 2762 - xfs_ino_t ino) 2763 - { 2764 - if (xfs_internal_inum(mp, ino)) 2765 - return false; 2766 - return xfs_verify_ino(mp, ino); 2767 2665 } 2768 2666 2769 2667 /* Is there an inode record covering a given range of inode numbers? */
+1 -20
fs/xfs/libxfs/xfs_ialloc.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000,2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_IALLOC_H__ 19 7 #define __XFS_IALLOC_H__ ··· 169 181 int *stat); 170 182 171 183 int xfs_ialloc_cluster_alignment(struct xfs_mount *mp); 172 - void xfs_ialloc_agino_range(struct xfs_mount *mp, xfs_agnumber_t agno, 173 - xfs_agino_t *first, xfs_agino_t *last); 174 - bool xfs_verify_agino(struct xfs_mount *mp, xfs_agnumber_t agno, 175 - xfs_agino_t agino); 176 - bool xfs_verify_ino(struct xfs_mount *mp, xfs_ino_t ino); 177 - bool xfs_internal_inum(struct xfs_mount *mp, xfs_ino_t ino); 178 - bool xfs_verify_dir_ino(struct xfs_mount *mp, xfs_ino_t ino); 179 184 180 185 #endif /* __XFS_IALLOC_H__ */
+1 -13
fs/xfs/libxfs/xfs_ialloc_btree.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2001,2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include "xfs.h" 19 7 #include "xfs_fs.h"
+1 -13
fs/xfs/libxfs/xfs_ialloc_btree.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000,2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_IALLOC_BTREE_H__ 19 7 #define __XFS_IALLOC_BTREE_H__
+1 -9
fs/xfs/libxfs/xfs_iext_tree.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2017 Christoph Hellwig. 3 - * 4 - * This program is free software; you can redistribute it and/or modify it 5 - * under the terms and conditions of the GNU General Public License, 6 - * version 2, as published by the Free Software Foundation. 7 - * 8 - * This program is distributed in the hope it will be useful, but WITHOUT 9 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 - * more details. 12 4 */ 13 5 14 6 #include <linux/cache.h>
+15 -19
fs/xfs/libxfs/xfs_inode_buf.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2006 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include "xfs.h" 19 7 #include "xfs_fs.h" ··· 189 201 ASSERT(buf_flags & XBF_TRYLOCK); 190 202 return error; 191 203 } 192 - 193 - if (error == -EFSCORRUPTED && 194 - (iget_flags & XFS_IGET_UNTRUSTED)) 195 - return -EINVAL; 196 - 197 204 xfs_warn(mp, "%s: xfs_trans_read_buf() returned error %d.", 198 205 __func__, error); 199 206 return error; ··· 380 397 xfs_ino_t ino, 381 398 struct xfs_dinode *dip) 382 399 { 400 + xfs_failaddr_t fa; 383 401 uint16_t mode; 384 402 uint16_t flags; 385 403 uint64_t flags2; ··· 497 513 return __this_address; 498 514 } 499 515 516 + /* extent size hint validation */ 517 + fa = xfs_inode_validate_extsize(mp, be32_to_cpu(dip->di_extsize), 518 + mode, flags); 519 + if (fa) 520 + return fa; 521 + 500 522 /* only version 3 or greater inodes are extensively verified here */ 501 523 if (dip->di_version < 3) 502 524 return NULL; ··· 511 521 512 522 /* don't allow reflink/cowextsize if we don't have reflink */ 513 523 if ((flags2 & (XFS_DIFLAG2_REFLINK | XFS_DIFLAG2_COWEXTSIZE)) && 514 - !xfs_sb_version_hasreflink(&mp->m_sb)) 524 + !xfs_sb_version_hasreflink(&mp->m_sb)) 515 525 return __this_address; 516 526 517 527 /* only regular files get reflink */ ··· 525 535 /* don't let reflink and dax mix */ 526 536 if ((flags2 & XFS_DIFLAG2_REFLINK) && (flags2 & XFS_DIFLAG2_DAX)) 527 537 return __this_address; 538 + 539 + /* COW extent size hint validation */ 540 + fa = xfs_inode_validate_cowextsize(mp, be32_to_cpu(dip->di_cowextsize), 541 + mode, flags, flags2); 542 + if (fa) 543 + return fa; 528 544 529 545 return NULL; 530 546 }
+1 -13
fs/xfs/libxfs/xfs_inode_buf.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_INODE_BUF_H__ 19 7 #define __XFS_INODE_BUF_H__
+1 -13
fs/xfs/libxfs/xfs_inode_fork.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2006 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include <linux/log2.h> 19 7
+1 -13
fs/xfs/libxfs/xfs_inode_fork.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_INODE_FORK_H__ 19 7 #define __XFS_INODE_FORK_H__
+1 -13
fs/xfs/libxfs/xfs_log_format.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_LOG_FORMAT_H__ 19 7 #define __XFS_LOG_FORMAT_H__
+1 -13
fs/xfs/libxfs/xfs_log_recover.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000,2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_LOG_RECOVER_H__ 19 7 #define __XFS_LOG_RECOVER_H__
+1 -13
fs/xfs/libxfs/xfs_log_rlimit.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2013 Jie Liu. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include "xfs.h" 19 7 #include "xfs_fs.h"
+1 -13
fs/xfs/libxfs/xfs_quota_defs.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_QUOTA_DEFS_H__ 19 7 #define __XFS_QUOTA_DEFS_H__
+43 -20
fs/xfs/libxfs/xfs_refcount.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2016 Oracle. All Rights Reserved. 3 - * 4 4 * 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 5 */ 20 6 #include "xfs.h" 21 7 #include "xfs_fs.h" ··· 111 125 struct xfs_refcount_irec *irec, 112 126 int *stat) 113 127 { 128 + struct xfs_mount *mp = cur->bc_mp; 129 + xfs_agnumber_t agno = cur->bc_private.a.agno; 114 130 union xfs_btree_rec *rec; 115 131 int error; 132 + xfs_agblock_t realstart; 116 133 117 134 error = xfs_btree_get_rec(cur, &rec, stat); 118 - if (!error && *stat == 1) { 119 - xfs_refcount_btrec_to_irec(rec, irec); 120 - trace_xfs_refcount_get(cur->bc_mp, cur->bc_private.a.agno, 121 - irec); 135 + if (error || !*stat) 136 + return error; 137 + 138 + xfs_refcount_btrec_to_irec(rec, irec); 139 + 140 + agno = cur->bc_private.a.agno; 141 + if (irec->rc_blockcount == 0 || irec->rc_blockcount > MAXREFCEXTLEN) 142 + goto out_bad_rec; 143 + 144 + /* handle special COW-staging state */ 145 + realstart = irec->rc_startblock; 146 + if (realstart & XFS_REFC_COW_START) { 147 + if (irec->rc_refcount != 1) 148 + goto out_bad_rec; 149 + realstart &= ~XFS_REFC_COW_START; 150 + } else if (irec->rc_refcount < 2) { 151 + goto out_bad_rec; 122 152 } 123 - return error; 153 + 154 + /* check for valid extent range, including overflow */ 155 + if (!xfs_verify_agbno(mp, agno, realstart)) 156 + goto out_bad_rec; 157 + if (realstart > realstart + irec->rc_blockcount) 158 + goto out_bad_rec; 159 + if (!xfs_verify_agbno(mp, agno, realstart + irec->rc_blockcount - 1)) 160 + goto out_bad_rec; 161 + 162 + if (irec->rc_refcount == 0 || irec->rc_refcount > MAXREFCOUNT) 163 + goto out_bad_rec; 164 + 165 + trace_xfs_refcount_get(cur->bc_mp, cur->bc_private.a.agno, irec); 166 + return 0; 167 + 168 + out_bad_rec: 169 + xfs_warn(mp, 170 + "Refcount BTree record corruption in AG %d detected!", agno); 171 + xfs_warn(mp, 172 + "Start block 0x%x, block count 0x%x, references 0x%x", 173 + irec->rc_startblock, irec->rc_blockcount, irec->rc_refcount); 174 + return -EFSCORRUPTED; 124 175 } 125 176 126 177 /*
+1 -15
fs/xfs/libxfs/xfs_refcount.h
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2016 Oracle. All Rights Reserved. 3 - * 4 4 * 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 5 */ 20 6 #ifndef __XFS_REFCOUNT_H__ 21 7 #define __XFS_REFCOUNT_H__
+1 -16
fs/xfs/libxfs/xfs_refcount_btree.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2016 Oracle. All Rights Reserved. 3 - * 4 4 * 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 5 */ 20 6 #include "xfs.h" 21 7 #include "xfs_fs.h" ··· 178 192 struct xfs_agf *agf = XFS_BUF_TO_AGF(cur->bc_private.a.agbp); 179 193 180 194 ASSERT(cur->bc_private.a.agno == be32_to_cpu(agf->agf_seqno)); 181 - ASSERT(agf->agf_refcount_root != 0); 182 195 183 196 ptr->s = agf->agf_refcount_root; 184 197 }
+1 -15
fs/xfs/libxfs/xfs_refcount_btree.h
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2016 Oracle. All Rights Reserved. 3 - * 4 4 * 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 5 */ 20 6 #ifndef __XFS_REFCOUNT_BTREE_H__ 21 7 #define __XFS_REFCOUNT_BTREE_H__
+41 -14
fs/xfs/libxfs/xfs_rmap.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2014 Red Hat, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include "xfs.h" 19 7 #include "xfs_fs.h" ··· 27 39 #include "xfs_extent_busy.h" 28 40 #include "xfs_bmap.h" 29 41 #include "xfs_inode.h" 42 + #include "xfs_ialloc.h" 30 43 31 44 /* 32 45 * Lookup the first record less than or equal to [bno, len, owner, offset] ··· 192 203 struct xfs_rmap_irec *irec, 193 204 int *stat) 194 205 { 206 + struct xfs_mount *mp = cur->bc_mp; 207 + xfs_agnumber_t agno = cur->bc_private.a.agno; 195 208 union xfs_btree_rec *rec; 196 209 int error; 197 210 ··· 201 210 if (error || !*stat) 202 211 return error; 203 212 204 - return xfs_rmap_btrec_to_irec(rec, irec); 213 + if (xfs_rmap_btrec_to_irec(rec, irec)) 214 + goto out_bad_rec; 215 + 216 + if (irec->rm_blockcount == 0) 217 + goto out_bad_rec; 218 + if (irec->rm_startblock <= XFS_AGFL_BLOCK(mp)) { 219 + if (irec->rm_owner != XFS_RMAP_OWN_FS) 220 + goto out_bad_rec; 221 + if (irec->rm_blockcount != XFS_AGFL_BLOCK(mp) + 1) 222 + goto out_bad_rec; 223 + } else { 224 + /* check for valid extent range, including overflow */ 225 + if (!xfs_verify_agbno(mp, agno, irec->rm_startblock)) 226 + goto out_bad_rec; 227 + if (irec->rm_startblock > 228 + irec->rm_startblock + irec->rm_blockcount) 229 + goto out_bad_rec; 230 + if (!xfs_verify_agbno(mp, agno, 231 + irec->rm_startblock + irec->rm_blockcount - 1)) 232 + goto out_bad_rec; 233 + } 234 + 235 + if (!(xfs_verify_ino(mp, irec->rm_owner) || 236 + (irec->rm_owner <= XFS_RMAP_OWN_FS && 237 + irec->rm_owner >= XFS_RMAP_OWN_MIN))) 238 + goto out_bad_rec; 239 + 240 + return 0; 241 + out_bad_rec: 242 + xfs_warn(mp, 243 + "Reverse Mapping BTree record corruption in AG %d detected!", 244 + agno); 245 + xfs_warn(mp, 246 + "Owner 0x%llx, flags 0x%x, start block 0x%x block count 0x%x", 247 + irec->rm_owner, irec->rm_flags, irec->rm_startblock, 248 + irec->rm_blockcount); 249 + return -EFSCORRUPTED; 205 250 } 206 251 207 252 struct xfs_find_left_neighbor_info {
+1 -15
fs/xfs/libxfs/xfs_rmap.h
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2016 Oracle. All Rights Reserved. 3 - * 4 4 * 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 5 */ 20 6 #ifndef __XFS_RMAP_H__ 21 7 #define __XFS_RMAP_H__
+1 -14
fs/xfs/libxfs/xfs_rmap_btree.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2014 Red Hat, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include "xfs.h" 19 7 #include "xfs_fs.h" ··· 222 234 struct xfs_agf *agf = XFS_BUF_TO_AGF(cur->bc_private.a.agbp); 223 235 224 236 ASSERT(cur->bc_private.a.agno == be32_to_cpu(agf->agf_seqno)); 225 - ASSERT(agf->agf_roots[cur->bc_btnum] != 0); 226 237 227 238 ptr->s = agf->agf_roots[cur->bc_btnum]; 228 239 }
+1 -13
fs/xfs/libxfs/xfs_rmap_btree.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2014 Red Hat, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_RMAP_BTREE_H__ 19 7 #define __XFS_RMAP_BTREE_H__
+1 -25
fs/xfs/libxfs/xfs_rtbitmap.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include "xfs.h" 19 7 #include "xfs_fs.h" ··· 1078 1090 keys[0].ar_extcount = keys[1].ar_extcount = 0; 1079 1091 1080 1092 return xfs_rtalloc_query_range(tp, &keys[0], &keys[1], fn, priv); 1081 - } 1082 - 1083 - /* 1084 - * Verify that an realtime block number pointer doesn't point off the 1085 - * end of the realtime device. 1086 - */ 1087 - bool 1088 - xfs_verify_rtbno( 1089 - struct xfs_mount *mp, 1090 - xfs_rtblock_t rtbno) 1091 - { 1092 - return rtbno < mp->m_sb.sb_rblocks; 1093 1093 } 1094 1094 1095 1095 /* Is the given extent all free? */
+23 -17
fs/xfs/libxfs/xfs_sb.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include "xfs.h" 19 7 #include "xfs_fs.h" ··· 265 277 xfs_notice(mp, "SB sanity check failed"); 266 278 return -EFSCORRUPTED; 267 279 } 280 + 281 + if (sbp->sb_unit) { 282 + if (!xfs_sb_version_hasdalign(sbp) || 283 + sbp->sb_unit > sbp->sb_width || 284 + (sbp->sb_width % sbp->sb_unit) != 0) { 285 + xfs_notice(mp, "SB stripe unit sanity check failed"); 286 + return -EFSCORRUPTED; 287 + } 288 + } else if (xfs_sb_version_hasdalign(sbp)) { 289 + xfs_notice(mp, "SB stripe alignment sanity check failed"); 290 + return -EFSCORRUPTED; 291 + } else if (sbp->sb_width) { 292 + xfs_notice(mp, "SB stripe width sanity check failed"); 293 + return -EFSCORRUPTED; 294 + } 295 + 268 296 269 297 if (xfs_sb_version_hascrc(&mp->m_sb) && 270 298 sbp->sb_blocksize < XFS_MIN_CRC_BLOCKSIZE) { ··· 771 767 mp->m_refc_mnr[1] = mp->m_refc_mxr[1] / 2; 772 768 773 769 mp->m_bsize = XFS_FSB_TO_BB(mp, 1); 774 - mp->m_ialloc_inos = (int)MAX((uint16_t)XFS_INODES_PER_CHUNK, 770 + mp->m_ialloc_inos = max_t(uint16_t, XFS_INODES_PER_CHUNK, 775 771 sbp->sb_inopblock); 776 772 mp->m_ialloc_blks = mp->m_ialloc_inos >> sbp->sb_inopblog; 777 773 ··· 974 970 struct xfs_mount *mp) 975 971 { 976 972 struct xfs_trans *tp; 973 + struct xfs_buf *bp; 977 974 int error; 978 975 979 976 error = xfs_trans_alloc(mp, &M_RES(mp)->tr_sb, 0, 0, 0, &tp); 980 977 if (error) 981 978 return error; 982 979 980 + bp = xfs_trans_getsb(tp, mp, 0); 983 981 xfs_log_sb(tp); 984 - xfs_trans_bhold(tp, mp->m_sb_bp); 982 + xfs_trans_bhold(tp, bp); 985 983 xfs_trans_set_sync(tp); 986 984 error = xfs_trans_commit(tp); 987 985 if (error) ··· 991 985 /* 992 986 * write out the sb buffer to get the changes to disk 993 987 */ 994 - error = xfs_bwrite(mp->m_sb_bp); 988 + error = xfs_bwrite(bp); 995 989 out: 996 - xfs_buf_relse(mp->m_sb_bp); 990 + xfs_buf_relse(bp); 997 991 return error; 998 992 } 999 993
+1 -13
fs/xfs/libxfs/xfs_sb.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_SB_H__ 19 7 #define __XFS_SB_H__
+1 -13
fs/xfs/libxfs/xfs_shared.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2005 Silicon Graphics, Inc. 3 4 * Copyright (c) 2013 Red Hat, Inc. 4 5 * All Rights Reserved. 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 as 8 - * published by the Free Software Foundation. 9 - * 10 - * This program is distributed in the hope that it would 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 - * 15 - * You should have received a copy of the GNU General Public License 16 - * along with this program; if not, write the Free Software Foundation, 17 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 6 */ 19 7 #ifndef __XFS_SHARED_H__ 20 8 #define __XFS_SHARED_H__
+9 -21
fs/xfs/libxfs/xfs_trans_resv.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc. 3 4 * Copyright (C) 2010 Red Hat, Inc. 4 5 * All Rights Reserved. 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 as 8 - * published by the Free Software Foundation. 9 - * 10 - * This program is distributed in the hope that it would 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 - * 15 - * You should have received a copy of the GNU General Public License 16 - * along with this program; if not, write the Free Software Foundation, 17 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 6 */ 19 7 #include "xfs.h" 20 8 #include "xfs_fs.h" ··· 236 248 struct xfs_mount *mp) 237 249 { 238 250 return XFS_DQUOT_LOGRES(mp) + 239 - MAX((xfs_calc_inode_res(mp, 1) + 251 + max((xfs_calc_inode_res(mp, 1) + 240 252 xfs_calc_buf_res(XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK), 241 253 XFS_FSB_TO_B(mp, 1)) + 242 254 xfs_calc_buf_res(3, mp->m_sb.sb_sectsize) + ··· 263 275 struct xfs_mount *mp) 264 276 { 265 277 return XFS_DQUOT_LOGRES(mp) + 266 - MAX((xfs_calc_inode_res(mp, 1) + 278 + max((xfs_calc_inode_res(mp, 1) + 267 279 xfs_calc_buf_res(XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) + 1, 268 280 XFS_FSB_TO_B(mp, 1))), 269 281 (xfs_calc_buf_res(9, mp->m_sb.sb_sectsize) + ··· 288 300 struct xfs_mount *mp) 289 301 { 290 302 return XFS_DQUOT_LOGRES(mp) + 291 - MAX((xfs_calc_inode_res(mp, 4) + 303 + max((xfs_calc_inode_res(mp, 4) + 292 304 xfs_calc_buf_res(2 * XFS_DIROP_LOG_COUNT(mp), 293 305 XFS_FSB_TO_B(mp, 1))), 294 306 (xfs_calc_buf_res(7, mp->m_sb.sb_sectsize) + ··· 328 340 { 329 341 return XFS_DQUOT_LOGRES(mp) + 330 342 xfs_calc_iunlink_remove_reservation(mp) + 331 - MAX((xfs_calc_inode_res(mp, 2) + 343 + max((xfs_calc_inode_res(mp, 2) + 332 344 xfs_calc_buf_res(XFS_DIROP_LOG_COUNT(mp), 333 345 XFS_FSB_TO_B(mp, 1))), 334 346 (xfs_calc_buf_res(3, mp->m_sb.sb_sectsize) + ··· 366 378 { 367 379 return XFS_DQUOT_LOGRES(mp) + 368 380 xfs_calc_iunlink_add_reservation(mp) + 369 - MAX((xfs_calc_inode_res(mp, 1) + 381 + max((xfs_calc_inode_res(mp, 1) + 370 382 xfs_calc_buf_res(XFS_DIROP_LOG_COUNT(mp), 371 383 XFS_FSB_TO_B(mp, 1))), 372 384 (xfs_calc_buf_res(4, mp->m_sb.sb_sectsize) + ··· 424 436 xfs_calc_icreate_reservation(xfs_mount_t *mp) 425 437 { 426 438 return XFS_DQUOT_LOGRES(mp) + 427 - MAX(xfs_calc_icreate_resv_alloc(mp), 439 + max(xfs_calc_icreate_resv_alloc(mp), 428 440 xfs_calc_create_resv_modify(mp)); 429 441 } 430 442 ··· 632 644 xfs_calc_attrinval_reservation( 633 645 struct xfs_mount *mp) 634 646 { 635 - return MAX((xfs_calc_inode_res(mp, 1) + 647 + return max((xfs_calc_inode_res(mp, 1) + 636 648 xfs_calc_buf_res(XFS_BM_MAXLEVELS(mp, XFS_ATTR_FORK), 637 649 XFS_FSB_TO_B(mp, 1))), 638 650 (xfs_calc_buf_res(9, mp->m_sb.sb_sectsize) + ··· 696 708 struct xfs_mount *mp) 697 709 { 698 710 return XFS_DQUOT_LOGRES(mp) + 699 - MAX((xfs_calc_inode_res(mp, 1) + 711 + max((xfs_calc_inode_res(mp, 1) + 700 712 xfs_calc_buf_res(XFS_DA_NODE_MAXDEPTH, 701 713 XFS_FSB_TO_B(mp, 1)) + 702 714 (uint)XFS_FSB_TO_B(mp,
+1 -13
fs/xfs/libxfs/xfs_trans_resv.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2002,2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_TRANS_RESV_H__ 19 7 #define __XFS_TRANS_RESV_H__
+1 -13
fs/xfs/libxfs/xfs_trans_space.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000,2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_TRANS_SPACE_H__ 19 7 #define __XFS_TRANS_SPACE_H__
+173
fs/xfs/libxfs/xfs_types.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * Copyright (c) 2000-2002,2005 Silicon Graphics, Inc. 4 + * Copyright (C) 2017 Oracle. 5 + * All Rights Reserved. 6 + */ 7 + #include "xfs.h" 8 + #include "xfs_fs.h" 9 + #include "xfs_format.h" 10 + #include "xfs_log_format.h" 11 + #include "xfs_shared.h" 12 + #include "xfs_trans_resv.h" 13 + #include "xfs_bit.h" 14 + #include "xfs_sb.h" 15 + #include "xfs_mount.h" 16 + #include "xfs_defer.h" 17 + #include "xfs_inode.h" 18 + #include "xfs_btree.h" 19 + #include "xfs_rmap.h" 20 + #include "xfs_alloc_btree.h" 21 + #include "xfs_alloc.h" 22 + #include "xfs_ialloc.h" 23 + 24 + /* Find the size of the AG, in blocks. */ 25 + xfs_agblock_t 26 + xfs_ag_block_count( 27 + struct xfs_mount *mp, 28 + xfs_agnumber_t agno) 29 + { 30 + ASSERT(agno < mp->m_sb.sb_agcount); 31 + 32 + if (agno < mp->m_sb.sb_agcount - 1) 33 + return mp->m_sb.sb_agblocks; 34 + return mp->m_sb.sb_dblocks - (agno * mp->m_sb.sb_agblocks); 35 + } 36 + 37 + /* 38 + * Verify that an AG block number pointer neither points outside the AG 39 + * nor points at static metadata. 40 + */ 41 + bool 42 + xfs_verify_agbno( 43 + struct xfs_mount *mp, 44 + xfs_agnumber_t agno, 45 + xfs_agblock_t agbno) 46 + { 47 + xfs_agblock_t eoag; 48 + 49 + eoag = xfs_ag_block_count(mp, agno); 50 + if (agbno >= eoag) 51 + return false; 52 + if (agbno <= XFS_AGFL_BLOCK(mp)) 53 + return false; 54 + return true; 55 + } 56 + 57 + /* 58 + * Verify that an FS block number pointer neither points outside the 59 + * filesystem nor points at static AG metadata. 60 + */ 61 + bool 62 + xfs_verify_fsbno( 63 + struct xfs_mount *mp, 64 + xfs_fsblock_t fsbno) 65 + { 66 + xfs_agnumber_t agno = XFS_FSB_TO_AGNO(mp, fsbno); 67 + 68 + if (agno >= mp->m_sb.sb_agcount) 69 + return false; 70 + return xfs_verify_agbno(mp, agno, XFS_FSB_TO_AGBNO(mp, fsbno)); 71 + } 72 + 73 + /* Calculate the first and last possible inode number in an AG. */ 74 + void 75 + xfs_agino_range( 76 + struct xfs_mount *mp, 77 + xfs_agnumber_t agno, 78 + xfs_agino_t *first, 79 + xfs_agino_t *last) 80 + { 81 + xfs_agblock_t bno; 82 + xfs_agblock_t eoag; 83 + 84 + eoag = xfs_ag_block_count(mp, agno); 85 + 86 + /* 87 + * Calculate the first inode, which will be in the first 88 + * cluster-aligned block after the AGFL. 89 + */ 90 + bno = round_up(XFS_AGFL_BLOCK(mp) + 1, 91 + xfs_ialloc_cluster_alignment(mp)); 92 + *first = XFS_OFFBNO_TO_AGINO(mp, bno, 0); 93 + 94 + /* 95 + * Calculate the last inode, which will be at the end of the 96 + * last (aligned) cluster that can be allocated in the AG. 97 + */ 98 + bno = round_down(eoag, xfs_ialloc_cluster_alignment(mp)); 99 + *last = XFS_OFFBNO_TO_AGINO(mp, bno, 0) - 1; 100 + } 101 + 102 + /* 103 + * Verify that an AG inode number pointer neither points outside the AG 104 + * nor points at static metadata. 105 + */ 106 + bool 107 + xfs_verify_agino( 108 + struct xfs_mount *mp, 109 + xfs_agnumber_t agno, 110 + xfs_agino_t agino) 111 + { 112 + xfs_agino_t first; 113 + xfs_agino_t last; 114 + 115 + xfs_agino_range(mp, agno, &first, &last); 116 + return agino >= first && agino <= last; 117 + } 118 + 119 + /* 120 + * Verify that an FS inode number pointer neither points outside the 121 + * filesystem nor points at static AG metadata. 122 + */ 123 + bool 124 + xfs_verify_ino( 125 + struct xfs_mount *mp, 126 + xfs_ino_t ino) 127 + { 128 + xfs_agnumber_t agno = XFS_INO_TO_AGNO(mp, ino); 129 + xfs_agino_t agino = XFS_INO_TO_AGINO(mp, ino); 130 + 131 + if (agno >= mp->m_sb.sb_agcount) 132 + return false; 133 + if (XFS_AGINO_TO_INO(mp, agno, agino) != ino) 134 + return false; 135 + return xfs_verify_agino(mp, agno, agino); 136 + } 137 + 138 + /* Is this an internal inode number? */ 139 + bool 140 + xfs_internal_inum( 141 + struct xfs_mount *mp, 142 + xfs_ino_t ino) 143 + { 144 + return ino == mp->m_sb.sb_rbmino || ino == mp->m_sb.sb_rsumino || 145 + (xfs_sb_version_hasquota(&mp->m_sb) && 146 + xfs_is_quota_inode(&mp->m_sb, ino)); 147 + } 148 + 149 + /* 150 + * Verify that a directory entry's inode number doesn't point at an internal 151 + * inode, empty space, or static AG metadata. 152 + */ 153 + bool 154 + xfs_verify_dir_ino( 155 + struct xfs_mount *mp, 156 + xfs_ino_t ino) 157 + { 158 + if (xfs_internal_inum(mp, ino)) 159 + return false; 160 + return xfs_verify_ino(mp, ino); 161 + } 162 + 163 + /* 164 + * Verify that an realtime block number pointer doesn't point off the 165 + * end of the realtime device. 166 + */ 167 + bool 168 + xfs_verify_rtbno( 169 + struct xfs_mount *mp, 170 + xfs_rtblock_t rtbno) 171 + { 172 + return rtbno < mp->m_sb.sb_rblocks; 173 + }
+20 -13
fs/xfs/libxfs/xfs_types.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_TYPES_H__ 19 7 #define __XFS_TYPES_H__ ··· 146 158 xfs_filblks_t br_blockcount; /* number of blocks */ 147 159 xfs_exntst_t br_state; /* extent state */ 148 160 } xfs_bmbt_irec_t; 161 + 162 + /* 163 + * Type verifier functions 164 + */ 165 + struct xfs_mount; 166 + 167 + xfs_agblock_t xfs_ag_block_count(struct xfs_mount *mp, xfs_agnumber_t agno); 168 + bool xfs_verify_agbno(struct xfs_mount *mp, xfs_agnumber_t agno, 169 + xfs_agblock_t agbno); 170 + bool xfs_verify_fsbno(struct xfs_mount *mp, xfs_fsblock_t fsbno); 171 + 172 + void xfs_agino_range(struct xfs_mount *mp, xfs_agnumber_t agno, 173 + xfs_agino_t *first, xfs_agino_t *last); 174 + bool xfs_verify_agino(struct xfs_mount *mp, xfs_agnumber_t agno, 175 + xfs_agino_t agino); 176 + bool xfs_verify_ino(struct xfs_mount *mp, xfs_ino_t ino); 177 + bool xfs_internal_inum(struct xfs_mount *mp, xfs_ino_t ino); 178 + bool xfs_verify_dir_ino(struct xfs_mount *mp, xfs_ino_t ino); 179 + bool xfs_verify_rtbno(struct xfs_mount *mp, xfs_rtblock_t rtbno); 149 180 150 181 #endif /* __XFS_TYPES_H__ */
+1 -13
fs/xfs/mrlock.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2006 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_SUPPORT_MRLOCK_H__ 19 7 #define __XFS_SUPPORT_MRLOCK_H__
+2 -16
fs/xfs/scrub/agheader.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2017 Oracle. All Rights Reserved. 3 - * 4 4 * 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 5 */ 20 6 #include "xfs.h" 21 7 #include "xfs_fs.h" ··· 867 881 } 868 882 869 883 /* Check inode counters */ 870 - xfs_ialloc_agino_range(mp, agno, &first_agino, &last_agino); 884 + xfs_agino_range(mp, agno, &first_agino, &last_agino); 871 885 icount = be32_to_cpu(agi->agi_count); 872 886 if (icount > last_agino - first_agino + 1 || 873 887 icount < be32_to_cpu(agi->agi_freecount))
+1 -15
fs/xfs/scrub/agheader_repair.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2018 Oracle. All Rights Reserved. 3 - * 4 4 * 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 5 */ 20 6 #include "xfs.h" 21 7 #include "xfs_fs.h"
+1 -15
fs/xfs/scrub/alloc.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2017 Oracle. All Rights Reserved. 3 - * 4 4 * 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 5 */ 20 6 #include "xfs.h" 21 7 #include "xfs_fs.h"
+1 -15
fs/xfs/scrub/attr.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2017 Oracle. All Rights Reserved. 3 - * 4 4 * 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 5 */ 20 6 #include "xfs.h" 21 7 #include "xfs_fs.h"
+1 -15
fs/xfs/scrub/bmap.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2017 Oracle. All Rights Reserved. 3 - * 4 4 * 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 5 */ 20 6 #include "xfs.h" 21 7 #include "xfs_fs.h"
+1 -15
fs/xfs/scrub/btree.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2017 Oracle. All Rights Reserved. 3 - * 4 4 * 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 5 */ 20 6 #include "xfs.h" 21 7 #include "xfs_fs.h"
+1 -15
fs/xfs/scrub/btree.h
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2017 Oracle. All Rights Reserved. 3 - * 4 4 * 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 5 */ 20 6 #ifndef __XFS_SCRUB_BTREE_H__ 21 7 #define __XFS_SCRUB_BTREE_H__
+1 -15
fs/xfs/scrub/common.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2017 Oracle. All Rights Reserved. 3 - * 4 4 * 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 5 */ 20 6 #include "xfs.h" 21 7 #include "xfs_fs.h"
+1 -15
fs/xfs/scrub/common.h
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2017 Oracle. All Rights Reserved. 3 - * 4 4 * 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 5 */ 20 6 #ifndef __XFS_SCRUB_COMMON_H__ 21 7 #define __XFS_SCRUB_COMMON_H__
+1 -15
fs/xfs/scrub/dabtree.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2017 Oracle. All Rights Reserved. 3 - * 4 4 * 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 5 */ 20 6 #include "xfs.h" 21 7 #include "xfs_fs.h"
+1 -15
fs/xfs/scrub/dabtree.h
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2017 Oracle. All Rights Reserved. 3 - * 4 4 * 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 5 */ 20 6 #ifndef __XFS_SCRUB_DABTREE_H__ 21 7 #define __XFS_SCRUB_DABTREE_H__
+1 -15
fs/xfs/scrub/dir.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2017 Oracle. All Rights Reserved. 3 - * 4 4 * 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 5 */ 20 6 #include "xfs.h" 21 7 #include "xfs_fs.h"
+1 -15
fs/xfs/scrub/ialloc.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2017 Oracle. All Rights Reserved. 3 - * 4 4 * 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 5 */ 20 6 #include "xfs.h" 21 7 #include "xfs_fs.h"
+1 -15
fs/xfs/scrub/inode.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2017 Oracle. All Rights Reserved. 3 - * 4 4 * 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 5 */ 20 6 #include "xfs.h" 21 7 #include "xfs_fs.h"
+1 -15
fs/xfs/scrub/parent.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2017 Oracle. All Rights Reserved. 3 - * 4 4 * 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 5 */ 20 6 #include "xfs.h" 21 7 #include "xfs_fs.h"
+1 -15
fs/xfs/scrub/quota.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2017 Oracle. All Rights Reserved. 3 - * 4 4 * 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 5 */ 20 6 #include "xfs.h" 21 7 #include "xfs_fs.h"
+1 -15
fs/xfs/scrub/refcount.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2017 Oracle. All Rights Reserved. 3 - * 4 4 * 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 5 */ 20 6 #include "xfs.h" 21 7 #include "xfs_fs.h"
+1 -15
fs/xfs/scrub/repair.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2018 Oracle. All Rights Reserved. 3 - * 4 4 * 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 5 */ 20 6 #include "xfs.h" 21 7 #include "xfs_fs.h"
+1 -15
fs/xfs/scrub/repair.h
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2018 Oracle. All Rights Reserved. 3 - * 4 4 * 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 5 */ 20 6 #ifndef __XFS_SCRUB_REPAIR_H__ 21 7 #define __XFS_SCRUB_REPAIR_H__
+1 -15
fs/xfs/scrub/rmap.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2017 Oracle. All Rights Reserved. 3 - * 4 4 * 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 5 */ 20 6 #include "xfs.h" 21 7 #include "xfs_fs.h"
+1 -15
fs/xfs/scrub/rtbitmap.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2017 Oracle. All Rights Reserved. 3 - * 4 4 * 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 5 */ 20 6 #include "xfs.h" 21 7 #include "xfs_fs.h"
+1 -15
fs/xfs/scrub/scrub.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2017 Oracle. All Rights Reserved. 3 - * 4 4 * 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 5 */ 20 6 #include "xfs.h" 21 7 #include "xfs_fs.h"
+1 -15
fs/xfs/scrub/scrub.h
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2017 Oracle. All Rights Reserved. 3 - * 4 4 * 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 5 */ 20 6 #ifndef __XFS_SCRUB_SCRUB_H__ 21 7 #define __XFS_SCRUB_SCRUB_H__
+1 -15
fs/xfs/scrub/symlink.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2017 Oracle. All Rights Reserved. 3 - * 4 4 * 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 5 */ 20 6 #include "xfs.h" 21 7 #include "xfs_fs.h"
+1 -15
fs/xfs/scrub/trace.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2017 Oracle. All Rights Reserved. 3 - * 4 4 * 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 5 */ 20 6 #include "xfs.h" 21 7 #include "xfs_fs.h"
+1 -15
fs/xfs/scrub/trace.h
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2017 Oracle. All Rights Reserved. 3 - * 4 4 * 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 5 */ 20 6 #undef TRACE_SYSTEM 21 7 #define TRACE_SYSTEM xfs_scrub
+1 -15
fs/xfs/scrub/xfs_scrub.h
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2017 Oracle. All Rights Reserved. 3 - * 4 4 * 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 5 */ 20 6 #ifndef __XFS_SCRUB_H__ 21 7 #define __XFS_SCRUB_H__
+1 -13
fs/xfs/xfs.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_H__ 19 7 #define __XFS_H__
+1 -13
fs/xfs/xfs_acl.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2008, Christoph Hellwig 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include "xfs.h" 19 7 #include "xfs_format.h"
+1 -13
fs/xfs/xfs_acl.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2001-2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_ACL_H__ 19 7 #define __XFS_ACL_H__
+12 -13
fs/xfs/xfs_aops.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include "xfs.h" 19 7 #include "xfs_shared.h" ··· 531 543 { 532 544 /* Convert CoW extents to regular */ 533 545 if (!status && ioend->io_type == XFS_IO_COW) { 546 + /* 547 + * Yuk. This can do memory allocation, but is not a 548 + * transactional operation so everything is done in GFP_KERNEL 549 + * context. That can deadlock, because we hold pages in 550 + * writeback state and GFP_KERNEL allocations can block on them. 551 + * Hence we must operate in nofs conditions here. 552 + */ 553 + unsigned nofs_flag; 554 + 555 + nofs_flag = memalloc_nofs_save(); 534 556 status = xfs_reflink_convert_cow(XFS_I(ioend->io_inode), 535 557 ioend->io_offset, ioend->io_size); 558 + memalloc_nofs_restore(nofs_flag); 536 559 } 537 560 538 561 /* Reserve log space if we might write beyond the on-disk inode size. */
+1 -13
fs/xfs/xfs_aops.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2005-2006 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_AOPS_H__ 19 7 #define __XFS_AOPS_H__
+1 -13
fs/xfs/xfs_attr.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000,2002-2003,2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_ATTR_H__ 19 7 #define __XFS_ATTR_H__
+1 -13
fs/xfs/xfs_attr_inactive.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2005 Silicon Graphics, Inc. 3 4 * Copyright (c) 2013 Red Hat, Inc. 4 5 * All Rights Reserved. 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 as 8 - * published by the Free Software Foundation. 9 - * 10 - * This program is distributed in the hope that it would 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 - * 15 - * You should have received a copy of the GNU General Public License 16 - * along with this program; if not, write the Free Software Foundation, 17 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 6 */ 19 7 #include "xfs.h" 20 8 #include "xfs_fs.h"
+4 -15
fs/xfs/xfs_attr_list.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2005 Silicon Graphics, Inc. 3 4 * Copyright (c) 2013 Red Hat, Inc. 4 5 * All Rights Reserved. 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 as 8 - * published by the Free Software Foundation. 9 - * 10 - * This program is distributed in the hope that it would 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 - * 15 - * You should have received a copy of the GNU General Public License 16 - * along with this program; if not, write the Free Software Foundation, 17 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 6 */ 19 7 #include "xfs.h" 20 8 #include "xfs_fs.h" ··· 127 139 ((char *)sfe >= ((char *)sf + dp->i_afp->if_bytes)))) { 128 140 XFS_CORRUPTION_ERROR("xfs_attr_shortform_list", 129 141 XFS_ERRLEVEL_LOW, 130 - context->dp->i_mount, sfe); 142 + context->dp->i_mount, sfe, 143 + sizeof(*sfe)); 131 144 kmem_free(sbuf); 132 145 return -EFSCORRUPTED; 133 146 } ··· 230 241 if (magic != XFS_DA_NODE_MAGIC && 231 242 magic != XFS_DA3_NODE_MAGIC) { 232 243 XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp, 233 - node); 244 + node, sizeof(*node)); 234 245 goto out_corruptbuf; 235 246 } 236 247
+1 -15
fs/xfs/xfs_bmap_item.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2016 Oracle. All Rights Reserved. 3 - * 4 4 * 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 5 */ 20 6 #include "xfs.h" 21 7 #include "xfs_fs.h"
+1 -15
fs/xfs/xfs_bmap_item.h
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2016 Oracle. All Rights Reserved. 3 - * 4 4 * 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 5 */ 20 6 #ifndef __XFS_BMAP_ITEM_H__ 21 7 #define __XFS_BMAP_ITEM_H__
+9 -17
fs/xfs/xfs_bmap_util.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2006 Silicon Graphics, Inc. 3 4 * Copyright (c) 2012 Red Hat, Inc. 4 5 * All Rights Reserved. 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 as 8 - * published by the Free Software Foundation. 9 - * 10 - * This program is distributed in the hope that it would 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 - * 15 - * You should have received a copy of the GNU General Public License 16 - * along with this program; if not, write the Free Software Foundation, 17 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 6 */ 19 7 #include "xfs.h" 20 8 #include "xfs_fs.h" ··· 80 92 int error; /* error return value */ 81 93 xfs_mount_t *mp; /* mount point structure */ 82 94 xfs_extlen_t prod = 0; /* product factor for allocators */ 95 + xfs_extlen_t mod = 0; /* product factor for allocators */ 83 96 xfs_extlen_t ralen = 0; /* realtime allocation length */ 84 97 xfs_extlen_t align; /* minimum allocation alignment */ 85 98 xfs_rtblock_t rtb; ··· 100 111 * If the offset & length are not perfectly aligned 101 112 * then kill prod, it will just get us in trouble. 102 113 */ 103 - if (do_mod(ap->offset, align) || ap->length % align) 114 + div_u64_rem(ap->offset, align, &mod); 115 + if (mod || ap->length % align) 104 116 prod = 1; 105 117 /* 106 118 * Set ralen to be the actual requested length in rtextents. ··· 938 948 do_div(s, extsz); 939 949 s *= extsz; 940 950 e = startoffset_fsb + allocatesize_fsb; 941 - if ((temp = do_mod(startoffset_fsb, extsz))) 951 + div_u64_rem(startoffset_fsb, extsz, &temp); 952 + if (temp) 942 953 e += temp; 943 - if ((temp = do_mod(e, extsz))) 954 + div_u64_rem(e, extsz, &temp); 955 + if (temp) 944 956 e += extsz - temp; 945 957 } else { 946 958 s = 0; ··· 1103 1111 1104 1112 if (nimap && imap.br_startblock != HOLESTARTBLOCK) { 1105 1113 ASSERT(imap.br_startblock != DELAYSTARTBLOCK); 1106 - mod = do_mod(imap.br_startblock, mp->m_sb.sb_rextsize); 1114 + div_u64_rem(imap.br_startblock, mp->m_sb.sb_rextsize, &mod); 1107 1115 if (mod) 1108 1116 *startoffset_fsb += mp->m_sb.sb_rextsize - mod; 1109 1117 }
+1 -13
fs/xfs/xfs_bmap_util.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2006 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_BMAP_UTIL_H__ 19 7 #define __XFS_BMAP_UTIL_H__
+1 -14
fs/xfs/xfs_buf.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2006 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include "xfs.h" 19 7 #include <linux/stddef.h> ··· 21 33 #include <linux/migrate.h> 22 34 #include <linux/backing-dev.h> 23 35 #include <linux/freezer.h> 24 - #include <linux/sched/mm.h> 25 36 26 37 #include "xfs_format.h" 27 38 #include "xfs_log_format.h"
+1 -13
fs/xfs/xfs_buf.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_BUF_H__ 19 7 #define __XFS_BUF_H__
+2 -14
fs/xfs/xfs_buf_item.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include "xfs.h" 19 7 #include "xfs_fs.h" ··· 830 842 * of the last bit to be set in this word plus one. 831 843 */ 832 844 if (bit) { 833 - end_bit = MIN(bit + bits_to_set, (uint)NBWORD); 845 + end_bit = min(bit + bits_to_set, (uint)NBWORD); 834 846 mask = ((1U << (end_bit - bit)) - 1) << bit; 835 847 *wordp |= mask; 836 848 wordp++;
+1 -13
fs/xfs/xfs_buf_item.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2001,2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_BUF_ITEM_H__ 19 7 #define __XFS_BUF_ITEM_H__
+1 -13
fs/xfs/xfs_dir2_readdir.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2005 Silicon Graphics, Inc. 3 4 * Copyright (c) 2013 Red Hat, Inc. 4 5 * All Rights Reserved. 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 as 8 - * published by the Free Software Foundation. 9 - * 10 - * This program is distributed in the hope that it would 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 - * 15 - * You should have received a copy of the GNU General Public License 16 - * along with this program; if not, write the Free Software Foundation, 17 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 6 */ 19 7 #include "xfs.h" 20 8 #include "xfs_fs.h"
+1 -13
fs/xfs/xfs_discard.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (C) 2010 Red Hat, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include "xfs.h" 19 7 #include "xfs_format.h"
+1 -13
fs/xfs/xfs_dquot.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2003 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include "xfs.h" 19 7 #include "xfs_fs.h"
+1 -13
fs/xfs/xfs_dquot.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_DQUOT_H__ 19 7 #define __XFS_DQUOT_H__
+1 -13
fs/xfs/xfs_dquot_item.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2003 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include "xfs.h" 19 7 #include "xfs_fs.h"
+1 -13
fs/xfs/xfs_dquot_item.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2003 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_DQUOT_ITEM_H__ 19 7 #define __XFS_DQUOT_ITEM_H__
+4 -15
fs/xfs/xfs_error.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2001,2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include "xfs.h" 19 7 #include "xfs_format.h" ··· 322 334 const char *tag, 323 335 int level, 324 336 struct xfs_mount *mp, 325 - void *p, 337 + void *buf, 338 + size_t bufsize, 326 339 const char *filename, 327 340 int linenum, 328 341 xfs_failaddr_t failaddr) 329 342 { 330 343 if (level <= xfs_error_level) 331 - xfs_hex_dump(p, XFS_CORRUPTION_DUMP_LEN); 344 + xfs_hex_dump(buf, bufsize); 332 345 xfs_error_report(tag, level, mp, filename, linenum, failaddr); 333 346 xfs_alert(mp, "Corruption detected. Unmount and run xfs_repair"); 334 347 }
+6 -17
fs/xfs/xfs_error.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2002,2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_ERROR_H__ 19 7 #define __XFS_ERROR_H__ ··· 12 24 const char *filename, int linenum, 13 25 xfs_failaddr_t failaddr); 14 26 extern void xfs_corruption_error(const char *tag, int level, 15 - struct xfs_mount *mp, void *p, const char *filename, 16 - int linenum, xfs_failaddr_t failaddr); 27 + struct xfs_mount *mp, void *buf, size_t bufsize, 28 + const char *filename, int linenum, 29 + xfs_failaddr_t failaddr); 17 30 extern void xfs_buf_verifier_error(struct xfs_buf *bp, int error, 18 31 const char *name, void *buf, size_t bufsz, 19 32 xfs_failaddr_t failaddr); ··· 26 37 27 38 #define XFS_ERROR_REPORT(e, lvl, mp) \ 28 39 xfs_error_report(e, lvl, mp, __FILE__, __LINE__, __return_address) 29 - #define XFS_CORRUPTION_ERROR(e, lvl, mp, mem) \ 30 - xfs_corruption_error(e, lvl, mp, mem, \ 40 + #define XFS_CORRUPTION_ERROR(e, lvl, mp, buf, bufsize) \ 41 + xfs_corruption_error(e, lvl, mp, buf, bufsize, \ 31 42 __FILE__, __LINE__, __return_address) 32 43 33 44 #define XFS_ERRLEVEL_OFF 0
+13 -16
fs/xfs/xfs_export.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2004-2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include "xfs.h" 19 7 #include "xfs_format.h" ··· 128 140 */ 129 141 error = xfs_iget(mp, NULL, ino, XFS_IGET_UNTRUSTED, 0, &ip); 130 142 if (error) { 143 + 131 144 /* 132 145 * EINVAL means the inode cluster doesn't exist anymore. 133 - * This implies the filehandle is stale, so we should 134 - * translate it here. 146 + * EFSCORRUPTED means the metadata pointing to the inode cluster 147 + * or the inode cluster itself is corrupt. This implies the 148 + * filehandle is stale, so we should translate it here. 135 149 * We don't use ESTALE directly down the chain to not 136 150 * confuse applications using bulkstat that expect EINVAL. 137 151 */ 138 - if (error == -EINVAL || error == -ENOENT) 152 + switch (error) { 153 + case -EINVAL: 154 + case -ENOENT: 155 + case -EFSCORRUPTED: 139 156 error = -ESTALE; 157 + break; 158 + default: 159 + break; 160 + } 140 161 return ERR_PTR(error); 141 162 } 142 163
+1 -13
fs/xfs/xfs_export.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_EXPORT_H__ 19 7 #define __XFS_EXPORT_H__
+1 -13
fs/xfs/xfs_extent_busy.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2002,2005 Silicon Graphics, Inc. 3 4 * Copyright (c) 2010 David Chinner. 4 5 * Copyright (c) 2011 Christoph Hellwig. 5 6 * All Rights Reserved. 6 - * 7 - * This program is free software; you can redistribute it and/or 8 - * modify it under the terms of the GNU General Public License as 9 - * published by the Free Software Foundation. 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 7 */ 20 8 #include "xfs.h" 21 9 #include "xfs_fs.h"
+1 -13
fs/xfs/xfs_extent_busy.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2002,2005 Silicon Graphics, Inc. 3 4 * Copyright (c) 2010 David Chinner. 4 5 * Copyright (c) 2011 Christoph Hellwig. 5 6 * All Rights Reserved. 6 - * 7 - * This program is free software; you can redistribute it and/or 8 - * modify it under the terms of the GNU General Public License as 9 - * published by the Free Software Foundation. 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 7 */ 20 8 #ifndef __XFS_EXTENT_BUSY_H__ 21 9 #define __XFS_EXTENT_BUSY_H__
+1 -13
fs/xfs/xfs_extfree_item.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2001,2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include "xfs.h" 19 7 #include "xfs_fs.h"
+1 -13
fs/xfs/xfs_extfree_item.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000,2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_EXTFREE_ITEM_H__ 19 7 #define __XFS_EXTFREE_ITEM_H__
+1 -13
fs/xfs/xfs_file.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include "xfs.h" 19 7 #include "xfs_fs.h"
+1 -13
fs/xfs/xfs_filestream.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2006-2007 Silicon Graphics, Inc. 3 4 * Copyright (c) 2014 Christoph Hellwig. 4 5 * All Rights Reserved. 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 as 8 - * published by the Free Software Foundation. 9 - * 10 - * This program is distributed in the hope that it would 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 - * 15 - * You should have received a copy of the GNU General Public License 16 - * along with this program; if not, write the Free Software Foundation, 17 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 6 */ 19 7 #include "xfs.h" 20 8 #include "xfs_format.h"
+1 -13
fs/xfs/xfs_filestream.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2006-2007 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_FILESTREAM_H__ 19 7 #define __XFS_FILESTREAM_H__
+1 -15
fs/xfs/xfs_fsmap.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2017 Oracle. All Rights Reserved. 3 - * 4 4 * 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 5 */ 20 6 #include "xfs.h" 21 7 #include "xfs_fs.h"
+1 -15
fs/xfs/xfs_fsmap.h
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2017 Oracle. All Rights Reserved. 3 - * 4 4 * 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 5 */ 20 6 #ifndef __XFS_FSMAP_H__ 21 7 #define __XFS_FSMAP_H__
+1 -13
fs/xfs/xfs_fsops.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include "xfs.h" 19 7 #include "xfs_fs.h"
+1 -13
fs/xfs/xfs_fsops.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2001,2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_FSOPS_H__ 19 7 #define __XFS_FSOPS_H__
+1 -13
fs/xfs/xfs_globals.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include "xfs.h" 19 7 #include "xfs_sysctl.h"
+1 -13
fs/xfs/xfs_icache.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include "xfs.h" 19 7 #include "xfs_fs.h"
+1 -13
fs/xfs/xfs_icache.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2006 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef XFS_SYNC_H 19 7 #define XFS_SYNC_H 1
+1 -13
fs/xfs/xfs_icreate_item.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2008-2010, 2013 Dave Chinner 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include "xfs.h" 19 7 #include "xfs_fs.h"
+1 -13
fs/xfs/xfs_icreate_item.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2008-2010, Dave Chinner 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef XFS_ICREATE_ITEM_H 19 7 #define XFS_ICREATE_ITEM_H 1
+16 -19
fs/xfs/xfs_inode.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2006 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include <linux/log2.h> 19 7 #include <linux/iversion.h> ··· 2078 2090 * list this inode will go on. 2079 2091 */ 2080 2092 agino = XFS_INO_TO_AGINO(mp, ip->i_ino); 2081 - ASSERT(agino != 0); 2093 + if (!xfs_verify_agino(mp, agno, agino)) 2094 + return -EFSCORRUPTED; 2082 2095 bucket_index = agino % XFS_AGI_UNLINKED_BUCKETS; 2083 - ASSERT(agi->agi_unlinked[bucket_index] != cpu_to_be32(NULLAGINO)); 2084 - ASSERT(agi->agi_unlinked[bucket_index]); 2096 + if (!xfs_verify_agino(mp, agno, 2097 + be32_to_cpu(agi->agi_unlinked[bucket_index]))) { 2098 + XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, mp, 2099 + agi, sizeof(*agi)); 2100 + return -EFSCORRUPTED; 2101 + } 2085 2102 2086 2103 if (be32_to_cpu(agi->agi_unlinked[bucket_index]) == agino) { 2087 2104 /* ··· 2164 2171 2165 2172 last_offset = imap.im_boffset; 2166 2173 next_agino = be32_to_cpu(last_dip->di_next_unlinked); 2167 - ASSERT(next_agino != NULLAGINO); 2168 - ASSERT(next_agino != 0); 2174 + if (!xfs_verify_agino(mp, agno, next_agino)) { 2175 + XFS_CORRUPTION_ERROR(__func__, 2176 + XFS_ERRLEVEL_LOW, mp, 2177 + last_dip, sizeof(*last_dip)); 2178 + return -EFSCORRUPTED; 2179 + } 2169 2180 } 2170 2181 2171 2182 /* ··· 2258 2261 */ 2259 2262 ioffset = inum - xic->first_ino; 2260 2263 if ((xic->alloc & XFS_INOBT_MASK(ioffset)) == 0) { 2261 - ASSERT(do_mod(ioffset, inodes_per_cluster) == 0); 2264 + ASSERT(ioffset % inodes_per_cluster == 0); 2262 2265 continue; 2263 2266 } 2264 2267
+1 -13
fs/xfs/xfs_inode.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_INODE_H__ 19 7 #define __XFS_INODE_H__
+1 -13
fs/xfs/xfs_inode_item.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2002,2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include "xfs.h" 19 7 #include "xfs_fs.h"
+1 -13
fs/xfs/xfs_inode_item.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000,2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_INODE_ITEM_H__ 19 7 #define __XFS_INODE_ITEM_H__
+13 -20
fs/xfs/xfs_ioctl.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include "xfs.h" 19 7 #include "xfs_fs.h" ··· 1082 1094 /* 1083 1095 * It is only valid to set the DAX flag on regular files and 1084 1096 * directories on filesystems where the block size is equal to the page 1085 - * size. On directories it serves as an inherit hint. 1097 + * size. On directories it serves as an inherited hint so we don't 1098 + * have to check the device for dax support or flush pagecache. 1086 1099 */ 1087 1100 if (fa->fsx_xflags & FS_XFLAG_DAX) { 1088 1101 if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode))) 1089 1102 return -EINVAL; 1090 - if (!bdev_dax_supported(xfs_find_bdev_for_inode(VFS_I(ip)), 1103 + if (S_ISREG(inode->i_mode) && 1104 + !bdev_dax_supported(xfs_find_bdev_for_inode(VFS_I(ip)), 1091 1105 sb->s_blocksize)) 1092 1106 return -EINVAL; 1093 1107 } ··· 1098 1108 if ((fa->fsx_xflags & FS_XFLAG_DAX) && IS_DAX(inode)) 1099 1109 return 0; 1100 1110 if (!(fa->fsx_xflags & FS_XFLAG_DAX) && !IS_DAX(inode)) 1111 + return 0; 1112 + 1113 + if (S_ISDIR(inode->i_mode)) 1101 1114 return 0; 1102 1115 1103 1116 /* lock, flush and invalidate mapping in preparation for flag change */ ··· 1812 1819 /* Paranoia */ 1813 1820 BUILD_BUG_ON(sizeof(sbp->sb_fname) > FSLABEL_MAX); 1814 1821 1822 + /* 1 larger than sb_fname, so this ensures a trailing NUL char */ 1823 + memset(label, 0, sizeof(label)); 1815 1824 spin_lock(&mp->m_sb_lock); 1816 - strncpy(label, sbp->sb_fname, sizeof(sbp->sb_fname)); 1825 + strncpy(label, sbp->sb_fname, XFSLABEL_MAX); 1817 1826 spin_unlock(&mp->m_sb_lock); 1818 1827 1819 - /* xfs on-disk label is 12 chars, be sure we send a null to user */ 1820 - label[XFSLABEL_MAX] = '\0'; 1821 - if (copy_to_user(user_label, label, sizeof(sbp->sb_fname))) 1828 + if (copy_to_user(user_label, label, sizeof(label))) 1822 1829 return -EFAULT; 1823 1830 return 0; 1824 1831 } ··· 1854 1861 1855 1862 spin_lock(&mp->m_sb_lock); 1856 1863 memset(sbp->sb_fname, 0, sizeof(sbp->sb_fname)); 1857 - strncpy(sbp->sb_fname, label, sizeof(sbp->sb_fname)); 1864 + memcpy(sbp->sb_fname, label, len); 1858 1865 spin_unlock(&mp->m_sb_lock); 1859 1866 1860 1867 /*
+1 -13
fs/xfs/xfs_ioctl.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2008 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_IOCTL_H__ 19 7 #define __XFS_IOCTL_H__
+1 -13
fs/xfs/xfs_ioctl32.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2004-2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include <linux/compat.h> 19 7 #include <linux/ioctl.h>
+1 -13
fs/xfs/xfs_ioctl32.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2004-2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_IOCTL32_H__ 19 7 #define __XFS_IOCTL32_H__
+4 -16
fs/xfs/xfs_iomap.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2006 Silicon Graphics, Inc. 3 4 * Copyright (c) 2016 Christoph Hellwig. 4 5 * All Rights Reserved. 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 as 8 - * published by the Free Software Foundation. 9 - * 10 - * This program is distributed in the hope that it would 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 - * 15 - * You should have received a copy of the GNU General Public License 16 - * along with this program; if not, write the Free Software Foundation, 17 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 6 */ 19 7 #include <linux/iomap.h> 20 8 #include "xfs.h" ··· 188 200 goto out_unlock; 189 201 } else { 190 202 if (nmaps && (imap->br_startblock == HOLESTARTBLOCK)) 191 - last_fsb = MIN(last_fsb, (xfs_fileoff_t) 203 + last_fsb = min(last_fsb, (xfs_fileoff_t) 192 204 imap->br_blockcount + 193 205 imap->br_startoff); 194 206 } ··· 476 488 * The shift throttle value is set to the maximum value as determined by 477 489 * the global low free space values and per-quota low free space values. 478 490 */ 479 - alloc_blocks = MIN(alloc_blocks, qblocks); 480 - shift = MAX(shift, qshift); 491 + alloc_blocks = min(alloc_blocks, qblocks); 492 + shift = max(shift, qshift); 481 493 482 494 if (shift) 483 495 alloc_blocks >>= shift;
+3 -15
fs/xfs/xfs_iomap.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2003-2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_IOMAP_H__ 19 7 #define __XFS_IOMAP_H__ ··· 30 42 if (extsz) { 31 43 xfs_extlen_t align; 32 44 33 - align = do_mod(offset_fsb, extsz); 45 + div_u64_rem(offset_fsb, extsz, &align); 34 46 if (align) 35 47 count_fsb += align; 36 - align = do_mod(count_fsb, extsz); 48 + div_u64_rem(count_fsb, extsz, &align); 37 49 if (align) 38 50 count_fsb += extsz - align; 39 51 }
+9 -13
fs/xfs/xfs_iops.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include "xfs.h" 19 7 #include "xfs_fs.h" ··· 1262 1274 xfs_diflags_to_iflags(inode, ip); 1263 1275 1264 1276 if (S_ISDIR(inode->i_mode)) { 1277 + /* 1278 + * We set the i_rwsem class here to avoid potential races with 1279 + * lockdep_annotate_inode_mutex_key() reinitialising the lock 1280 + * after a filehandle lookup has already found the inode in 1281 + * cache before it has been unlocked via unlock_new_inode(). 1282 + */ 1283 + lockdep_set_class(&inode->i_rwsem, 1284 + &inode->i_sb->s_type->i_mutex_dir_key); 1265 1285 lockdep_set_class(&ip->i_lock.mr_lock, &xfs_dir_ilock_class); 1266 1286 ip->d_ops = ip->i_mount->m_dir_inode_ops; 1267 1287 } else {
+1 -13
fs/xfs/xfs_iops.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_IOPS_H__ 19 7 #define __XFS_IOPS_H__
+2 -14
fs/xfs/xfs_itable.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2002,2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include "xfs.h" 19 7 #include "xfs_fs.h" ··· 559 571 *lastino != XFS_AGINO_TO_INO(mp, agno, agino)) 560 572 return error; 561 573 562 - bcount = MIN(left, (int)(PAGE_SIZE / sizeof(*buffer))); 574 + bcount = min(left, (int)(PAGE_SIZE / sizeof(*buffer))); 563 575 buffer = kmem_zalloc(bcount * sizeof(*buffer), KM_SLEEP); 564 576 do { 565 577 struct xfs_inobt_rec_incore r;
+1 -13
fs/xfs/xfs_itable.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2001 Silicon Graphics, Inc. All Rights Reserved. 3 - * 4 - * This program is free software; you can redistribute it and/or 5 - * modify it under the terms of the GNU General Public License as 6 - * published by the Free Software Foundation. 7 - * 8 - * This program is distributed in the hope that it would be useful, 9 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 - * GNU General Public License for more details. 12 - * 13 - * You should have received a copy of the GNU General Public License 14 - * along with this program; if not, write the Free Software Foundation, 15 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 16 4 */ 17 5 #ifndef __XFS_ITABLE_H__ 18 6 #define __XFS_ITABLE_H__
+2 -34
fs/xfs/xfs_linux.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_LINUX__ 19 7 #define __XFS_LINUX__ ··· 26 38 27 39 #include <linux/semaphore.h> 28 40 #include <linux/mm.h> 41 + #include <linux/sched/mm.h> 29 42 #include <linux/kernel.h> 30 43 #include <linux/blkdev.h> 31 44 #include <linux/slab.h> ··· 140 151 141 152 #define XFS_PROJID_DEFAULT 0 142 153 143 - #define MIN(a,b) (min(a,b)) 144 - #define MAX(a,b) (max(a,b)) 145 154 #define howmany(x, y) (((x)+((y)-1))/(y)) 146 155 147 156 static inline void delay(long ticks) ··· 206 219 */ 207 220 #define xfs_sort(a,n,s,fn) sort(a,n,s,fn,NULL) 208 221 #define xfs_stack_trace() dump_stack() 209 - 210 - /* Side effect free 64 bit mod operation */ 211 - static inline __u32 xfs_do_mod(void *a, __u32 b, int n) 212 - { 213 - switch (n) { 214 - case 4: 215 - return *(__u32 *)a % b; 216 - case 8: 217 - { 218 - __u64 c = *(__u64 *)a; 219 - return do_div(c, b); 220 - } 221 - } 222 - 223 - /* NOTREACHED */ 224 - return 0; 225 - } 226 - 227 - #define do_mod(a, b) xfs_do_mod(&(a), (b), sizeof(a)) 228 222 229 223 static inline uint64_t roundup_64(uint64_t x, uint32_t y) 230 224 {
+3 -15
fs/xfs/xfs_log.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include "xfs.h" 19 7 #include "xfs_fs.h" ··· 1629 1641 * log, and 256 blocks. 1630 1642 */ 1631 1643 free_threshold = BTOBB(need_bytes); 1632 - free_threshold = MAX(free_threshold, (log->l_logBBsize >> 2)); 1633 - free_threshold = MAX(free_threshold, 256); 1644 + free_threshold = max(free_threshold, (log->l_logBBsize >> 2)); 1645 + free_threshold = max(free_threshold, 256); 1634 1646 if (free_blocks >= free_threshold) 1635 1647 return; 1636 1648
+1 -13
fs/xfs/xfs_log.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_LOG_H__ 19 7 #define __XFS_LOG_H__
+1 -13
fs/xfs/xfs_log_cil.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2010 Red Hat, Inc. All Rights Reserved. 3 - * 4 - * This program is free software; you can redistribute it and/or 5 - * modify it under the terms of the GNU General Public License as 6 - * published by the Free Software Foundation. 7 - * 8 - * This program is distributed in the hope that it would be useful, 9 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 - * GNU General Public License for more details. 12 - * 13 - * You should have received a copy of the GNU General Public License 14 - * along with this program; if not, write the Free Software Foundation, 15 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 16 4 */ 17 5 18 6 #include "xfs.h"
+1 -13
fs/xfs/xfs_log_priv.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_LOG_PRIV_H__ 19 7 #define __XFS_LOG_PRIV_H__
+39 -28
fs/xfs/xfs_log_recover.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2006 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include "xfs.h" 19 7 #include "xfs_fs.h" ··· 1236 1248 } 1237 1249 1238 1250 /* 1251 + * We need to make sure we handle log wrapping properly, so we can't use the 1252 + * calculated logbno directly. Make sure it wraps to the correct bno inside the 1253 + * log. 1254 + * 1255 + * The log is limited to 32 bit sizes, so we use the appropriate modulus 1256 + * operation here and cast it back to a 64 bit daddr on return. 1257 + */ 1258 + static inline xfs_daddr_t 1259 + xlog_wrap_logbno( 1260 + struct xlog *log, 1261 + xfs_daddr_t bno) 1262 + { 1263 + int mod; 1264 + 1265 + div_s64_rem(bno, log->l_logBBsize, &mod); 1266 + return mod; 1267 + } 1268 + 1269 + /* 1239 1270 * Check whether the head of the log points to an unmount record. In other 1240 1271 * words, determine whether the log is clean. If so, update the in-core state 1241 1272 * appropriately. ··· 1302 1295 } else { 1303 1296 hblks = 1; 1304 1297 } 1305 - after_umount_blk = rhead_blk + hblks + BTOBB(be32_to_cpu(rhead->h_len)); 1306 - after_umount_blk = do_mod(after_umount_blk, log->l_logBBsize); 1298 + 1299 + after_umount_blk = xlog_wrap_logbno(log, 1300 + rhead_blk + hblks + BTOBB(be32_to_cpu(rhead->h_len))); 1301 + 1307 1302 if (*head_blk == after_umount_blk && 1308 1303 be32_to_cpu(rhead->h_num_logops) == 1) { 1309 - umount_data_blk = rhead_blk + hblks; 1310 - umount_data_blk = do_mod(umount_data_blk, log->l_logBBsize); 1304 + umount_data_blk = xlog_wrap_logbno(log, rhead_blk + hblks); 1311 1305 error = xlog_bread(log, umount_data_blk, 1, bp, &offset); 1312 1306 if (error) 1313 1307 return error; ··· 1824 1816 * we don't waste all day writing from the head to the tail 1825 1817 * for no reason. 1826 1818 */ 1827 - max_distance = MIN(max_distance, tail_distance); 1819 + max_distance = min(max_distance, tail_distance); 1828 1820 1829 1821 if ((head_block + max_distance) <= log->l_logBBsize) { 1830 1822 /* ··· 2892 2884 * buffers in the log can be a different size if the log was generated 2893 2885 * by an older kernel using unclustered inode buffers or a newer kernel 2894 2886 * running with a different inode cluster size. Regardless, if the 2895 - * the inode buffer size isn't MAX(blocksize, mp->m_inode_cluster_size) 2887 + * the inode buffer size isn't max(blocksize, mp->m_inode_cluster_size) 2896 2888 * for *our* value of mp->m_inode_cluster_size, then we need to keep 2897 2889 * the buffer out of the buffer cache so that the buffer won't 2898 2890 * overlap with future reads of those inodes. 2899 2891 */ 2900 2892 if (XFS_DINODE_MAGIC == 2901 2893 be16_to_cpu(*((__be16 *)xfs_buf_offset(bp, 0))) && 2902 - (BBTOB(bp->b_io_length) != MAX(log->l_mp->m_sb.sb_blocksize, 2894 + (BBTOB(bp->b_io_length) != max(log->l_mp->m_sb.sb_blocksize, 2903 2895 (uint32_t)log->l_mp->m_inode_cluster_size))) { 2904 2896 xfs_buf_stale(bp); 2905 2897 error = xfs_bwrite(bp); ··· 3123 3115 if ((ldip->di_format != XFS_DINODE_FMT_EXTENTS) && 3124 3116 (ldip->di_format != XFS_DINODE_FMT_BTREE)) { 3125 3117 XFS_CORRUPTION_ERROR("xlog_recover_inode_pass2(3)", 3126 - XFS_ERRLEVEL_LOW, mp, ldip); 3118 + XFS_ERRLEVEL_LOW, mp, ldip, 3119 + sizeof(*ldip)); 3127 3120 xfs_alert(mp, 3128 3121 "%s: Bad regular inode log record, rec ptr "PTR_FMT", " 3129 3122 "ino ptr = "PTR_FMT", ino bp = "PTR_FMT", ino %Ld", ··· 3137 3128 (ldip->di_format != XFS_DINODE_FMT_BTREE) && 3138 3129 (ldip->di_format != XFS_DINODE_FMT_LOCAL)) { 3139 3130 XFS_CORRUPTION_ERROR("xlog_recover_inode_pass2(4)", 3140 - XFS_ERRLEVEL_LOW, mp, ldip); 3131 + XFS_ERRLEVEL_LOW, mp, ldip, 3132 + sizeof(*ldip)); 3141 3133 xfs_alert(mp, 3142 3134 "%s: Bad dir inode log record, rec ptr "PTR_FMT", " 3143 3135 "ino ptr = "PTR_FMT", ino bp = "PTR_FMT", ino %Ld", ··· 3149 3139 } 3150 3140 if (unlikely(ldip->di_nextents + ldip->di_anextents > ldip->di_nblocks)){ 3151 3141 XFS_CORRUPTION_ERROR("xlog_recover_inode_pass2(5)", 3152 - XFS_ERRLEVEL_LOW, mp, ldip); 3142 + XFS_ERRLEVEL_LOW, mp, ldip, 3143 + sizeof(*ldip)); 3153 3144 xfs_alert(mp, 3154 3145 "%s: Bad inode log record, rec ptr "PTR_FMT", dino ptr "PTR_FMT", " 3155 3146 "dino bp "PTR_FMT", ino %Ld, total extents = %d, nblocks = %Ld", ··· 3162 3151 } 3163 3152 if (unlikely(ldip->di_forkoff > mp->m_sb.sb_inodesize)) { 3164 3153 XFS_CORRUPTION_ERROR("xlog_recover_inode_pass2(6)", 3165 - XFS_ERRLEVEL_LOW, mp, ldip); 3154 + XFS_ERRLEVEL_LOW, mp, ldip, 3155 + sizeof(*ldip)); 3166 3156 xfs_alert(mp, 3167 3157 "%s: Bad inode log record, rec ptr "PTR_FMT", dino ptr "PTR_FMT", " 3168 3158 "dino bp "PTR_FMT", ino %Ld, forkoff 0x%x", __func__, ··· 3174 3162 isize = xfs_log_dinode_size(ldip->di_version); 3175 3163 if (unlikely(item->ri_buf[1].i_len > isize)) { 3176 3164 XFS_CORRUPTION_ERROR("xlog_recover_inode_pass2(7)", 3177 - XFS_ERRLEVEL_LOW, mp, ldip); 3165 + XFS_ERRLEVEL_LOW, mp, ldip, 3166 + sizeof(*ldip)); 3178 3167 xfs_alert(mp, 3179 3168 "%s: Bad inode log record length %d, rec ptr "PTR_FMT, 3180 3169 __func__, item->ri_buf[1].i_len, item); ··· 5479 5466 */ 5480 5467 if (blk_no + bblks <= log->l_logBBsize || 5481 5468 blk_no >= log->l_logBBsize) { 5482 - /* mod blk_no in case the header wrapped and 5483 - * pushed it beyond the end of the log */ 5484 - rblk_no = do_mod(blk_no, log->l_logBBsize); 5469 + rblk_no = xlog_wrap_logbno(log, blk_no); 5485 5470 error = xlog_bread(log, rblk_no, bblks, dbp, 5486 5471 &offset); 5487 5472 if (error)
+1 -13
fs/xfs/xfs_message.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2011 Red Hat, Inc. All Rights Reserved. 3 - * 4 - * This program is free software; you can redistribute it and/or 5 - * modify it under the terms of the GNU General Public License as 6 - * published by the Free Software Foundation. 7 - * 8 - * This program is distributed in the hope that it would be useful, 9 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 - * GNU General Public License for more details. 12 - * 13 - * You should have received a copy of the GNU General Public License 14 - * along with this program; if not, write the Free Software Foundation, 15 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 16 4 */ 17 5 18 6 #include "xfs.h"
+6 -15
fs/xfs/xfs_mount.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include "xfs.h" 19 7 #include "xfs_fs.h" ··· 862 874 * Get and sanity-check the root inode. 863 875 * Save the pointer to it in the mount structure. 864 876 */ 865 - error = xfs_iget(mp, NULL, sbp->sb_rootino, 0, XFS_ILOCK_EXCL, &rip); 877 + error = xfs_iget(mp, NULL, sbp->sb_rootino, XFS_IGET_UNTRUSTED, 878 + XFS_ILOCK_EXCL, &rip); 866 879 if (error) { 867 - xfs_warn(mp, "failed to read root inode"); 880 + xfs_warn(mp, 881 + "Failed to read root inode 0x%llx, error %d", 882 + sbp->sb_rootino, -error); 868 883 goto out_log_dealloc; 869 884 } 870 885
+2 -14
fs/xfs/xfs_mount.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_MOUNT_H__ 19 7 #define __XFS_MOUNT_H__ ··· 271 283 return (mp->m_swidth ? 272 284 (mp->m_swidth << mp->m_sb.sb_blocklog) : 273 285 ((mp->m_flags & XFS_MOUNT_DFLT_IOSIZE) ? 274 - (1 << (int)MAX(mp->m_readio_log, mp->m_writeio_log)) : 286 + (1 << (int)max(mp->m_readio_log, mp->m_writeio_log)) : 275 287 PAGE_SIZE)); 276 288 } 277 289
+1 -13
fs/xfs/xfs_mru_cache.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2006-2007 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include "xfs.h" 19 7 #include "xfs_mru_cache.h"
+1 -13
fs/xfs/xfs_mru_cache.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2006-2007 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_MRU_CACHE_H__ 19 7 #define __XFS_MRU_CACHE_H__
+1 -13
fs/xfs/xfs_ondisk.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2016 Oracle. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_ONDISK_H 19 7 #define __XFS_ONDISK_H
+1 -13
fs/xfs/xfs_qm.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include "xfs.h" 19 7 #include "xfs_fs.h"
+1 -13
fs/xfs/xfs_qm.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_QM_H__ 19 7 #define __XFS_QM_H__
+1 -13
fs/xfs/xfs_qm_bhv.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2006 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include "xfs.h" 19 7 #include "xfs_fs.h"
+1 -13
fs/xfs/xfs_qm_syscalls.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 19 7 #include <linux/capability.h>
+1 -13
fs/xfs/xfs_quota.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_QUOTA_H__ 19 7 #define __XFS_QUOTA_H__
+1 -13
fs/xfs/xfs_quotaops.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2008, Christoph Hellwig 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include "xfs.h" 19 7 #include "xfs_format.h"
+1 -15
fs/xfs/xfs_refcount_item.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2016 Oracle. All Rights Reserved. 3 - * 4 4 * 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 5 */ 20 6 #include "xfs.h" 21 7 #include "xfs_fs.h"
+1 -15
fs/xfs/xfs_refcount_item.h
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2016 Oracle. All Rights Reserved. 3 - * 4 4 * 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 5 */ 20 6 #ifndef __XFS_REFCOUNT_ITEM_H__ 21 7 #define __XFS_REFCOUNT_ITEM_H__
+1 -15
fs/xfs/xfs_reflink.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2016 Oracle. All Rights Reserved. 3 - * 4 4 * 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 5 */ 20 6 #include "xfs.h" 21 7 #include "xfs_fs.h"
+1 -15
fs/xfs/xfs_reflink.h
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2016 Oracle. All Rights Reserved. 3 - * 4 4 * 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 5 */ 20 6 #ifndef __XFS_REFLINK_H 21 7 #define __XFS_REFLINK_H 1
+1 -15
fs/xfs/xfs_rmap_item.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2016 Oracle. All Rights Reserved. 3 - * 4 4 * 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 5 */ 20 6 #include "xfs.h" 21 7 #include "xfs_fs.h"
+1 -15
fs/xfs/xfs_rmap_item.h
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2016 Oracle. All Rights Reserved. 3 - * 4 4 * 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 5 */ 20 6 #ifndef __XFS_RMAP_ITEM_H__ 21 7 #define __XFS_RMAP_ITEM_H__
+8 -16
fs/xfs/xfs_rtalloc.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include "xfs.h" 19 7 #include "xfs_fs.h" ··· 301 313 /* 302 314 * If size should be a multiple of prod, make that so. 303 315 */ 304 - if (prod > 1 && (p = do_mod(bestlen, prod))) 305 - bestlen -= p; 316 + if (prod > 1) { 317 + div_u64_rem(bestlen, prod, &p); 318 + if (p) 319 + bestlen -= p; 320 + } 321 + 306 322 /* 307 323 * Allocate besti for bestlen & return that. 308 324 */ ··· 1267 1275 b = (mp->m_sb.sb_rextents * ((resid << 1) + 1ULL)) >> 1268 1276 (log2 + 1); 1269 1277 if (b >= mp->m_sb.sb_rextents) 1270 - b = do_mod(b, mp->m_sb.sb_rextents); 1278 + div64_u64_rem(b, mp->m_sb.sb_rextents, &b); 1271 1279 if (b + len > mp->m_sb.sb_rextents) 1272 1280 b = mp->m_sb.sb_rextents - len; 1273 1281 }
+1 -13
fs/xfs/xfs_rtalloc.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_RTALLOC_H__ 19 7 #define __XFS_RTALLOC_H__
+1 -13
fs/xfs/xfs_stats.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include "xfs.h" 19 7 #include <linux/proc_fs.h>
+1 -13
fs/xfs/xfs_stats.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000,2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_STATS_H__ 19 7 #define __XFS_STATS_H__
+2 -14
fs/xfs/xfs_super.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2006 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 19 7 #include "xfs.h" ··· 1136 1148 statp->f_bavail = statp->f_bfree; 1137 1149 1138 1150 fakeinos = statp->f_bfree << sbp->sb_inopblog; 1139 - statp->f_files = MIN(icount + fakeinos, (uint64_t)XFS_MAXINUMBER); 1151 + statp->f_files = min(icount + fakeinos, (uint64_t)XFS_MAXINUMBER); 1140 1152 if (mp->m_maxicount) 1141 1153 statp->f_files = min_t(typeof(statp->f_files), 1142 1154 statp->f_files,
+1 -13
fs/xfs/xfs_super.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_SUPER_H__ 19 7 #define __XFS_SUPER_H__
+1 -13
fs/xfs/xfs_symlink.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2006 Silicon Graphics, Inc. 3 4 * Copyright (c) 2012-2013 Red Hat, Inc. 4 5 * All rights reserved. 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 as 8 - * published by the Free Software Foundation. 9 - * 10 - * This program is distributed in the hope that it would 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 - * 15 - * You should have received a copy of the GNU General Public License 16 - * along with this program; if not, write the Free Software Foundation, 17 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 6 */ 19 7 #include "xfs.h" 20 8 #include "xfs_shared.h"
+1 -13
fs/xfs/xfs_symlink.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2012 Red Hat, Inc. All rights reserved. 3 - * 4 - * This program is free software; you can redistribute it and/or 5 - * modify it under the terms of the GNU General Public License as 6 - * published by the Free Software Foundation. 7 - * 8 - * This program is distributed in the hope that it would be useful, 9 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 - * GNU General Public License for more details. 12 - * 13 - * You should have received a copy of the GNU General Public License 14 - * along with this program; if not, write the Free Software Foundation, 15 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 16 4 */ 17 5 #ifndef __XFS_SYMLINK_H 18 6 #define __XFS_SYMLINK_H 1
+1 -13
fs/xfs/xfs_sysctl.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2001-2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include "xfs.h" 19 7 #include <linux/sysctl.h>
+1 -13
fs/xfs/xfs_sysctl.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2001-2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_SYSCTL_H__ 19 7 #define __XFS_SYSCTL_H__
+1 -13
fs/xfs/xfs_sysfs.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2014 Red Hat, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 19 7 #include "xfs.h"
+1 -13
fs/xfs/xfs_sysfs.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2014 Red Hat, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 19 7 #ifndef __XFS_SYSFS_H__
+1 -13
fs/xfs/xfs_trace.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2009, Christoph Hellwig 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include "xfs.h" 19 7 #include "xfs_fs.h"
+1 -13
fs/xfs/xfs_trace.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2009, Christoph Hellwig 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #undef TRACE_SYSTEM 19 7 #define TRACE_SYSTEM xfs
+1 -13
fs/xfs/xfs_trans.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc. 3 4 * Copyright (C) 2010 Red Hat, Inc. 4 5 * All Rights Reserved. 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 as 8 - * published by the Free Software Foundation. 9 - * 10 - * This program is distributed in the hope that it would 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 - * 15 - * You should have received a copy of the GNU General Public License 16 - * along with this program; if not, write the Free Software Foundation, 17 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 6 */ 19 7 #include "xfs.h" 20 8 #include "xfs_fs.h"
+1 -13
fs/xfs/xfs_trans.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2002,2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_TRANS_H__ 19 7 #define __XFS_TRANS_H__
+1 -13
fs/xfs/xfs_trans_ail.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2002,2005 Silicon Graphics, Inc. 3 4 * Copyright (c) 2008 Dave Chinner 4 5 * All Rights Reserved. 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 as 8 - * published by the Free Software Foundation. 9 - * 10 - * This program is distributed in the hope that it would 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 - * 15 - * You should have received a copy of the GNU General Public License 16 - * along with this program; if not, write the Free Software Foundation, 17 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 6 */ 19 7 #include "xfs.h" 20 8 #include "xfs_fs.h"
+1 -15
fs/xfs/xfs_trans_bmap.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2016 Oracle. All Rights Reserved. 3 - * 4 4 * 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 5 */ 20 6 #include "xfs.h" 21 7 #include "xfs_fs.h"
+1 -13
fs/xfs/xfs_trans_buf.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2002,2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include "xfs.h" 19 7 #include "xfs_fs.h"
+1 -13
fs/xfs/xfs_trans_dquot.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000-2002 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include "xfs.h" 19 7 #include "xfs_fs.h"
+1 -13
fs/xfs/xfs_trans_extfree.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000,2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include "xfs.h" 19 7 #include "xfs_fs.h"
+1 -13
fs/xfs/xfs_trans_inode.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000,2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #include "xfs.h" 19 7 #include "xfs_fs.h"
+1 -13
fs/xfs/xfs_trans_priv.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2000,2002,2005 Silicon Graphics, Inc. 3 4 * All Rights Reserved. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 #ifndef __XFS_TRANS_PRIV_H__ 19 7 #define __XFS_TRANS_PRIV_H__
+1 -15
fs/xfs/xfs_trans_refcount.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2016 Oracle. All Rights Reserved. 3 - * 4 4 * 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 5 */ 20 6 #include "xfs.h" 21 7 #include "xfs_fs.h"
+1 -15
fs/xfs/xfs_trans_rmap.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2016 Oracle. All Rights Reserved. 3 - * 4 4 * 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 5 */ 20 6 #include "xfs.h" 21 7 #include "xfs_fs.h"
+1 -13
fs/xfs/xfs_xattr.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (C) 2008 Christoph Hellwig. 3 4 * Portions Copyright (C) 2000-2008 Silicon Graphics, Inc. 4 - * 5 - * This program is free software; you can redistribute it and/or 6 - * modify it under the terms of the GNU General Public License as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it would 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 the Free Software Foundation, 16 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 5 */ 18 6 19 7 #include "xfs.h"