]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
Merge branch 'iomap-4.10-directio' into for-next
authorDave Chinner <david@fromorbit.com>
Wed, 30 Nov 2016 03:39:29 +0000 (14:39 +1100)
committerDave Chinner <david@fromorbit.com>
Wed, 30 Nov 2016 03:39:29 +0000 (14:39 +1100)
14 files changed:
fs/xfs/libxfs/xfs_attr_leaf.h
fs/xfs/libxfs/xfs_bmap.c
fs/xfs/libxfs/xfs_dir2.h
fs/xfs/libxfs/xfs_dir2_data.c
fs/xfs/libxfs/xfs_dir2_priv.h
fs/xfs/libxfs/xfs_ialloc.c
fs/xfs/libxfs/xfs_inode_buf.c
fs/xfs/libxfs/xfs_inode_buf.h
fs/xfs/libxfs/xfs_log_format.h
fs/xfs/libxfs/xfs_log_recover.h
fs/xfs/libxfs/xfs_rtbitmap.c
fs/xfs/libxfs/xfs_sb.c
fs/xfs/libxfs/xfs_types.h
fs/xfs/xfs_log_recover.c

index 4f2aed04f8273b5924f34180211dbb9b11e14aa4..8ef420a16f0819ea4e97a3ce9f58767cb5b75513 100644 (file)
@@ -51,7 +51,7 @@ int   xfs_attr_shortform_getvalue(struct xfs_da_args *args);
 int    xfs_attr_shortform_to_leaf(struct xfs_da_args *args);
 int    xfs_attr_shortform_remove(struct xfs_da_args *args);
 int    xfs_attr_shortform_allfit(struct xfs_buf *bp, struct xfs_inode *dp);
-int    xfs_attr_shortform_bytesfit(xfs_inode_t *dp, int bytes);
+int    xfs_attr_shortform_bytesfit(struct xfs_inode *dp, int bytes);
 void   xfs_attr_fork_remove(struct xfs_inode *ip, struct xfs_trans *tp);
 
 /*
index 6b7e6eb294145392c0d84b98ffe65a3da4d78ba6..6f2881430c84a3a5333c107d1b6f4d10ea330587 100644 (file)
@@ -4844,8 +4844,11 @@ xfs_bmap_del_extent_delay(
         * sb counters as we might have to borrow some blocks for the
         * indirect block accounting.
         */
