Loading fs/xfs/Makefile +1 −0 Original line number Diff line number Diff line Loading @@ -149,6 +149,7 @@ xfs-y += $(addprefix scrub/, \ btree.o \ common.o \ dabtree.o \ dir.o \ ialloc.o \ inode.o \ refcount.o \ Loading fs/xfs/libxfs/xfs_dir2.c +3 −1 Original line number Diff line number Diff line Loading @@ -39,7 +39,9 @@ struct xfs_name xfs_name_dotdot = { (unsigned char *)"..", 2, XFS_DIR3_FT_DIR }; /* * Convert inode mode to directory entry filetype */ unsigned char xfs_mode_to_ftype(int mode) unsigned char xfs_mode_to_ftype( int mode) { switch (mode & S_IFMT) { case S_IFREG: Loading fs/xfs/libxfs/xfs_dir2.h +17 −0 Original line number Diff line number Diff line Loading @@ -324,4 +324,21 @@ xfs_dir2_leaf_tail_p(struct xfs_da_geometry *geo, struct xfs_dir2_leaf *lp) sizeof(struct xfs_dir2_leaf_tail)); } /* * The Linux API doesn't pass down the total size of the buffer * we read into down to the filesystem. With the filldir concept * it's not needed for correct information, but the XFS dir2 leaf * code wants an estimate of the buffer size to calculate it's * readahead window and size the buffers used for mapping to * physical blocks. * * Try to give it an estimate that's good enough, maybe at some * point we can change the ->readdir prototype to include the * buffer size. For now we use the current glibc buffer size. * musl libc hardcodes 2k and dietlibc uses PAGE_SIZE. */ #define XFS_READDIR_BUFSIZE (32768) unsigned char xfs_dir3_get_dtype(struct xfs_mount *mp, uint8_t filetype); #endif /* __XFS_DIR2_H__ */ fs/xfs/libxfs/xfs_fs.h +2 −1 Original line number Diff line number Diff line Loading @@ -498,9 +498,10 @@ struct xfs_scrub_metadata { #define XFS_SCRUB_TYPE_BMBTD 12 /* data fork block mapping */ #define XFS_SCRUB_TYPE_BMBTA 13 /* attr fork block mapping */ #define XFS_SCRUB_TYPE_BMBTC 14 /* CoW fork block mapping */ #define XFS_SCRUB_TYPE_DIR 15 /* directory */ /* Number of scrub subcommands. */ #define XFS_SCRUB_TYPE_NR 15 #define XFS_SCRUB_TYPE_NR 16 /* i: Repair this metadata. */ #define XFS_SCRUB_IFLAG_REPAIR (1 << 0) Loading fs/xfs/scrub/common.c +28 −0 Original line number Diff line number Diff line Loading @@ -542,3 +542,31 @@ xfs_scrub_get_inode( sc->ip = ip; return 0; } /* Set us up to scrub a file's contents. */ int xfs_scrub_setup_inode_contents( struct xfs_scrub_context *sc, struct xfs_inode *ip, unsigned int resblks) { struct xfs_mount *mp = sc->mp; int error; error = xfs_scrub_get_inode(sc, ip); if (error) return error; /* Got the inode, lock it and we're ready to go. */ sc->ilock_flags = XFS_IOLOCK_EXCL | XFS_MMAPLOCK_EXCL; xfs_ilock(sc->ip, sc->ilock_flags); error = xfs_scrub_trans_alloc(sc->sm, mp, &sc->tp); if (error) goto out; sc->ilock_flags |= XFS_ILOCK_EXCL; xfs_ilock(sc->ip, XFS_ILOCK_EXCL); out: /* scrub teardown will unlock and release the inode for us */ return error; } Loading
fs/xfs/Makefile +1 −0 Original line number Diff line number Diff line Loading @@ -149,6 +149,7 @@ xfs-y += $(addprefix scrub/, \ btree.o \ common.o \ dabtree.o \ dir.o \ ialloc.o \ inode.o \ refcount.o \ Loading
fs/xfs/libxfs/xfs_dir2.c +3 −1 Original line number Diff line number Diff line Loading @@ -39,7 +39,9 @@ struct xfs_name xfs_name_dotdot = { (unsigned char *)"..", 2, XFS_DIR3_FT_DIR }; /* * Convert inode mode to directory entry filetype */ unsigned char xfs_mode_to_ftype(int mode) unsigned char xfs_mode_to_ftype( int mode) { switch (mode & S_IFMT) { case S_IFREG: Loading
fs/xfs/libxfs/xfs_dir2.h +17 −0 Original line number Diff line number Diff line Loading @@ -324,4 +324,21 @@ xfs_dir2_leaf_tail_p(struct xfs_da_geometry *geo, struct xfs_dir2_leaf *lp) sizeof(struct xfs_dir2_leaf_tail)); } /* * The Linux API doesn't pass down the total size of the buffer * we read into down to the filesystem. With the filldir concept * it's not needed for correct information, but the XFS dir2 leaf * code wants an estimate of the buffer size to calculate it's * readahead window and size the buffers used for mapping to * physical blocks. * * Try to give it an estimate that's good enough, maybe at some * point we can change the ->readdir prototype to include the * buffer size. For now we use the current glibc buffer size. * musl libc hardcodes 2k and dietlibc uses PAGE_SIZE. */ #define XFS_READDIR_BUFSIZE (32768) unsigned char xfs_dir3_get_dtype(struct xfs_mount *mp, uint8_t filetype); #endif /* __XFS_DIR2_H__ */
fs/xfs/libxfs/xfs_fs.h +2 −1 Original line number Diff line number Diff line Loading @@ -498,9 +498,10 @@ struct xfs_scrub_metadata { #define XFS_SCRUB_TYPE_BMBTD 12 /* data fork block mapping */ #define XFS_SCRUB_TYPE_BMBTA 13 /* attr fork block mapping */ #define XFS_SCRUB_TYPE_BMBTC 14 /* CoW fork block mapping */ #define XFS_SCRUB_TYPE_DIR 15 /* directory */ /* Number of scrub subcommands. */ #define XFS_SCRUB_TYPE_NR 15 #define XFS_SCRUB_TYPE_NR 16 /* i: Repair this metadata. */ #define XFS_SCRUB_IFLAG_REPAIR (1 << 0) Loading
fs/xfs/scrub/common.c +28 −0 Original line number Diff line number Diff line Loading @@ -542,3 +542,31 @@ xfs_scrub_get_inode( sc->ip = ip; return 0; } /* Set us up to scrub a file's contents. */ int xfs_scrub_setup_inode_contents( struct xfs_scrub_context *sc, struct xfs_inode *ip, unsigned int resblks) { struct xfs_mount *mp = sc->mp; int error; error = xfs_scrub_get_inode(sc, ip); if (error) return error; /* Got the inode, lock it and we're ready to go. */ sc->ilock_flags = XFS_IOLOCK_EXCL | XFS_MMAPLOCK_EXCL; xfs_ilock(sc->ip, sc->ilock_flags); error = xfs_scrub_trans_alloc(sc->sm, mp, &sc->tp); if (error) goto out; sc->ilock_flags |= XFS_ILOCK_EXCL; xfs_ilock(sc->ip, XFS_ILOCK_EXCL); out: /* scrub teardown will unlock and release the inode for us */ return error; }