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

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'xfs-5.13-fixes-1' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux

Pull xfs fixes from Darrick Wong:

- Fix some math errors in the realtime allocator when extent size hints
are applied.

- Fix unnecessary short writes to realtime files when free space is
fragmented.

- Fix a crash when using scrub tracepoints.

- Restore ioctl uapi definitions that were accidentally removed in
5.13-rc1.

* tag 'xfs-5.13-fixes-1' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux:
xfs: restore old ioctl definitions
xfs: fix deadlock retry tracepoint arguments
xfs: retry allocations when locality-based search fails
xfs: adjust rt allocation minlen when extszhint > rtextsize

+77 -27
+4
fs/xfs/libxfs/xfs_fs.h
··· 770 770 /* 771 771 * ioctl commands that are used by Linux filesystems 772 772 */ 773 + #define XFS_IOC_GETXFLAGS FS_IOC_GETFLAGS 774 + #define XFS_IOC_SETXFLAGS FS_IOC_SETFLAGS 773 775 #define XFS_IOC_GETVERSION FS_IOC_GETVERSION 774 776 775 777 /* ··· 782 780 #define XFS_IOC_ALLOCSP _IOW ('X', 10, struct xfs_flock64) 783 781 #define XFS_IOC_FREESP _IOW ('X', 11, struct xfs_flock64) 784 782 #define XFS_IOC_DIOINFO _IOR ('X', 30, struct dioattr) 783 + #define XFS_IOC_FSGETXATTR FS_IOC_FSGETXATTR 784 + #define XFS_IOC_FSSETXATTR FS_IOC_FSSETXATTR 785 785 #define XFS_IOC_ALLOCSP64 _IOW ('X', 36, struct xfs_flock64) 786 786 #define XFS_IOC_FREESP64 _IOW ('X', 37, struct xfs_flock64) 787 787 #define XFS_IOC_GETBMAP _IOWR('X', 38, struct getbmap)
+3 -1
fs/xfs/scrub/common.c
··· 74 74 return true; 75 75 case -EDEADLOCK: 76 76 /* Used to restart an op with deadlock avoidance. */ 77 - trace_xchk_deadlock_retry(sc->ip, sc->sm, *error); 77 + trace_xchk_deadlock_retry( 78 + sc->ip ? sc->ip : XFS_I(file_inode(sc->file)), 79 + sc->sm, *error); 78 80 break; 79 81 case -EFSBADCRC: 80 82 case -EFSCORRUPTED:
+70 -26
fs/xfs/xfs_bmap_util.c
··· 71 71 #ifdef CONFIG_XFS_RT 72 72 int 73 73 xfs_bmap_rtalloc( 74 - struct xfs_bmalloca *ap) /* bmap alloc argument struct */ 74 + struct xfs_bmalloca *ap) 75 75 { 76 - int error; /* error return value */ 77 - xfs_mount_t *mp; /* mount point structure */ 78 - xfs_extlen_t prod = 0; /* product factor for allocators */ 79 - xfs_extlen_t mod = 0; /* product factor for allocators */ 80 - xfs_extlen_t ralen = 0; /* realtime allocation length */ 81 - xfs_extlen_t align; /* minimum allocation alignment */ 82 - xfs_rtblock_t rtb; 76 + struct xfs_mount *mp = ap->ip->i_mount; 77 + xfs_fileoff_t orig_offset = ap->offset; 78 + xfs_rtblock_t rtb; 79 + xfs_extlen_t prod = 0; /* product factor for allocators */ 80 + xfs_extlen_t mod = 0; /* product factor for allocators */ 81 + xfs_extlen_t ralen = 0; /* realtime allocation length */ 82 + xfs_extlen_t align; /* minimum allocation alignment */ 83 + xfs_extlen_t orig_length = ap->length; 84 + xfs_extlen_t minlen = mp->m_sb.sb_rextsize; 85 + xfs_extlen_t raminlen; 86 + bool rtlocked = false; 87 + bool ignore_locality = false; 88 + int error; 83 89 84 - mp = ap->ip->i_mount; 85 90 align = xfs_get_extsz_hint(ap->ip); 91 + retry: 86 92 prod = align / mp->m_sb.sb_rextsize; 87 93 error = xfs_bmap_extsize_align(mp, &ap->got, &ap->prev, 88 94 align, 1, ap->eof, 0, ··· 97 91 return error; 98 92 ASSERT(ap->length); 99 93 ASSERT(ap->length % mp->m_sb.sb_rextsize == 0); 94 + 95 + /* 96 + * If we shifted the file offset downward to satisfy an extent size 97 + * hint, increase minlen by that amount so that the allocator won't 98 + * give us an allocation that's too short to cover at least one of the 99 + * blocks that the caller asked for. 100 + */ 101 + if (ap->offset != orig_offset) 102 + minlen += orig_offset - ap->offset; 100 103 101 104 /* 102 105 * If the offset & length are not perfectly aligned ··· 131 116 /* 132 117 * Lock out modifications to both the RT bitmap and summary inodes 133 118 */ 134 - xfs_ilock(mp->m_rbmip, XFS_ILOCK_EXCL|XFS_ILOCK_RTBITMAP); 135 - xfs_trans_ijoin(ap->tp, mp->m_rbmip, XFS_ILOCK_EXCL); 136 - xfs_ilock(mp->m_rsumip, XFS_ILOCK_EXCL|XFS_ILOCK_RTSUM); 137 - xfs_trans_ijoin(ap->tp, mp->m_rsumip, XFS_ILOCK_EXCL); 119 + if (!rtlocked) { 120 + xfs_ilock(mp->m_rbmip, XFS_ILOCK_EXCL|XFS_ILOCK_RTBITMAP); 121 + xfs_trans_ijoin(ap->tp, mp->m_rbmip, XFS_ILOCK_EXCL); 122 + xfs_ilock(mp->m_rsumip, XFS_ILOCK_EXCL|XFS_ILOCK_RTSUM); 123 + xfs_trans_ijoin(ap->tp, mp->m_rsumip, XFS_ILOCK_EXCL); 124 + rtlocked = true; 125 + } 138 126 139 127 /* 140 128 * If it's an allocation to an empty file at offset 0, ··· 159 141 /* 160 142 * Realtime allocation, done through xfs_rtallocate_extent. 161 143 */ 162 - do_div(ap->blkno, mp->m_sb.sb_rextsize); 144 + if (ignore_locality) 145 + ap->blkno = 0; 146 + else 147 + do_div(ap->blkno, mp->m_sb.sb_rextsize); 163 148 rtb = ap->blkno; 164 149 ap->length = ralen; 165 - error = xfs_rtallocate_extent(ap->tp, ap->blkno, 1, ap->length, 166 - &ralen, ap->wasdel, prod, &rtb); 150 + raminlen = max_t(xfs_extlen_t, 1, minlen / mp->m_sb.sb_rextsize); 151 + error = xfs_rtallocate_extent(ap->tp, ap->blkno, raminlen, ap->length, 152 + &ralen, ap->wasdel, prod, &rtb); 167 153 if (error) 168 154 return error; 169 155 170 - ap->blkno = rtb; 171 - if (ap->blkno != NULLFSBLOCK) { 172 - ap->blkno *= mp->m_sb.sb_rextsize; 173 - ralen *= mp->m_sb.sb_rextsize; 174 - ap->length = ralen; 175 - ap->ip->i_nblocks += ralen; 156 + if (rtb != NULLRTBLOCK) { 157 + ap->blkno = rtb * mp->m_sb.sb_rextsize; 158 + ap->length = ralen * mp->m_sb.sb_rextsize; 159 + ap->ip->i_nblocks += ap->length; 176 160 xfs_trans_log_inode(ap->tp, ap->ip, XFS_ILOG_CORE); 177 161 if (ap->wasdel) 178 - ap->ip->i_delayed_blks -= ralen; 162 + ap->ip->i_delayed_blks -= ap->length; 179 163 /* 180 164 * Adjust the disk quota also. This was reserved 181 165 * earlier. 182 166 */ 183 167 xfs_trans_mod_dquot_byino(ap->tp, ap->ip, 184 168 ap->wasdel ? XFS_TRANS_DQ_DELRTBCOUNT : 185 - XFS_TRANS_DQ_RTBCOUNT, (long) ralen); 186 - } else { 187 - ap->length = 0; 169 + XFS_TRANS_DQ_RTBCOUNT, ap->length); 170 + return 0; 188 171 } 172 + 173 + if (align > mp->m_sb.sb_rextsize) { 174 + /* 175 + * We previously enlarged the request length to try to satisfy 176 + * an extent size hint. The allocator didn't return anything, 177 + * so reset the parameters to the original values and try again 178 + * without alignment criteria. 179 + */ 180 + ap->offset = orig_offset; 181 + ap->length = orig_length; 182 + minlen = align = mp->m_sb.sb_rextsize; 183 + goto retry; 184 + } 185 + 186 + if (!ignore_locality && ap->blkno != 0) { 187 + /* 188 + * If we can't allocate near a specific rt extent, try again 189 + * without locality criteria. 190 + */ 191 + ignore_locality = true; 192 + goto retry; 193 + } 194 + 195 + ap->blkno = NULLFSBLOCK; 196 + ap->length = 0; 189 197 return 0; 190 198 } 191 199 #endif /* CONFIG_XFS_RT */