-       xfs_trans_reserve_quota_nblks(NULL, ip, -((long)del->br_blockcount), 0,
+       error = xfs_trans_reserve_quota_nblks(NULL, ip,
+                       -((long)del->br_blockcount), 0,
                        isrt ? XFS_QMOPT_RES_RTBLKS : XFS_QMOPT_RES_REGBLKS);
+       if (error)
+               return error;
        ip->i_delayed_blks -= del->br_blockcount;
 
        if (whichfork == XFS_COW_FORK)
index becc926c3e3d900db0a021dd091e46e828fa6f09..0197590fa7d7c0a3d97d68dccdcfb3bd0709964b 100644 (file)
@@ -157,6 +157,9 @@ extern int xfs_dir2_isleaf(struct xfs_da_args *args, int *r);
 extern int xfs_dir2_shrink_inode(struct xfs_da_args *args, xfs_dir2_db_t db,
                                struct xfs_buf *bp);
 
+extern void xfs_dir2_data_freescan_int(struct xfs_da_geometry *geo,
+               const struct xfs_dir_ops *ops,
+               struct xfs_dir2_data_hdr *hdr, int *loghead);
 extern void xfs_dir2_data_freescan(struct xfs_inode *dp,
                struct xfs_dir2_data_hdr *hdr, int *loghead);
 extern void xfs_dir2_data_log_entry(struct xfs_da_args *args,
@@ -177,6 +180,8 @@ extern struct xfs_dir2_data_free *xfs_dir2_data_freefind(
                struct xfs_dir2_data_hdr *hdr, struct xfs_dir2_data_free *bf,
                struct xfs_dir2_data_unused *dup);
 
+extern int xfs_dir_ino_validate(struct xfs_mount *mp, xfs_ino_t ino);
+
 extern const struct xfs_buf_ops xfs_dir3_block_buf_ops;
 extern const struct xfs_buf_ops xfs_dir3_leafn_buf_ops;
 extern const struct xfs_buf_ops xfs_dir3_leaf1_buf_ops;
index 725fc7841fdeb38fdfdba08f1621a83f764baeea..cd75ab9f3bf85c65e456e29fe08a1f24ffbea1bc 100644 (file)
@@ -505,8 +505,9 @@ xfs_dir2_data_freeremove(
  * Given a data block, reconstruct its bestfree map.
  */
 void
-xfs_dir2_data_freescan(
-       struct xfs_inode        *dp,
+xfs_dir2_data_freescan_int(
+       struct xfs_da_geometry  *geo,
+       const struct xfs_dir_ops *ops,
        struct xfs_dir2_data_hdr *hdr,
        int                     *loghead)
 {
@@ -516,7 +517,6 @@ xfs_dir2_data_freescan(
        struct xfs_dir2_data_free *bf;
        char                    *endp;          /* end of block's data */
        char                    *p;             /* current entry pointer */
-       struct xfs_da_geometry  *geo = dp->i_mount->m_dir_geo;
 
        ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) ||
               hdr->magic == cpu_to_be32(XFS_DIR3_DATA_MAGIC) ||
@@ -526,13 +526,13 @@ xfs_dir2_data_freescan(
        /*
         * Start by clearing the table.
         */
-       bf = dp->d_ops->data_bestfree_p(hdr);
+       bf = ops->data_bestfree_p(hdr);
        memset(bf, 0, sizeof(*bf) * XFS_DIR2_DATA_FD_COUNT);
        *loghead = 1;
        /*
         * Set up pointers.
         */
-       p = (char *)dp->d_ops->data_entry_p(hdr);
+       p = (char *)ops->data_entry_p(hdr);
        if (hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC) ||
            hdr->magic == cpu_to_be32(XFS_DIR3_BLOCK_MAGIC)) {
                btp = xfs_dir2_block_tail_p(geo, hdr);
@@ -559,12 +559,22 @@ xfs_dir2_data_freescan(
                else {
                        dep = (xfs_dir2_data_entry_t *)p;
                        ASSERT((char *)dep - (char *)hdr ==
-                              be16_to_cpu(*dp->d_ops->data_entry_tag_p(dep)));
-                       p += dp->d_ops->data_entsize(dep->namelen);
+                              be16_to_cpu(*ops->data_entry_tag_p(dep)));
+                       p += ops->data_entsize(dep->namelen);
                }
        }
 }
 
+void
+xfs_dir2_data_freescan(
+       struct xfs_inode        *dp,
+       struct xfs_dir2_data_hdr *hdr,
+       int                     *loghead)
+{
+       return xfs_dir2_data_freescan_int(dp->i_mount->m_dir_geo, dp->d_ops,
+                       hdr, loghead);
+}
+
 /*
  * Initialize a data block at the given block number in the directory.
  * Give back the buffer for the created block.
index ef9f6ead96a469f33dca80241fd2903f91a692d4..d04547fcf274af0eaee18096c94b22652551b9f7 100644 (file)
@@ -21,7 +21,6 @@
 struct dir_context;
 
 /* xfs_dir2.c */
-extern int xfs_dir_ino_validate(struct xfs_mount *mp, xfs_ino_t ino);
 extern int xfs_dir2_grow_inode(struct xfs_da_args *args, int space,
                                xfs_dir2_db_t *dbp);
 extern int xfs_dir_cilookup_result(struct xfs_da_args *args,
index 51b4e0de1fdc424e13f039adf98ae2789a27ba74..c507c1b17ca1866fcef37401aeeeb6a1c740ba6a 100644 (file)
@@ -2344,7 +2344,8 @@ xfs_imap(
 
                imap->im_blkno = XFS_AGB_TO_DADDR(mp, agno, agbno);
                imap->im_len = XFS_FSB_TO_BB(mp, 1);
-               imap->im_boffset = (ushort)(offset << mp->m_sb.sb_inodelog);
+               imap->im_boffset = (unsigned short)(offset <<
+                                                       mp->m_sb.sb_inodelog);
                return 0;
        }
 
@@ -2372,7 +2373,7 @@ out_map:
 
        imap->im_blkno = XFS_AGB_TO_DADDR(mp, agno, cluster_agbno);
        imap->im_len = XFS_FSB_TO_BB(mp, blks_per_cluster);
-       imap->im_boffset = (ushort)(offset << mp->m_sb.sb_inodelog);
+       imap->im_boffset = (unsigned short)(offset << mp->m_sb.sb_inodelog);
 
        /*
         * If the inode number maps to a block outside the bounds
index 134424fac434fdd7fdd3cecf12d3007712b9734b..54817f82212cfe34784313ac4928f4ffe6589d90 100644 (file)
@@ -383,7 +383,7 @@ xfs_log_dinode_to_disk(
 static bool
 xfs_dinode_verify(
        struct xfs_mount        *mp,
-       struct xfs_inode        *ip,
+       xfs_ino_t               ino,
        struct xfs_dinode       *dip)
 {
        uint16_t                flags;
@@ -401,7 +401,7 @@ xfs_dinode_verify(
        if (!xfs_verify_cksum((char *)dip, mp->m_sb.sb_inodesize,
                              XFS_DINODE_CRC_OFF))
                return false;
-       if (be64_to_cpu(dip->di_ino) != ip->i_ino)
+       if (be64_to_cpu(dip->di_ino) != ino)
                return false;
        if (!uuid_equal(&dip->di_uuid, &mp->m_sb.sb_meta_uuid))
                return false;
@@ -493,7 +493,7 @@ xfs_iread(
                return error;
 
        /* even unallocated inodes are verified */
-       if (!xfs_dinode_verify(mp, ip, dip)) {
+       if (!xfs_dinode_verify(mp, ip->i_ino, dip)) {
                xfs_alert(mp, "%s: validation failed for inode %lld failed",
                                __func__, ip->i_ino);
 
index 3cfe12a4f58ac8560e1cd92e529a85477ff5ee02..6848a0afbce7a4db3b03938858ca0e591cbf40ef 100644 (file)
@@ -58,8 +58,8 @@ struct xfs_icdinode {
  */
 struct xfs_imap {
        xfs_daddr_t     im_blkno;       /* starting BB of inode chunk */
-       ushort          im_len;         /* length in BBs of inode chunk */
-       ushort          im_boffset;     /* inode offset in block in bytes */
+       unsigned short  im_len;         /* length in BBs of inode chunk */
+       unsigned short  im_boffset;     /* inode offset in block in bytes */
 };
 
 int    xfs_imap_to_bp(struct xfs_mount *, struct xfs_trans *,
index 083cdd6d6c28cecdf9af7d45df56cdc6d9a13665..7ae571f8e34ac738b9c1ed1d628e5bc17b0e7079 100644 (file)
@@ -481,8 +481,8 @@ static inline uint xfs_log_dinode_size(int version)
 typedef struct xfs_buf_log_format {
        unsigned short  blf_type;       /* buf log item type indicator */
        unsigned short  blf_size;       /* size of this item */
-       ushort          blf_flags;      /* misc state */
-       ushort          blf_len;        /* number of blocks in this buf */
+       unsigned short  blf_flags;      /* misc state */
+       unsigned short  blf_len;        /* number of blocks in this buf */
        __int64_t       blf_blkno;      /* starting blkno of this buf */
        unsigned int    blf_map_size;   /* used size of data bitmap in words */
        unsigned int    blf_data_map[XFS_BLF_DATAMAP_SIZE]; /* dirty bitmap */
index 8e385f91d660233deceb8c484f8a9a60eb94d887..d9f65e2d5cc818260c72cc43fe5687f296cea73b 100644 (file)
@@ -52,7 +52,7 @@ typedef struct xlog_recover {
        struct list_head        r_itemq;        /* q for items */
 } xlog_recover_t;
 
-#define ITEM_TYPE(i)   (*(ushort *)(i)->ri_buf[0].i_addr)
+#define ITEM_TYPE(i)   (*(unsigned short *)(i)->ri_buf[0].i_addr)
 
 /*
  * This is the number of entries in the l_buf_cancel_table used during
index e2e1106c9fadc91d41ab235904409b5428d7a83c..ea45584a9913bbd51908c9a477bb25c90d000fa9 100644 (file)
@@ -1016,4 +1016,3 @@ xfs_rtfree_extent(
        }
        return 0;
 }
-
index a70aec9106263f3e45e454e6fa3ef5ebcdac26ea..2580262e4ea00c3dc728b041dca125f4f7078373 100644 (file)
@@ -262,6 +262,12 @@ xfs_mount_validate_sb(
                return -EFSCORRUPTED;
        }
 
+       if (xfs_sb_version_hascrc(&mp->m_sb) &&
+           sbp->sb_blocksize < XFS_MIN_CRC_BLOCKSIZE) {
+               xfs_notice(mp, "v5 SB sanity check failed");
+               return -EFSCORRUPTED;
+       }
+
        /*
         * Until this is fixed only page-sized or smaller data blocks work.
         */
@@ -338,13 +344,16 @@ xfs_sb_quota_from_disk(struct xfs_sb *sbp)
                                        XFS_PQUOTA_CHKD : XFS_GQUOTA_CHKD;
        sbp->sb_qflags &= ~(XFS_OQUOTA_ENFD | XFS_OQUOTA_CHKD);
 
-       if (sbp->sb_qflags & XFS_PQUOTA_ACCT)  {
+       if (sbp->sb_qflags & XFS_PQUOTA_ACCT &&
+           sbp->sb_gquotino != NULLFSINO)  {
                /*
                 * In older version of superblock, on-disk superblock only
                 * has sb_gquotino, and in-core superblock has both sb_gquotino
                 * and sb_pquotino. But, only one of them is supported at any
                 * point of time. So, if PQUOTA is set in disk superblock,
-                * copy over sb_gquotino to sb_pquotino.
+                * copy over sb_gquotino to sb_pquotino.  The NULLFSINO test
+                * above is to make sure we don't do this twice and wipe them
+                * both out!
                 */
                sbp->sb_pquotino = sbp->sb_gquotino;
                sbp->sb_gquotino = NULLFSINO;
index f9a1076de911e49572d1153c42ff1072a1b2a184..717909f2f7b704be9c842a94155a2c88c5054a76 100644 (file)
@@ -74,11 +74,14 @@ typedef __int64_t   xfs_sfiloff_t;  /* signed block number in a file */
  * Minimum and maximum blocksize and sectorsize.
  * The blocksize upper limit is pretty much arbitrary.
  * The sectorsize upper limit is due to sizeof(sb_sectsize).
+ * CRC enable filesystems use 512 byte inodes, meaning 512 byte block sizes
+ * cannot be used.
  */
 #define XFS_MIN_BLOCKSIZE_LOG  9       /* i.e. 512 bytes */
 #define XFS_MAX_BLOCKSIZE_LOG  16      /* i.e. 65536 bytes */
 #define XFS_MIN_BLOCKSIZE      (1 << XFS_MIN_BLOCKSIZE_LOG)
 #define XFS_MAX_BLOCKSIZE      (1 << XFS_MAX_BLOCKSIZE_LOG)
+#define XFS_MIN_CRC_BLOCKSIZE  (1 << (XFS_MIN_BLOCKSIZE_LOG + 1))
 #define XFS_MIN_SECTORSIZE_LOG 9       /* i.e. 512 bytes */
 #define XFS_MAX_SECTORSIZE_LOG 15      /* i.e. 32768 bytes */
 #define XFS_MIN_SECTORSIZE     (1 << XFS_MIN_SECTORSIZE_LOG)
index 9b3d7c76915d9c92948bed063d79bd10a6107a77..cf754bcbcb1caa8bcb72b44b15e94eca3bcffbc2 100644 (file)
@@ -2025,7 +2025,7 @@ xlog_peek_buffer_cancelled(
        struct xlog             *log,
        xfs_daddr_t             blkno,
        uint                    len,
-       ushort                  flags)
+       unsigned short                  flags)
 {
        struct list_head        *bucket;
        struct xfs_buf_cancel   *bcp;
@@ -2065,7 +2065,7 @@ xlog_check_buffer_cancelled(
        struct xlog             *log,
        xfs_daddr_t             blkno,
        uint                    len,
-       ushort                  flags)
+       unsigned short                  flags)
 {
        struct xfs_buf_cancel   *bcp;