From: Nathan Scott Date: Fri, 30 Aug 2002 06:13:52 +0000 (+0000) Subject: sync user/kernel after recent kernel changes. noop for userspace. X-Git-Tag: v2.3.0~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b391b7cdc0e803909e51680f95b7b89d495c9599;p=thirdparty%2Fxfsprogs-dev.git sync user/kernel after recent kernel changes. noop for userspace. --- diff --git a/include/libxfs.h b/include/libxfs.h index 431a7831b..0e00579f6 100644 --- a/include/libxfs.h +++ b/include/libxfs.h @@ -73,6 +73,10 @@ #include #include +#ifndef XFS_SUPER_MAGIC +#define XFS_SUPER_MAGIC 0x58465342 +#endif + /* * Argument structure for libxfs_init(). */ @@ -128,7 +132,7 @@ typedef struct xfs_mount { int m_bsize; /* fs logical block size */ xfs_agnumber_t m_agfrotor; /* last ag where space found */ xfs_agnumber_t m_agirotor; /* last ag dir inode alloced */ - xfs_agnumber_t m_maxagi; /* highest inode alloc group */ + xfs_agnumber_t m_maxagi; /* highest inode alloc group */ uint m_rsumlevels; /* rt summary levels */ uint m_rsumsize; /* size of rt summary, bytes */ struct xfs_inode *m_rbmip; /* pointer to bitmap inode */ diff --git a/include/xfs_fs.h b/include/xfs_fs.h index 4558f972e..7984d9261 100644 --- a/include/xfs_fs.h +++ b/include/xfs_fs.h @@ -41,7 +41,6 @@ * SGI's XFS filesystem's major stuff (constants, structures) */ -#define XFS_SUPER_MAGIC 0x58465342 #define XFS_NAME "xfs" /* diff --git a/include/xfs_inode.h b/include/xfs_inode.h index 350710aed..a5320cf2c 100644 --- a/include/xfs_inode.h +++ b/include/xfs_inode.h @@ -431,8 +431,7 @@ void xfs_ifork_next_set(xfs_inode_t *ip, int w, int n); #define XFS_ITRUNC_MAYBE 0x2 /* - * if XFS_BIG_FILES, 2^(31+PAGE_SHIFT) - 1 (due to linux page cache), - * else 2^40 - 1 (40=31+9) (might be an int holding a block #) + * max file offset is 2^(31+PAGE_SHIFT) - 1 (due to linux page cache) * * NOTE: XFS itself can handle 2^63 - 1 (largest positive value of xfs_fsize_t) * but Linux can't go above 2^(31+PAGE_SHIFT)-1: the Linux VM uses a 32 bit diff --git a/include/xfs_mac.h b/include/xfs_mac.h index 17406105c..8a6179d9e 100644 --- a/include/xfs_mac.h +++ b/include/xfs_mac.h @@ -98,6 +98,10 @@ typedef struct xfs_mac_label { /* NOT YET IMPLEMENTED */ +#define MACEXEC 00100 +#define MACWRITE 00200 +#define MACREAD 00400 + struct xfs_inode; extern int xfs_mac_iaccess(struct xfs_inode *, mode_t, cred_t *); diff --git a/include/xfs_mount.h b/include/xfs_mount.h index 2ad4a05aa..51c86fea2 100644 --- a/include/xfs_mount.h +++ b/include/xfs_mount.h @@ -186,14 +186,10 @@ typedef struct xfs_mount { struct xfs_inode *m_rsumip; /* pointer to summary inode */ struct xfs_inode *m_rootip; /* pointer to root directory */ struct xfs_quotainfo *m_quotainfo; /* disk quota information */ - buftarg_t m_ddev_targ; /* ptr to data device */ - buftarg_t m_logdev_targ; /* ptr to log device */ - buftarg_t m_rtdev_targ; /* ptr to rt device */ - buftarg_t *m_ddev_targp; /* saves taking the address */ -#define m_rtdev_targp(m)(&(m)->m_rtdev_targ) -#define m_dev m_ddev_targ.dev -#define m_logdev m_logdev_targ.dev -#define m_rtdev m_rtdev_targ.dev + xfs_buftarg_t *m_ddev_targp; /* saves taking the address */ + xfs_buftarg_t *m_logdev_targp;/* ptr to log device */ + xfs_buftarg_t *m_rtdev_targp; /* ptr to rt device */ +#define m_dev m_ddev_targp->pbr_dev __uint8_t m_dircook_elog; /* log d-cookie entry bits */ __uint8_t m_blkbit_log; /* blocklog + NBBY */ __uint8_t m_blkbb_log; /* blocklog - BBSHIFT */ diff --git a/include/xfs_trans.h b/include/xfs_trans.h index 7dcb404e4..1845dd874 100644 --- a/include/xfs_trans.h +++ b/include/xfs_trans.h @@ -118,7 +118,7 @@ typedef struct xfs_trans_header { #ifdef __KERNEL__ struct xfs_buf; -struct buftarg; +struct xfs_buftarg; struct xfs_efd_log_item; struct xfs_efi_log_item; struct xfs_inode; @@ -974,10 +974,10 @@ int xfs_trans_reserve(xfs_trans_t *, uint, uint, uint, void xfs_trans_callback(xfs_trans_t *, void (*)(xfs_trans_t *, void *), void *); void xfs_trans_mod_sb(xfs_trans_t *, uint, long); -struct xfs_buf *xfs_trans_get_buf(xfs_trans_t *, struct buftarg *, xfs_daddr_t, +struct xfs_buf *xfs_trans_get_buf(xfs_trans_t *, struct xfs_buftarg *, xfs_daddr_t, int, uint); int xfs_trans_read_buf(struct xfs_mount *, xfs_trans_t *, - struct buftarg *, xfs_daddr_t, int, uint, + struct xfs_buftarg *, xfs_daddr_t, int, uint, struct xfs_buf **); struct xfs_buf *xfs_trans_getsb(xfs_trans_t *, struct xfs_mount *, int); diff --git a/libxfs/init.c b/libxfs/init.c index 90d1928c1..382217434 100644 --- a/libxfs/init.c +++ b/libxfs/init.c @@ -645,6 +645,50 @@ rtmount_inodes(xfs_mount_t *mp) return 0; } +/* + * Initialize realtime fields in the mount structure. + */ +static int +rtmount_init( + xfs_mount_t *mp) /* file system mount structure */ +{ + xfs_buf_t *bp; /* buffer for last block of subvolume */ + xfs_daddr_t d; /* address of last block of subvolume */ + xfs_sb_t *sbp; /* filesystem superblock copy in mount */ + + sbp = &mp->m_sb; + if (sbp->sb_rblocks == 0) + return 0; + if (mp->m_rtdev != 0) { + fprintf(stderr, "%s: filesystem has a realtime subvolume\n", + progname); + return -1; + } + mp->m_rsumlevels = sbp->sb_rextslog + 1; + mp->m_rsumsize = + (uint)sizeof(xfs_suminfo_t) * mp->m_rsumlevels * + sbp->sb_rbmblocks; + mp->m_rsumsize = roundup(mp->m_rsumsize, sbp->sb_blocksize); + mp->m_rbmip = mp->m_rsumip = NULL; + /* + * Check that the realtime section is an ok size. + */ + d = (xfs_daddr_t)XFS_FSB_TO_BB(mp, mp->m_sb.sb_rblocks); + if (XFS_BB_TO_FSB(mp, d) != mp->m_sb.sb_rblocks) { + fprintf(stderr, "%s: realtime init - %llu != %llu\n", progname, + (unsigned long long) XFS_BB_TO_FSB(mp, d), + (unsigned long long) mp->m_sb.sb_rblocks); + return -1; + } + bp = libxfs_readbuf(mp->m_rtdev, d - 1, 1, 0); + if (bp == NULL) { + fprintf(stderr, "%s: realtime size check failed\n", progname); + return -1; + } + libxfs_putbuf(bp); + return 0; +} + #define XFS_MOUNT_32BITINODES 0x1 /* * Mount structure initialization, provides a filled-in xfs_mount_t @@ -752,8 +796,8 @@ libxfs_mount( } /* Initialize realtime fields in the mount structure */ - if (libxfs_rtmount_init(mp)) { - fprintf(stderr, "%s: real-time device init failed\n", progname); + if (rtmount_init(mp)) { + fprintf(stderr, "%s: realtime device init failed\n", progname); return NULL; } diff --git a/libxfs/logitem.c b/libxfs/logitem.c index 689cb6bc9..19f8fd28a 100644 --- a/libxfs/logitem.c +++ b/libxfs/logitem.c @@ -247,7 +247,7 @@ xfs_trans_free_items( STATIC xfs_buf_t * xfs_trans_buf_item_match( xfs_trans_t *tp, - buftarg_t *target, + xfs_buftarg_t *target, xfs_daddr_t blkno, int len) { @@ -322,7 +322,7 @@ xfs_trans_buf_item_match( STATIC xfs_buf_t * xfs_trans_buf_item_match_all( xfs_trans_t *tp, - buftarg_t *target, + xfs_buftarg_t *target, xfs_daddr_t blkno, int len) { diff --git a/libxfs/trans.c b/libxfs/trans.c index b476263ac..3b9ca0150 100644 --- a/libxfs/trans.c +++ b/libxfs/trans.c @@ -363,7 +363,7 @@ libxfs_trans_get_buf(xfs_trans_t *tp, dev_t dev, xfs_daddr_t d, int len, uint f) { xfs_buf_t *bp; xfs_buf_log_item_t *bip; - buftarg_t bdev = { dev }; + xfs_buftarg_t bdev = { dev }; if (tp == NULL) return libxfs_getbuf(dev, d, len); @@ -404,7 +404,7 @@ libxfs_trans_read_buf(xfs_mount_t *mp, xfs_trans_t *tp, dev_t dev, xfs_buf_t *bp; xfs_buf_log_item_t *bip; int error; - buftarg_t bdev = { dev }; + xfs_buftarg_t bdev = { dev }; if (tp == NULL) { bp = libxfs_getbuf(mp->m_dev, blkno, len); diff --git a/libxfs/xfs.h b/libxfs/xfs.h index 7090060b0..39c821152 100644 --- a/libxfs/xfs.h +++ b/libxfs/xfs.h @@ -235,14 +235,13 @@ typedef __uint32_t uint_t; typedef __uint32_t inst_t; /* an instruction */ typedef enum { B_FALSE, B_TRUE } boolean_t; -typedef struct { dev_t dev; } buftarg_t; +typedef struct { dev_t dev; } xfs_buftarg_t; #define STATIC #define ATTR_ROOT 0x0002 /* use attrs in root namespace */ #define ENOATTR ENODATA /* Attribute not found */ #define EFSCORRUPTED 990 /* Filesystem is corrupted */ #define ktrace_t void #define m_ddev_targp m_dev -#define m_rtdev_targp(m)(&(m)->m_rtdev) #define kdev_none(x) (!(x)) #define KERN_WARNING #define XFS_ERROR(e) (e) @@ -560,9 +559,9 @@ void xfs_trans_free_item (xfs_trans_t *, xfs_log_item_desc_t *); void xfs_trans_free_items (xfs_trans_t *, int); /* xfs_trans_buf.c */ -xfs_buf_t *xfs_trans_buf_item_match (xfs_trans_t *, buftarg_t *, +xfs_buf_t *xfs_trans_buf_item_match (xfs_trans_t *, xfs_buftarg_t *, xfs_daddr_t, int); -xfs_buf_t *xfs_trans_buf_item_match_all (xfs_trans_t *, buftarg_t *, +xfs_buf_t *xfs_trans_buf_item_match_all (xfs_trans_t *, xfs_buftarg_t *, xfs_daddr_t, int); /* xfs_inode_item.c */ diff --git a/libxfs/xfs_inode.c b/libxfs/xfs_inode.c index 7f424a178..e18e41e3b 100644 --- a/libxfs/xfs_inode.c +++ b/libxfs/xfs_inode.c @@ -1011,7 +1011,7 @@ xfs_iext_realloc( kmem_realloc(ifp->if_u1.if_extents, rnew_size, ifp->if_real_bytes, - KM_SLEEP); + KM_NOFS); } } ifp->if_real_bytes = rnew_size; diff --git a/libxfs/xfs_mount.c b/libxfs/xfs_mount.c index 7a185645c..3d2e824d1 100644 --- a/libxfs/xfs_mount.c +++ b/libxfs/xfs_mount.c @@ -171,59 +171,66 @@ static struct { * fields - which fields to copy (bitmask) */ void -xfs_xlatesb(void *data, xfs_sb_t *sb, int dir, xfs_arch_t arch, - __int64_t fields) +xfs_xlatesb( + void *data, + xfs_sb_t *sb, + int dir, + xfs_arch_t arch, + __int64_t fields) { - xfs_caddr_t buf_ptr; - xfs_caddr_t mem_ptr; + xfs_caddr_t buf_ptr; + xfs_caddr_t mem_ptr; + xfs_sb_field_t f; + int first; + int size; - ASSERT(dir); - ASSERT(fields); + ASSERT(dir); + ASSERT(fields); - if (!fields) - return; + if (!fields) + return; - buf_ptr=(xfs_caddr_t)data; - mem_ptr=(xfs_caddr_t)sb; + buf_ptr = (xfs_caddr_t)data; + mem_ptr = (xfs_caddr_t)sb; - while (fields) { - xfs_sb_field_t f; - int first; - int size; + while (fields) { + f = (xfs_sb_field_t)xfs_lowbit64((__uint64_t)fields); + first = xfs_sb_info[f].offset; + size = xfs_sb_info[f + 1].offset - first; - f = (xfs_sb_field_t)xfs_lowbit64((__uint64_t)fields); - first = xfs_sb_info[f].offset; - size = xfs_sb_info[f + 1].offset - first; + ASSERT(xfs_sb_info[f].type == 0 || xfs_sb_info[f].type == 1); - ASSERT(xfs_sb_info[f].type==0 || xfs_sb_info[f].type==1); + if (arch == ARCH_NOCONVERT || + size == 1 || + xfs_sb_info[f].type == 1) { + if (dir > 0) { + bcopy(buf_ptr + first, mem_ptr + first, size); + } else { + bcopy(mem_ptr + first, buf_ptr + first, size); + } + } else { + switch (size) { + case 2: + INT_XLATE(*(__uint16_t*)(buf_ptr+first), + *(__uint16_t*)(mem_ptr+first), + dir, arch); + break; + case 4: + INT_XLATE(*(__uint32_t*)(buf_ptr+first), + *(__uint32_t*)(mem_ptr+first), + dir, arch); + break; + case 8: + INT_XLATE(*(__uint64_t*)(buf_ptr+first), + *(__uint64_t*)(mem_ptr+first), dir, arch); + break; + default: + ASSERT(0); + } + } - if (arch == ARCH_NOCONVERT || size==1 || xfs_sb_info[f].type==1) { - if (dir>0) { - bcopy(buf_ptr + first, mem_ptr + first, size); - } else { - bcopy(mem_ptr + first, buf_ptr + first, size); - } - } else { - switch (size) { - case 2: - INT_XLATE(*(__uint16_t*)(buf_ptr+first), - *(__uint16_t*)(mem_ptr+first), dir, arch); - break; - case 4: - INT_XLATE(*(__uint32_t*)(buf_ptr+first), - *(__uint32_t*)(mem_ptr+first), dir, arch); - break; - case 8: - INT_XLATE(*(__uint64_t*)(buf_ptr+first), - *(__uint64_t*)(mem_ptr+first), dir, arch); - break; - default: - ASSERT(0); - } + fields &= ~(1LL << f); } - fields &= ~(1LL << f); - } - } void diff --git a/libxfs/xfs_rtalloc.c b/libxfs/xfs_rtalloc.c index 4e216f226..e33fc461a 100644 --- a/libxfs/xfs_rtalloc.c +++ b/libxfs/xfs_rtalloc.c @@ -787,51 +787,3 @@ xfs_rtfree_extent( } return 0; } - -/* - * Initialize realtime fields in the mount structure. - */ -int /* error */ -xfs_rtmount_init( - xfs_mount_t *mp) /* file system mount structure */ -{ - xfs_buf_t *bp; /* buffer for last block of subvolume */ - xfs_daddr_t d; /* address of last block of subvolume */ - int error; /* error return value */ - xfs_sb_t *sbp; /* filesystem superblock copy in mount */ - - sbp = &mp->m_sb; - if (sbp->sb_rblocks == 0) - return 0; - if (mp->m_rtdev != 0) { - printk(KERN_WARNING - "XFS: This FS has an RT subvol - specify -o rtdev on mount\n"); - return XFS_ERROR(ENODEV); - } - mp->m_rsumlevels = sbp->sb_rextslog + 1; - mp->m_rsumsize = - (uint)sizeof(xfs_suminfo_t) * mp->m_rsumlevels * - sbp->sb_rbmblocks; - mp->m_rsumsize = roundup(mp->m_rsumsize, sbp->sb_blocksize); - mp->m_rbmip = mp->m_rsumip = NULL; - /* - * Check that the realtime section is an ok size. - */ - d = (xfs_daddr_t)XFS_FSB_TO_BB(mp, mp->m_sb.sb_rblocks); - if (XFS_BB_TO_FSB(mp, d) != mp->m_sb.sb_rblocks) { - printk(KERN_WARNING "XFS: RT mount - %llu != %llu\n", - (unsigned long long) XFS_BB_TO_FSB(mp, d), - (unsigned long long) mp->m_sb.sb_rblocks); - return XFS_ERROR(E2BIG); - } - error = xfs_read_buf(mp, m_rtdev_targp(mp), d - 1, 1, 0, &bp); - if (error) { - printk(KERN_WARNING - "XFS: RT mount - xfs_read_buf returned %d\n", error); - if (error == ENOSPC) - return XFS_ERROR(E2BIG); - return error; - } - xfs_buf_relse(bp); - return 0; -}