xfsprogs: sync up with 2.6.38 kernel code V2
cover xfsprogs: sync up with 2.6.38 kernel code V2
This is version 2 of the 2.6.38 kernel code sync to userspace. It currently passes xfstests on x86_64 with no new regressions regardless of the filesystem block size combination I throw at it.
Note: this does not convert xfsprogs to the kernel xfs_trans_ijoin\ijoin_ref interface, it maintains the older ijoin/ihold interface because of the different way the inode reference counting works in libxfs. More work will be needed to change it over to a manner compatible with the current kernel API.
Note: log sector size handling needs to be sorted out. Specifically, initialising l_sectbb_log/l_sectBBsize correctly and removing the hacks in xlog_bread and friends (libxlog/xfs_log_recover.c) to work around the fact they are not initialised correctly. (FWIW, I don't think xfsprogs handles large log sector size correctly as a result, and especially not if the log device sector size is different to the data device sector size).
Version 2:
- split into three patches:
- reintroduction of radix tree code
- libxlog resync
- includes required libxfs transaction code changes
- updates logprint to use new interfaces
- libxfs resync
- updates libxfs
- updates all xfsprogs to use new libxfs interfaces.
- fixes xfstest 033 cache_purge bug
- was a problem in handling the XFS_ILI_HOLD flag removal.
---
The following changes since commit adfdbed6a014a412529864a66b09117e6a4bee64:
Update xfsprogs Debian maintainer annotation, bump version. (2010-11-11 21:11:44 +1100)
are available in the git repository at:
git://git.kernel.org/pub/scm/fs/xfs/xfsprogs-dev kernel-2.6.38-sync
Dave Chinner (5):
repair: warn if running in low memory mode
xfs_repair: multithread phase 2
libxfs: reintroduce old xfs_repair radix-tree code
libxlog: sync up with 2.6.38 kernel code
libxfs: sync files with 2.6.38 kernel code
db/attr.c | 16 +- db/attrset.c | 5 +- db/bmap.c | 18 +- db/bmap.h | 4 +- db/check.c | 50 +- db/convert.c | 6 +- db/dir2sf.c | 6 +- db/field.c | 2 +- db/frag.c | 6 +- db/inode.c | 124 ++-- db/metadump.c | 20 +- include/Makefile | 5 +- include/atomic.h | 31 + include/hlist.h | 76 ++ include/libxfs.h | 44 +- include/libxlog.h | 16 +- include/list.h | 11 + include/radix-tree.h | 76 ++ include/xfs_ag.h | 100 ++- include/xfs_alloc.h | 58 +- include/xfs_arch.h | 32 - include/xfs_attr_leaf.h | 12 - include/xfs_attr_sf.h | 42 +- include/xfs_bit.h | 10 +- include/xfs_bmap.h | 133 ++-- include/xfs_bmap_btree.h | 20 +- include/xfs_btree.h | 31 +- include/xfs_btree_trace.h | 17 - include/xfs_buf_item.h | 50 +- include/xfs_da_btree.h | 21 +- include/xfs_dfrag.h | 5 +- include/xfs_dinode.h | 149 ++--- include/xfs_dir2.h | 4 +- include/xfs_dir2_data.h | 2 +- include/xfs_dir2_node.h | 2 - include/xfs_dir2_sf.h | 7 - include/xfs_extfree_item.h | 17 +- include/xfs_fs.h | 30 +- include/xfs_ialloc.h | 30 +- include/xfs_ialloc_btree.h | 23 +- include/xfs_imap.h | 38 - include/xfs_inode.h | 210 +++--- include/xfs_inode_item.h | 32 +- include/xfs_inum.h | 1 - include/xfs_log.h | 70 +- include/xfs_log_priv.h | 331 +++++++-- include/xfs_log_recover.h | 25 +- include/xfs_mount.h | 259 ++----- include/xfs_quota.h | 160 ++-- include/xfs_rtalloc.h | 19 +- include/xfs_sb.h | 168 +++-- include/xfs_trace.h | 85 +++ include/xfs_trans.h | 648 +++-------------- include/xfs_trans_space.h | 2 +- include/xfs_types.h | 18 +- libxfs/Makefile | 2 +- libxfs/init.c | 133 +++- libxfs/logitem.c | 371 +--------- libxfs/radix-tree.c | 805 ++++++++++++++++++++ libxfs/trans.c | 211 ++---- libxfs/util.c | 75 +- libxfs/xfs.h | 49 +- libxfs/xfs_alloc.c | 599 ++++++++-------- libxfs/xfs_alloc_btree.c | 46 +- libxfs/xfs_attr.c | 138 ++-- libxfs/xfs_attr_leaf.c | 135 ++-- libxfs/xfs_bmap.c | 1773 ++++++++++++++++++++++---------------------- libxfs/xfs_bmap_btree.c | 129 ++-- libxfs/xfs_btree.c | 96 ++- libxfs/xfs_da_btree.c | 48 +- libxfs/xfs_dir2.c | 31 +- libxfs/xfs_dir2_block.c | 28 +- libxfs/xfs_dir2_leaf.c | 21 +- libxfs/xfs_dir2_node.c | 29 +- libxfs/xfs_dir2_sf.c | 24 +- libxfs/xfs_ialloc.c | 1157 +++++++++++++++-------------- libxfs/xfs_ialloc_btree.c | 35 +- libxfs/xfs_inode.c | 277 ++++---- libxfs/xfs_mount.c | 123 +--- libxfs/xfs_trans.c | 492 +++++++++++-- libxlog/xfs_log_recover.c | 606 ++++++++------- logprint/log_misc.c | 2 +- logprint/log_print_all.c | 13 +- logprint/log_print_trans.c | 4 +- mkfs/proto.c | 18 +- mkfs/xfs_mkfs.c | 3 +- repair/attr_repair.c | 14 +- repair/dino_chunks.c | 12 +- repair/dinode.c | 275 ++++---- repair/dir.c | 18 +- repair/dir2.c | 22 +- repair/incore.h | 3 + repair/phase2.c | 20 +- repair/phase6.c | 76 +- repair/prefetch.c | 29 +- repair/rt.c | 2 +- repair/scan.c | 294 +++++---- repair/scan.h | 39 +- repair/xfs_repair.c | 26 +- 99 files changed, 6094 insertions(+), 5586 deletions(-) create mode 100644 include/atomic.h create mode 100644 include/hlist.h create mode 100644 include/radix-tree.h delete mode 100644 include/xfs_imap.h create mode 100644 include/xfs_trace.h create mode 100644 libxfs/radix-tree.c
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 1/3 libxfs: reintroduce old xfs_repair radix-tree code
From: Dave Chinner <[email protected]>
The current kernel code uses radix trees more widely than the previous code, so for the next sync we need radix tree support in libxfs. Pull the old radix tree code out the xfs_repair git history and move it into libxfs to simplify the kernel code sync.
--- include/Makefile | 2 +- include/libxfs.h | 1 + include/radix-tree.h | 76 +++++ libxfs/Makefile | 2 +- libxfs/radix-tree.c | 805 ++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 884 insertions(+), 2 deletions(-) create mode 100644 include/radix-tree.h create mode 100644 libxfs/radix-tree.c
include/Makefile +1 -1
@@ -19,7 +19,7 @@ TOPDIR = .. include $(TOPDIR)/include/builddefs QAHFILES = libxfs.h libxlog.h \ - bitops.h cache.h kmem.h list.h parent.h swab.h \ + bitops.h cache.h kmem.h list.h parent.h radix-tree.h swab.h \ xfs_ag.h xfs_alloc.h xfs_alloc_btree.h xfs_arch.h xfs_attr_leaf.h \ xfs_attr_sf.h xfs_bit.h xfs_bmap.h xfs_bmap_btree.h xfs_btree.h \ xfs_btree_trace.h xfs_buf_item.h xfs_da_btree.h xfs_dinode.h \
include/libxfs.h +1 -0
@@ -28,6 +28,7 @@#include <xfs/cache.h> #include <xfs/bitops.h> #include <xfs/kmem.h> +#include <xfs/radix-tree.h> #include <xfs/swab.h> #include <xfs/xfs_fs.h>
include/radix-tree.h new file +76 -0
76 lines not on this page · raw message
libxfs/Makefile +1 -1
@@ -11,7 +11,7 @@ LT_REVISION = 0 LT_AGE = 0 HFILES = xfs.h init.h -CFILES = cache.c init.c kmem.c logitem.c rdwr.c trans.c util.c \ +CFILES = cache.c init.c kmem.c logitem.c radix-tree.c rdwr.c trans.c util.c \ xfs_alloc.c xfs_ialloc.c xfs_inode.c xfs_btree.c xfs_alloc_btree.c \ xfs_ialloc_btree.c xfs_bmap_btree.c xfs_da_btree.c \ xfs_dir2.c xfs_dir2_leaf.c xfs_attr_leaf.c xfs_dir2_block.c \
libxfs/radix-tree.c new file +805 -0
805 lines not on this page · raw message
Signature · 6 lines
1.7.2.3 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 2/3 libxlog: sync up with 2.6.38 kernel code
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Update libxlog with the current 2.6.38 kernel code and well as updating the necessary parts of libxfs and variaous header files to ensure that it compiles correctly.
--- include/Makefile | 5 +- include/atomic.h | 31 ++ include/hlist.h | 76 +++++ include/libxfs.h | 17 +- include/libxlog.h | 16 +- include/list.h | 11 + include/xfs_buf_item.h | 50 ++--- include/xfs_extfree_item.h | 17 +- include/xfs_inode_item.h | 2 - include/xfs_log.h | 70 +++-- include/xfs_log_priv.h | 331 +++++++++++++++++------ include/xfs_log_recover.h | 25 +- include/xfs_trace.h | 9 + include/xfs_trans.h | 648 ++++++-------------------------------------- include/xfs_types.h | 2 + libxfs/logitem.c | 365 +------------------------ libxfs/trans.c | 209 +++++---------- libxfs/xfs.h | 12 +- libxfs/xfs_mount.c | 1 - libxfs/xfs_trans.c | 492 ++++++++++++++++++++++++++++++--- libxlog/xfs_log_recover.c | 606 ++++++++++++++++++++++------------------- logprint/log_print_all.c | 13 +- logprint/log_print_trans.c | 4 +- 23 files changed, 1431 insertions(+), 1581 deletions(-) create mode 100644 include/atomic.h create mode 100644 include/hlist.h create mode 100644 include/xfs_trace.h
include/Makefile +3 -2
@@ -19,7 +19,8 @@ TOPDIR = .. include $(TOPDIR)/include/builddefs QAHFILES = libxfs.h libxlog.h \ - bitops.h cache.h kmem.h list.h parent.h radix-tree.h swab.h \ + atomic.h bitops.h cache.h kmem.h list.h hlist.h parent.h radix-tree.h \ + swab.h \ xfs_ag.h xfs_alloc.h xfs_alloc_btree.h xfs_arch.h xfs_attr_leaf.h \ xfs_attr_sf.h xfs_bit.h xfs_bmap.h xfs_bmap_btree.h xfs_btree.h \ xfs_btree_trace.h xfs_buf_item.h xfs_da_btree.h xfs_dinode.h \
@@ -28,7 +29,7 @@ QAHFILES = libxfs.h libxlog.h \ xfs_extfree_item.h xfs_ialloc.h xfs_ialloc_btree.h \ xfs_imap.h xfs_inode.h xfs_inode_item.h xfs_inum.h \ xfs_log.h xfs_log_priv.h xfs_log_recover.h xfs_metadump.h \ - xfs_mount.h xfs_quota.h xfs_rtalloc.h xfs_sb.h \ + xfs_mount.h xfs_quota.h xfs_rtalloc.h xfs_sb.h xfs_trace.h \ xfs_trans.h xfs_trans_space.h xfs_types.h xfs_dfrag.h HFILES = handle.h jdm.h xqm.h xfs.h xfs_fs.h
include/atomic.h new file +31 -0
@@ -0,0 +1,31 @@ +/* +* Copyright (c) 2011 RedHat, Inc. +* All Rights Reserved. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation. +* +* This program is distributed in the hope that it would be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write the Free Software Foundation, +* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ +#ifndef __ATOMIC_H__ +#define __ATOMIC_H__ + +typedef int32_t atomic_t ; +typedef int64_t atomic64_t ; + +#define atomic_inc_return (x) (++(*(x))) +#define atomic_dec_return (x) (--(*(x))) + +#define atomic64_read (x) *(x) +#define atomic64_set (x, v) (*(x) = v) + +#endif /* __ATOMIC_H__ */ +
include/hlist.h new file +76 -0
76 lines not on this page · raw message
include/libxfs.h +14 -3
@@ -25,11 +25,13 @@#include <xfs/platform_defs.h> #include <xfs/list.h> +#include <xfs/hlist.h> #include <xfs/cache.h> #include <xfs/bitops.h> #include <xfs/kmem.h> #include <xfs/radix-tree.h> #include <xfs/swab.h> +#include <xfs/atomic.h> #include <xfs/xfs_fs.h> #include <xfs/xfs_types.h>
@@ -55,6 +57,7 @@#include <xfs/xfs_btree.h> #include <xfs/xfs_btree_trace.h> #include <xfs/xfs_bmap.h> +#include <xfs/xfs_trace.h> #ifndef XFS_SUPER_MAGIC
@@ -63,6 +66,10 @@#define xfs_isset (a,i) ((a)[(i)/(sizeof((a))*NBBY)] & (1<<((i)%(sizeof((a))*NBBY)))) +#define __round_mask (x, y) ((__typeof__(x))((y)-1)) +#define round_up (x, y) ((((x)-1) | __round_mask(x, y))+1) +#define round_down (x, y) ((x) & ~__round_mask(x, y)) +/* * Argument structure for libxfs_init(). */
@@ -241,8 +248,11 @@ enum xfs_buf_flags_t { /* b_flags bits */#define XFS_BUF_SIZE (bp) ((bp)->b_bcount)#define XFS_BUF_COUNT (bp) ((bp)->b_bcount)#define XFS_BUF_TARGET (bp) ((bp)->b_dev) -#define XFS_BUF_SET_PTR (bp,p,cnt) ((bp)->b_addr = (char *)(p)); \ - XFS_BUF_SET_COUNT(bp,cnt) +#define XFS_BUF_SET_PTR (bp,p,cnt) ({ \ + (bp)->b_addr = (char *)(p); \ + XFS_BUF_SET_COUNT(bp,cnt); \ +}) +#define XFS_BUF_SET_ADDR (bp,blk) ((bp)->b_blkno = (blk))#define XFS_BUF_SET_COUNT (bp,cnt) ((bp)->b_bcount = (cnt))
@@ -330,6 +340,7 @@ typedef struct xfs_inode_log_item {unsigned short ili_flags;/* misc flags */ unsigned int ili_last_fields;/* fields when flushed*/ xfs_inode_log_format_t ili_format;/* logged structure */ +int ili_lock_flags; } xfs_inode_log_item_t; typedef struct xfs_buf_log_item {
@@ -353,7 +364,7 @@ typedef struct xfs_trans {long t_fdblocks_delta;/* superblock fdblocks chg */ long t_frextents_delta;/* superblock freextents chg */ unsigned int t_items_free;/* log item descs free */ -xfs_log_item_chunk_t t_items;/* first log item desc chunk */ +struct list_head t_items;/* first log item desc chunk */ } xfs_trans_t;extern xfs_trans_t *libxfs_trans_alloc (xfs_mount_t *,int );
include/libxlog.h +10 -6
@@ -39,13 +39,12 @@ typedef struct log {int l_iclog_size;/* size of log in bytes */ int l_iclog_size_log;/* log power size of log */ int l_iclog_bufs;/* number of iclog buffers */ -int l_grant_reserve_cycle;/* */ -int l_grant_reserve_bytes;/* */ -int l_grant_write_cycle;/* */ -int l_grant_write_bytes;/* */ +atomic64_t l_grant_reserve_head; +atomic64_t l_grant_write_head;uint l_sectbb_log;/* log2 of sector size in bbs */ uint l_sectbb_mask;/* sector size (in BBs) * alignment mask */ +int l_sectBBsize;/* size of log sector in 512 byte chunks */ } xlog_t;#include <xfs/xfs_log_recover.h>
@@ -91,7 +90,10 @@ extern libxfs_init_t x;extern struct xfs_buf *xlog_get_bp (xlog_t *,int );extern void xlog_put_bp (struct xfs_buf *); -extern int xlog_bread (xlog_t *,xfs_daddr_t ,int ,struct xfs_buf *); +extern int xlog_bread (xlog_t *log,xfs_daddr_t blk_no,int nbblks, +xfs_buf_t *bp,xfs_caddr_t *offset); +extern int xlog_bread_noalign (xlog_t *log,xfs_daddr_t blk_no,int nbblks, +xfs_buf_t *bp);extern int xlog_find_zeroed (xlog_t *log,xfs_daddr_t *blk_no); extern int xlog_find_cycle_start(xlog_t *log, xfs_buf_t *bp,
@@ -110,7 +112,7 @@ extern int xlog_print_find_oldest(xlog_t *log, xfs_daddr_t *last_blk);/* for transactional view */ extern void xlog_recover_print_trans_head (xlog_recover_t *tr);extern void xlog_recover_print_trans (xlog_recover_t *trans, -xlog_recover_item_t *itemq,int print); +struct list_head *itemq,int print);extern int xlog_do_recovery_pass (xlog_t *log,xfs_daddr_t head_blk,xfs_daddr_t tail_blk,int pass); extern int xlog_recover_do_trans(xlog_t *log, xlog_recover_t *trans,
@@ -120,4 +122,6 @@ extern int xlog_header_check_recover(xfs_mount_t *mp,extern int xlog_header_check_mount (xfs_mount_t *mp,xlog_rec_header_t *head); +#define xlog_assign_atomic_lsn (l,a,b) ((void) 0) +#define xlog_assign_grant_head (l,a,b) ((void) 0)#endif /* LIBXLOG_H */
include/list.h +11 -0
@@ -27,6 +27,12 @@ struct list_head {struct list_head *prev; }; +#define LIST_HEAD_INIT (name) { &(name), &(name) } + +#define LIST_HEAD (name) \ + struct list_head name = LIST_HEAD_INIT(name) + +#define INIT_LIST_HEAD (list) list_head_init(list)static inline void list_head_init (struct list_head *list) { list->next = list->prev = list;
@@ -68,6 +74,11 @@ static inline void list_del_init(struct list_head *entry)list_head_init (entry); } +static inline void list_del (struct list_head *entry) +{ +__list_del (entry->prev, entry->next); +} +static inline void list_move (struct list_head *list,struct list_head *head) {__list_del (list->prev, list->next);
include/xfs_buf_item.h +18 -32
103 lines not on this page · raw message
include/xfs_extfree_item.h +5 -12
@@ -33,12 +33,10 @@ typedef struct xfs_extent {* conversion routine. */ -#ifndef HAVE_FORMAT32 typedef struct xfs_extent_32 {__uint64_t ext_start;__uint32_t ext_len; } __attribute__((packed))xfs_extent_32_t ; -#endif typedef struct xfs_extent_64 { __uint64_t ext_start;
@@ -59,7 +57,6 @@ typedef struct xfs_efi_log_format {xfs_extent_t efi_extents[1 ];/* array of extents to free */ } xfs_efi_log_format_t; -#ifndef HAVE_FORMAT32 typedef struct xfs_efi_log_format_32 { __uint16_t efi_type; /* efi log item type */ __uint16_t efi_size; /* size of this item */
@@ -67,7 +64,6 @@ typedef struct xfs_efi_log_format_32 {__uint64_t efi_id;/* efi identifier */ xfs_extent_32_t efi_extents[1 ];/* array of extents to free */ } __attribute__((packed)) xfs_efi_log_format_32_t; -#endif typedef struct xfs_efi_log_format_64 { __uint16_t efi_type; /* efi log item type */
@@ -90,7 +86,6 @@ typedef struct xfs_efd_log_format {xfs_extent_t efd_extents[1 ];/* array of extents freed */ } xfs_efd_log_format_t; -#ifndef HAVE_FORMAT32 typedef struct xfs_efd_log_format_32 { __uint16_t efd_type; /* efd log item type */ __uint16_t efd_size; /* size of this item */
@@ -98,7 +93,6 @@ typedef struct xfs_efd_log_format_32 {__uint64_t efd_efi_id;/* id of corresponding efi */ xfs_extent_32_t efd_extents[1 ];/* array of extents freed */ } __attribute__((packed)) xfs_efd_log_format_32_t; -#endif typedef struct xfs_efd_log_format_64 { __uint16_t efd_type; /* efd log item type */
@@ -117,11 +111,10 @@ typedef struct xfs_efd_log_format_64 {#define XFS_EFI_MAX_FAST_EXTENTS 16/* -* Define EFI flags. +* Define EFI flag bits. Manipulated by set/clear/test_bit operators. */ -#define XFS_EFI_RECOVERED 0x1 -#define XFS_EFI_COMMITTED 0x2 -#define XFS_EFI_CANCELED 0x4 +#define XFS_EFI_RECOVERED 1 +#define XFS_EFI_COMMITTED 2/* * This is the "extent free intention" log item. It is used
@@ -131,8 +124,8 @@ typedef struct xfs_efd_log_format_64 {*/ typedef struct xfs_efi_log_item {xfs_log_item_t efi_item; -uint efi_flags;/* misc flags */ -uint efi_next_extent; +atomic_t efi_next_extent; +unsigned long efi_flags;/* misc flags */ xfs_efi_log_format_t efi_format; }xfs_efi_log_item_t ;
include/xfs_inode_item.h +0 -2
@@ -40,7 +40,6 @@ typedef struct xfs_inode_log_format {__int32_t ilf_boffset;/* off of inode in buffer */ } xfs_inode_log_format_t; -#ifndef HAVE_FORMAT32 typedef struct xfs_inode_log_format_32 { __uint16_t ilf_type; /* inode log item type */ __uint16_t ilf_size; /* size of this item */
@@ -56,7 +55,6 @@ typedef struct xfs_inode_log_format_32 {__int32_t ilf_len;/* len of inode buffer */ __int32_t ilf_boffset;/* off of inode in buffer */ } __attribute__((packed)) xfs_inode_log_format_32_t; -#endif typedef struct xfs_inode_log_format_64 { __uint16_t ilf_type; /* inode log item type */
include/xfs_log.h +42 -28
143 lines not on this page · raw message
include/xfs_log_priv.h +253 -78
446 lines not on this page · raw message
include/xfs_log_recover.h +12 -13
@@ -28,29 +28,28 @@#define XLOG_RHASH (tid) \ ((((__uint32_t)tid)>>XLOG_RHASH_SHIFT) & (XLOG_RHASH_SIZE-1)) -#define XLOG_MAX_REGIONS_IN_ITEM (XFS_MAX_BLOCKSIZE / XFS_BLI_CHUNK / 2 + 1) +#define XLOG_MAX_REGIONS_IN_ITEM (XFS_MAX_BLOCKSIZE / XFS_BLF_CHUNK / 2 + 1)/* * item headers are in ri_buf[0]. Additional buffers follow. */ typedef struct xlog_recover_item { -struct xlog_recover_item *ri_next; -struct xlog_recover_item *ri_prev; -int ri_type; -int ri_cnt;/* count of regions found */ -int ri_total;/* total regions */ -xfs_log_iovec_t *ri_buf;/* ptr to regions buffer */ +struct list_head ri_list; +int ri_type; +int ri_cnt;/* count of regions found */ +int ri_total;/* total regions */ +xfs_log_iovec_t *ri_buf;/* ptr to regions buffer */ }xlog_recover_item_t ;struct xlog_tid ;typedef struct xlog_recover { -struct xlog_recover *r_next; -xlog_tid_t r_log_tid;/* log's transaction id */ -xfs_trans_header_t r_theader;/* trans header for partial */ -int r_state;/* not needed */ -xfs_lsn_t r_lsn;/* xact lsn */ -xlog_recover_item_t *r_itemq;/* q for items */ +struct hlist_node r_list; +xlog_tid_t r_log_tid;/* log's transaction id */ +xfs_trans_header_t r_theader;/* trans header for partial */ +int r_state;/* not needed */ +xfs_lsn_t r_lsn;/* xact lsn */ +struct list_head r_itemq;/* q for items */ }xlog_recover_t ;#define ITEM_TYPE (i) (*(ushort *)(i)->ri_buf[0].i_addr)
include/xfs_trace.h new file +9 -0
@@ -0,0 +1,9 @@ +#ifndef __TRACE_H__ +#define __TRACE_H__ + +#define trace_xfs_log_recover_item_reorder_head (a,b,c,d) ((void) 0) +#define trace_xfs_log_recover_item_reorder_tail (a,b,c,d) ((void) 0) +#define trace_xfs_log_recover_item_add_cont (a,b,c,d) ((void) 0) +#define trace_xfs_log_recover_item_add (a,b,c,d) ((void) 0) + +#endif /* __TRACE_H__ */
include/xfs_trans.h +84 -564
810 lines not on this page · raw message
include/xfs_types.h +2 -0
@@ -81,6 +81,8 @@ typedef __int32_t xfs_tid_t; /* transaction identifier */typedef __uint32_t xfs_dablk_t ;/* dir/attr block number (in file) */ typedef __uint32_t xfs_dahash_t ;/* dir/attr hash value */ +typedef __uint32_t xlog_tid_t ;/* transaction ID type */ +/* * These types are 64 bits on disk but are either 32 or 64 bits in memory. * Disk based types:
libxfs/logitem.c +14 -351
378 lines not on this page · raw message
libxfs/trans.c +63 -146
389 lines not on this page · raw message
libxfs/xfs.h +3 -9
@@ -108,8 +108,6 @@ typedef __uint32_t inst_t; /* an instruction */#define PAGE_CACHE_SIZE getpagesize() -#define INIT_LIST_HEAD (x) -static inline int __do_div (unsigned long long *n,unsigned base) {int __res;
@@ -329,10 +327,9 @@ void xfs_mount_common(xfs_mount_t *, xfs_sb_t *);*/ /* xfs_trans_item.c */ -xfs_log_item_desc_t *xfs_trans_add_item (xfs_trans_t *,xfs_log_item_t *); -xfs_log_item_desc_t *xfs_trans_find_item (xfs_trans_t *,xfs_log_item_t *); -void xfs_trans_free_item (xfs_trans_t *,xfs_log_item_desc_t *); -void xfs_trans_free_items (xfs_trans_t *,int ); +void xfs_trans_add_item (struct xfs_trans *,struct xfs_log_item *); +void xfs_trans_del_item (struct xfs_log_item *); +void xfs_trans_free_items (struct xfs_trans *,int );/* xfs_inode_item.c */ void xfs_inode_item_init (xfs_inode_t *,xfs_mount_t *);
@@ -344,10 +341,7 @@ void xfs_buf_item_log (xfs_buf_log_item_t *, uint, uint);/* xfs_trans_buf.c */ 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 *,xfs_buftarg_t *, -xfs_daddr_t ,int );/* local source files */ int xfs_mod_incore_sb (xfs_mount_t *,xfs_sb_field_t ,int64_t ,int );void xfs_trans_mod_sb (xfs_trans_t *,uint ,long ); -int xfs_trans_unlock_chunk (xfs_log_item_chunk_t *,int ,int ,xfs_lsn_t );
libxfs/xfs_mount.c +0 -1
@@ -270,7 +270,6 @@ xfs_mount_common(xfs_mount_t *mp, xfs_sb_t *sbp) mp->m_blockmask = sbp->sb_blocksize -1 ; mp->m_blockwsize = sbp->sb_blocksize >>XFS_WORDLOG ; mp->m_blockwmask = mp->m_blockwsize -1 ; -INIT_LIST_HEAD (&mp->m_del_inodes);/* * Setup for attributes, in case they get created.
libxfs/xfs_trans.c +446 -46
311 lines not on this page · raw message
libxlog/xfs_log_recover.c +328 -278
606 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 6 lines
1.7.2.3 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Part of the diff is not shown here. View the raw message.
PATCH 3/3 libxfs: sync files with 2.6.38 kernel code
In reply to Dave ChinnerBring the libxfs headers and code into sync with the 2.6.37 kernel code. Update the rest of xfsprogs to work with the new code.
Note: this does not convert xfsprogs to the kernel xfs_trans_ijoin\ijoin_ref interface, it maintains the older ijoin/ihold interface because of the different way the inode reference counting works in libxfs. More work will be needed to change it over to a manner compatible with the current kernel API.
Note: log sector size handling needs to be sorted out. Specifically, initialising l_sectbb_log/l_sectBBsize correctly and removing the hacks in xlog_bread and friends (libxlog/xfs_log_recover.c) to work around the fact they are not initialised correctly. (FWIW, I don't think xfsprogs handles large log sector size correctly as a result, and especially not if the log device sector size is different to the data device sector size).
Testing:
Currently passes xfstests on x86_64 w/ 4k block sizes and 512 byte block/2k directory block filesystems. No obvious regressions are occurring during xfstests runs.
--- db/attr.c | 16 +- db/attrset.c | 5 +- db/bmap.c | 18 +- db/bmap.h | 4 +- db/check.c | 50 +- db/convert.c | 6 +- db/dir2sf.c | 6 +- db/field.c | 2 +- db/frag.c | 6 +- db/inode.c | 124 ++-- db/metadump.c | 20 +- include/libxfs.h | 26 +- include/xfs_ag.h | 100 ++- include/xfs_alloc.h | 58 +- include/xfs_arch.h | 32 - include/xfs_attr_leaf.h | 12 - include/xfs_attr_sf.h | 42 +- include/xfs_bit.h | 10 +- include/xfs_bmap.h | 133 ++-- include/xfs_bmap_btree.h | 20 +- include/xfs_btree.h | 31 +- include/xfs_btree_trace.h | 17 - include/xfs_da_btree.h | 21 +- include/xfs_dfrag.h | 5 +- include/xfs_dinode.h | 149 ++--- include/xfs_dir2.h | 4 +- include/xfs_dir2_data.h | 2 +- include/xfs_dir2_node.h | 2 - include/xfs_dir2_sf.h | 7 - include/xfs_fs.h | 30 +- include/xfs_ialloc.h | 30 +- include/xfs_ialloc_btree.h | 23 +- include/xfs_imap.h | 38 - include/xfs_inode.h | 210 +++--- include/xfs_inode_item.h | 30 +- include/xfs_inum.h | 1 - include/xfs_mount.h | 259 ++----- include/xfs_quota.h | 160 ++-- include/xfs_rtalloc.h | 19 +- include/xfs_sb.h | 168 +++-- include/xfs_trace.h | 76 ++ include/xfs_trans_space.h | 2 +- include/xfs_types.h | 16 +- libxfs/init.c | 133 +++- libxfs/logitem.c | 6 +- libxfs/trans.c | 2 +- libxfs/util.c | 75 +- libxfs/xfs.h | 37 +- libxfs/xfs_alloc.c | 599 ++++++++-------- libxfs/xfs_alloc_btree.c | 46 +- libxfs/xfs_attr.c | 138 ++-- libxfs/xfs_attr_leaf.c | 135 ++-- libxfs/xfs_bmap.c | 1773 ++++++++++++++++++++++---------------------- libxfs/xfs_bmap_btree.c | 129 ++-- libxfs/xfs_btree.c | 96 ++- libxfs/xfs_da_btree.c | 48 +- libxfs/xfs_dir2.c | 31 +- libxfs/xfs_dir2_block.c | 28 +- libxfs/xfs_dir2_leaf.c | 21 +- libxfs/xfs_dir2_node.c | 29 +- libxfs/xfs_dir2_sf.c | 24 +- libxfs/xfs_ialloc.c | 1157 +++++++++++++++-------------- libxfs/xfs_ialloc_btree.c | 35 +- libxfs/xfs_inode.c | 277 ++++---- libxfs/xfs_mount.c | 122 +--- logprint/log_misc.c | 2 +- mkfs/proto.c | 18 +- mkfs/xfs_mkfs.c | 3 +- repair/attr_repair.c | 14 +- repair/dino_chunks.c | 12 +- repair/dinode.c | 275 ++++---- repair/dir.c | 18 +- repair/dir2.c | 22 +- repair/incore.h | 3 + repair/phase6.c | 76 +- repair/prefetch.c | 29 +- repair/rt.c | 2 +- 77 files changed, 3587 insertions(+), 3818 deletions(-) delete mode 100644 include/xfs_imap.h
db/attr.c +8 -8
@@ -219,7 +219,7 @@ attr_leaf_name_local_name_count( e = &block->entries[i];if (be16_to_cpu (e->nameidx) == off) {if (e->flags &XFS_ATTR_LOCAL ) { - l =XFS_ATTR_LEAF_NAME_LOCAL (block, i); + l =xfs_attr_leaf_name_local (block, i);return l->namelen; }else return 0 ;
@@ -248,7 +248,7 @@ attr_leaf_name_local_value_count( e = &block->entries[i];if (be16_to_cpu (e->nameidx) == off) {if (e->flags &XFS_ATTR_LOCAL ) { - l =XFS_ATTR_LEAF_NAME_LOCAL (block, i); + l =xfs_attr_leaf_name_local (block, i);return be16_to_cpu (l->valuelen); }else return 0 ;
@@ -285,7 +285,7 @@ attr_leaf_name_local_value_offset(if (i >=be16_to_cpu (block->hdr.count))return 0 ; - l =XFS_ATTR_LEAF_NAME_LOCAL (block, i); + l =xfs_attr_leaf_name_local (block, i); vp = (char *)&l->nameval[l->namelen];return (int )bitize (vp - (char *)l); }
@@ -333,7 +333,7 @@ attr_leaf_name_remote_name_count( e = &block->entries[i];if (be16_to_cpu (e->nameidx) == off) {if (!(e->flags &XFS_ATTR_LOCAL )) { - r =XFS_ATTR_LEAF_NAME_REMOTE (block, i); + r =xfs_attr_leaf_name_remote (block, i);return r->namelen; }else return 0 ;
@@ -360,12 +360,12 @@ attr_leaf_name_size(return 0 ; e = &block->entries[idx];if (e->flags &XFS_ATTR_LOCAL ) { - l =XFS_ATTR_LEAF_NAME_LOCAL (block, idx); -return (int )bitize (XFS_ATTR_LEAF_ENTSIZE_LOCAL (l->namelen, + l =xfs_attr_leaf_name_local (block, idx); +return (int )bitize (xfs_attr_leaf_entsize_local (l->namelen,be16_to_cpu (l->valuelen))); }else { - r =XFS_ATTR_LEAF_NAME_REMOTE (block, idx); -return (int )bitize (XFS_ATTR_LEAF_ENTSIZE_REMOTE (r->namelen)); + r =xfs_attr_leaf_name_remote (block, idx); +return (int )bitize (xfs_attr_leaf_entsize_remote (r->namelen)); } }
db/attrset.c +3 -2
@@ -158,7 +158,8 @@ attr_set_f( goto out; } -if (libxfs_attr_set (ip, name, value, valuelen, flags)) { +if (libxfs_attr_set (ip, (unsigned char *)name, + (unsigned char *)value, valuelen, flags)) {dbprintf (_ ("failed to set attr %s on inode %llu\n" ), name, (unsigned long long )iocur_top->ino); goto out;
@@ -233,7 +234,7 @@ attr_remove_f( goto out; } -if (libxfs_attr_remove (ip, name, flags)) { +if (libxfs_attr_remove (ip, (unsigned char *)name, flags)) {dbprintf (_ ("failed to remove attr %s from inode %llu\n" ), name, (unsigned long long )iocur_top->ino); goto out;
db/bmap.c +9 -9
@@ -29,7 +29,7 @@#include "init.h" static int bmap_f (int argc,char **argv); -static int bmap_one_extent (xfs_bmbt_rec_64_t *ep, +static int bmap_one_extent (xfs_bmbt_rec_t *ep,xfs_dfiloff_t *offp,xfs_dfiloff_t eoff,int *idxp,bmap_ext_t *bep); static xfs_fsblock_t select_child(xfs_dfiloff_t off, xfs_bmbt_key_t *kp,
@@ -52,7 +52,7 @@ bmap(xfs_dfiloff_t curoffset;xfs_dinode_t *dip;xfs_dfiloff_t eoffset; -xfs_bmbt_rec_64_t *ep; +xfs_bmbt_rec_t *ep;xfs_dinode_fmt_t fmt;int fsize;xfs_bmbt_key_t *kp;
@@ -63,7 +63,7 @@ bmap(xfs_bmbt_ptr_t *pp;xfs_bmdr_block_t *rblock;typnm_t typ; -xfs_bmbt_rec_64_t *xp; +xfs_bmbt_rec_t *xp;push_cur ();set_cur_inode (iocur_top->ino);
@@ -81,7 +81,7 @@ bmap( fmt == XFS_DINODE_FMT_BTREE);if (fmt ==XFS_DINODE_FMT_EXTENTS ) { nextents =XFS_DFORK_NEXTENTS (dip, whichfork); - xp = (xfs_bmbt_rec_64_t *)XFS_DFORK_PTR (dip, whichfork); + xp = (xfs_bmbt_rec_t *)XFS_DFORK_PTR (dip, whichfork);for (ep = xp; ep < &xp[nextents] && n < nex; ep++) {if (!bmap_one_extent (ep, &curoffset, eoffset, &n, bep))break ;
@@ -110,7 +110,7 @@ bmap( for (;;) { nextbno = be64_to_cpu(block->bb_u.l.bb_rightsib); nextents = be16_to_cpu(block->bb_numrecs); - xp = (xfs_bmbt_rec_64_t *) + xp = (xfs_bmbt_rec_t *) XFS_BMBT_REC_ADDR(mp, block, 1); for (ep = xp; ep < &xp[nextents] && n < nex; ep++) { if (!bmap_one_extent(ep, &curoffset, eoffset,
@@ -171,9 +171,9 @@ bmap_f(push_cur ();set_cur_inode (iocur_top->ino); dip = iocur_top->data; -if (be32_to_cpu (dip->di_core.di_nextents)) +if (be32_to_cpu (dip->di_nextents)) dfork =1 ; -if (be16_to_cpu (dip->di_core.di_anextents)) +if (be16_to_cpu (dip->di_anextents)) afork =1 ;pop_cur (); }
@@ -233,7 +233,7 @@ bmap_init(void) static int bmap_one_extent( - xfs_bmbt_rec_64_t *ep, + xfs_bmbt_rec_t *ep, xfs_dfiloff_t *offp, xfs_dfiloff_t eoff, int *idxp,
@@ -271,7 +271,7 @@ bmap_one_extent( void convert_extent( - xfs_bmbt_rec_64_t *rp, + xfs_bmbt_rec_t *rp, xfs_dfiloff_t *op, xfs_dfsbno_t *sp, xfs_dfilblks_t *cp,
db/bmap.h +2 -2
@@ -17,7 +17,7 @@*/ struct bbmap ; -struct xfs_bmbt_rec_64 ; +struct xfs_bmbt_rec ; typedef struct bmap_ext { xfs_dfiloff_t startoff;
@@ -29,6 +29,6 @@ typedef struct bmap_ext {extern void bmap (xfs_dfiloff_t offset,xfs_dfilblks_t len,int whichfork,int *nexp,bmap_ext_t *bep);extern void bmap_init (void ); -extern void convert_extent (struct xfs_bmbt_rec_64 *rp,xfs_dfiloff_t *op, +extern void convert_extent (struct xfs_bmbt_rec *rp,xfs_dfiloff_t *op,xfs_dfsbno_t *sp,xfs_dfilblks_t *cp,int *fp);extern void make_bbmap (struct bbmap *bbmap,int nex,bmap_ext_t *bmp);
db/check.c +25 -25
139 lines not on this page · raw message
db/convert.c +3 -3
@@ -210,14 +210,14 @@ convert_f(int argc, char **argv) }switch (wtype) {case CT_AGBLOCK : - v =XFS_DADDR_TO_AGBNO (mp, v >>BBSHIFT ); + v =xfs_daddr_to_agbno (mp, v >>BBSHIFT );break ;case CT_AGINO : v = (v >> mp->m_sb.sb_inodelog) % (mp->m_sb.sb_agblocks << mp->m_sb.sb_inopblog);break ;case CT_AGNUMBER : - v =XFS_DADDR_TO_AGNO (mp, v >>BBSHIFT ); + v =xfs_daddr_to_agno (mp, v >>BBSHIFT );break ;case CT_BBOFF : v &=BBMASK ;
@@ -234,7 +234,7 @@ convert_f(int argc, char **argv) v =XFS_DADDR_TO_FSB (mp, v >>BBSHIFT );break ;case CT_INO : - v =XFS_AGINO_TO_INO (mp,XFS_DADDR_TO_AGNO (mp, v >>BBSHIFT ), + v =XFS_AGINO_TO_INO (mp,xfs_daddr_to_agno (mp, v >>BBSHIFT ), (v >> mp->m_sb.sb_inodelog) % (mp->m_sb.sb_agblocks << mp->m_sb.sb_inopblog));break ;
db/dir2sf.c +3 -3
@@ -76,7 +76,7 @@ dir2_inou_i4_count(xfs_dir2_sf_t *sf;ASSERT (bitoffs (startoff) ==0 ); - sf = &((xfs_dinode_t *)obj)->di_u.di_dir2sf; + sf = (xfs_dir2_sf_t *)XFS_DFORK_DPTR (obj);return sf->hdr.i8count ==0 ; }
@@ -89,7 +89,7 @@ dir2_inou_i8_count(xfs_dir2_sf_t *sf;ASSERT (bitoffs (startoff) ==0 ); - sf = &((xfs_dinode_t *)obj)->di_u.di_dir2sf; + sf = (xfs_dir2_sf_t *)XFS_DFORK_DPTR (obj);return sf->hdr.i8count !=0 ; }
@@ -104,7 +104,7 @@ dir2_inou_size(ASSERT (bitoffs (startoff) ==0 );ASSERT (idx ==0 ); - sf = &((xfs_dinode_t *)obj)->di_u.di_dir2sf; + sf = (xfs_dir2_sf_t *)XFS_DFORK_DPTR (obj);return bitize (sf->hdr.i8count ? (uint )sizeof (xfs_dir2_ino8_t) : (uint )sizeof (xfs_dir2_ino4_t));
db/field.c +1 -1
@@ -151,7 +151,7 @@ const ftattr_t ftattrtab[] = { {FLDT_DINODE_A ,"dinode_a" ,NULL , (char *)inode_a_flds, inode_a_size, FTARG_SIZE|FTARG_OKEMPTY, NULL, inode_a_flds }, { FLDT_DINODE_CORE, "dinode_core", NULL, (char *)inode_core_flds, - SI(bitsz(xfs_dinode_core_t)), 0, NULL, inode_core_flds }, + SI(bitsz(xfs_dinode_t)), 0, NULL, inode_core_flds }, { FLDT_DINODE_FMT, "dinode_fmt", fp_dinode_fmt, NULL, SI(bitsz(__int8_t)), 0, NULL, NULL }, { FLDT_DINODE_U, "dinode_u", NULL, (char *)inode_u_flds, inode_u_size,
db/frag.c +2 -4
@@ -307,20 +307,18 @@ process_inode( xfs_dinode_t *dip) {__uint64_t actual; -xfs_dinode_core_t *dic;__uint64_t ideal;xfs_ino_t ino;int skipa;int skipd; - dic = &dip->di_core; ino =XFS_AGINO_TO_INO (mp,be32_to_cpu (agf->agf_seqno), agino); -switch (be16_to_cpu (dic->di_mode) &S_IFMT ) { +switch (be16_to_cpu (dip->di_mode) &S_IFMT ) {case S_IFDIR : skipd = !dflag;break ;case S_IFREG : -if (!rflag && (be16_to_cpu (dic->di_flags) &XFS_DIFLAG_REALTIME )) +if (!rflag && (be16_to_cpu (dip->di_flags) &XFS_DIFLAG_REALTIME )) skipd =1 ; else if (!Rflag && (ino == mp->m_sb.sb_rbmino ||
db/inode.c +70 -54
285 lines not on this page · raw message
db/metadump.c +11 -9
@@ -502,8 +502,8 @@ obfuscate_sf_dir(__uint64_t ino_dir_size;int i; - sfp = &dip->di_u.di_dir2sf; - ino_dir_size =be64_to_cpu (dip->di_core.di_size); + sfp = (xfs_dir2_sf_t *)XFS_DFORK_DPTR (dip); + ino_dir_size =be64_to_cpu (dip->di_size);if (ino_dir_size >XFS_DFORK_DSIZE (dip, mp)) { ino_dir_size =XFS_DFORK_DSIZE (dip, mp);if (show_warnings)
@@ -555,8 +555,9 @@ obfuscate_sf_symlink( xfs_dinode_t *dip) {__uint64_t len; +char *buf; - len =be64_to_cpu (dip->di_core.di_size); + len =be64_to_cpu (dip->di_size);if (len >XFS_DFORK_DSIZE (dip, mp)) {if (show_warnings) print_warning("invalid size (%d) in symlink inode %llu",
@@ -564,8 +565,9 @@ obfuscate_sf_symlink( len =XFS_DFORK_DSIZE (dip, mp); } + buf = (char *)XFS_DFORK_DPTR (dip);while (len >0 ) - dip->di_u.di_symlink[--len] =random () %127 +1 ; + buf[--len] =random () %127 +1 ; } static void
@@ -841,7 +843,7 @@ obfuscate_attr_blocks(break ; }if (entry->flags &XFS_ATTR_LOCAL ) { - local =XFS_ATTR_LEAF_NAME_LOCAL (leaf, i); + local =xfs_attr_leaf_name_local (leaf, i);if (local->namelen ==0 ) {if (show_warnings) print_warning("zero length for "
@@ -854,7 +856,7 @@ obfuscate_attr_blocks(memset (&local->nameval[local->namelen],0 ,be16_to_cpu (local->valuelen)); }else { - remote =XFS_ATTR_LEAF_NAME_REMOTE (leaf, i); + remote =xfs_attr_leaf_name_remote (leaf, i);if (remote->namelen ==0 || remote->valueblk ==0 ) {if (show_warnings)
@@ -1143,7 +1145,7 @@ process_inode_data( xfs_dinode_t *dip, typnm_t itype) { -switch (dip->di_core.di_format) { +switch (dip->di_format) {case XFS_DINODE_FMT_LOCAL :if (!dont_obfuscate)switch (itype) {
@@ -1180,7 +1182,7 @@ process_inode( cur_ino =XFS_AGINO_TO_INO (mp, agno, agino);/* copy appropriate data fork metadata */ -switch (be16_to_cpu (dip->di_core.di_mode) &S_IFMT ) { +switch (be16_to_cpu (dip->di_mode) &S_IFMT ) {case S_IFDIR :memset (&dir_data,0 ,sizeof (dir_data)); success =process_inode_data (dip,TYP_DIR2 );
@@ -1198,7 +1200,7 @@ process_inode(/* copy extended attributes if they exist and forkoff is valid */ if (success &&XFS_DFORK_DSIZE (dip, mp) <XFS_LITINO (mp)) { attr_data.remote_val_count =0 ; -switch (dip->di_core.di_aformat) { +switch (dip->di_aformat) {case XFS_DINODE_FMT_LOCAL :if (!dont_obfuscate)obfuscate_sf_attr (dip);
include/libxfs.h +17 -9
@@ -172,7 +172,7 @@ typedef struct xfs_mount {uint m_ag_maxlevels;/* XFS_AG_MAXLEVELS */ uint m_bm_maxlevels[2 ];/* XFS_BM_MAXLEVELS */ uint m_in_maxlevels;/* XFS_IN_MAXLEVELS */ -xfs_perag_t *m_perag;/* per-ag accounting info */ +struct radix_tree_root m_perag_tree;uint m_flags;/* global mount flags */ uint m_qflags;/* quota status flags */ uint m_attroffset;/* inode attribute offset */
@@ -380,6 +380,7 @@ extern int libxfs_trans_iget (xfs_mount_t *, xfs_trans_t *, xfs_ino_t,extern void libxfs_trans_iput (xfs_trans_t *,struct xfs_inode *,uint );extern void libxfs_trans_ijoin (xfs_trans_t *,struct xfs_inode *,uint );extern void libxfs_trans_ihold (xfs_trans_t *,struct xfs_inode *); +extern void libxfs_trans_ijoin_ref (xfs_trans_t *,struct xfs_inode *,int );extern void libxfs_trans_log_inode (xfs_trans_t *,struct xfs_inode *,uint );
@@ -402,10 +403,8 @@ typedef struct xfs_inode {struct cache_node i_node;xfs_mount_t *i_mount;/* fs mount struct ptr */ xfs_ino_t i_ino;/* inode number (agno/agino) */ -xfs_daddr_t i_blkno;/* blkno of inode buffer */ +struct xfs_imap i_imap;/* location for xfs_imap() */ dev_t i_dev;/* dev for this inode */ -ushort i_len;/* len of inode buffer */ -ushort i_boffset;/* off of inode in buffer */ xfs_ifork_t *i_afp;/* attribute fork pointer */ xfs_ifork_t i_df;/* data fork */ xfs_trans_t *i_transp;/* ptr to owning transaction */
@@ -430,7 +429,8 @@ extern int libxfs_inode_alloc (xfs_trans_t **, xfs_inode_t *, mode_t, struct fsxattr *, xfs_inode_t **); extern void libxfs_trans_inode_alloc_buf (xfs_trans_t *, xfs_buf_t *); -extern void libxfs_ichgtime (xfs_inode_t *,int ); +extern void libxfs_trans_ichgtime (struct xfs_trans *, +struct xfs_inode *,int );extern int libxfs_iflush_int (xfs_inode_t *,xfs_buf_t *);extern int libxfs_iread (xfs_mount_t *,xfs_trans_t *,xfs_ino_t ,xfs_inode_t *,xfs_daddr_t );
@@ -443,6 +443,9 @@ extern int libxfs_iget (xfs_mount_t *, xfs_trans_t *, xfs_ino_t, uint, xfs_inode_t **, xfs_daddr_t);extern void libxfs_iput (xfs_inode_t *,uint ); +extern int xfs_imap_to_bp (xfs_mount_t *mp,xfs_trans_t *tp,struct xfs_imap *imap, +xfs_buf_t **bpp,uint buf_flags,uint iget_flags); +#include <xfs/xfs_dir_leaf.h> /* dirv1 support in db & repair */ #include <xfs/xfs_dir2_data.h> #include <xfs/xfs_dir2_leaf.h>
@@ -478,12 +481,14 @@ extern unsigned long libxfs_physmem(void); /* in kilobytes */#include <xfs/xfs_attr_leaf.h> #include <xfs/xfs_quota.h> #include <xfs/xfs_trans_space.h> -#include <xfs/xfs_imap.h> #include <xfs/xfs_log.h> #include <xfs/xfs_log_priv.h> +#define XFS_INOBT_CLR_FREE (rp,i) ((rp)->ir_free &= ~XFS_INOBT_MASK(i)) +#define XFS_INOBT_SET_FREE (rp,i) ((rp)->ir_free |= XFS_INOBT_MASK(i))#define XFS_INOBT_IS_FREE_DISK (rp,i) \ ((be64_to_cpu((rp)->ir_free) & XFS_INOBT_MASK(i)) != 0) +/* * public xfs kernel routines to be called as libxfs_* */
@@ -492,14 +497,17 @@ extern unsigned long libxfs_physmem(void); /* in kilobytes */int libxfs_alloc_fix_freelist (xfs_alloc_arg_t *,int );/* xfs_attr.c */ -int libxfs_attr_get (struct xfs_inode *,const char *,char *,int *,int ); -int libxfs_attr_set (struct xfs_inode *,const char *,char *,int ,int ); -int libxfs_attr_remove (struct xfs_inode *,const char *,int ); +int libxfs_attr_get (struct xfs_inode *,const unsigned char *, +unsigned char *,int *,int ); +int libxfs_attr_set (struct xfs_inode *,const unsigned char *, +unsigned char *,int ,int ); +int libxfs_attr_remove (struct xfs_inode *,const unsigned char *,int );/* xfs_bmap.c */ xfs_bmbt_rec_host_t *xfs_bmap_search_extents (xfs_inode_t *,xfs_fileoff_t ,int ,int *,xfs_extnum_t *,xfs_bmbt_irec_t *,xfs_bmbt_irec_t *); +void xfs_bmbt_disk_get_all (xfs_bmbt_rec_t *r,xfs_bmbt_irec_t *s);/* xfs_attr_leaf.h */ #define libxfs_attr_leaf_newentsize xfs_attr_leaf_newentsize
include/xfs_ag.h +74 -26
162 lines not on this page · raw message
include/xfs_alloc.h +27 -31
84 lines not on this page · raw message
include/xfs_arch.h +0 -32
@@ -73,28 +73,6 @@ static inline void be64_add_cpu(__be64 *a, __s64 b)#endif /* __KERNEL__ */ -/* do we need conversion? */ -#define ARCH_NOCONVERT 1 -#ifdef XFS_NATIVE_HOST -# define ARCH_CONVERT ARCH_NOCONVERT -#else -# define ARCH_CONVERT 0 -#endif - -/* generic swapping macros */ - -#ifndef HAVE_SWABMACROS -#define INT_SWAP16 (type,var) ((typeof(type))(__swab16((__u16)(var)))) -#define INT_SWAP32 (type,var) ((typeof(type))(__swab32((__u32)(var)))) -#define INT_SWAP64 (type,var) ((typeof(type))(__swab64((__u64)(var)))) -#endif - -#define INT_SWAP (type, var) \ - ((sizeof(type) == 8) ? INT_SWAP64(type,var) : \ - ((sizeof(type) == 4) ? INT_SWAP32(type,var) : \ - ((sizeof(type) == 2) ? INT_SWAP16(type,var) : \ - (var)))) -/* * get and set integers from potentially unaligned locations */
@@ -107,16 +85,6 @@ static inline void be64_add_cpu(__be64 *a, __s64 b) ((__u8 *)(pointer))[1 ] = (((value) ) &0xff ); \ } -/* does not return a value */ -#define INT_SET (reference,arch,valueref) \ - (__builtin_constant_p(valueref) ? \ - (void)( (reference) = ( ((arch) != ARCH_NOCONVERT) ? (INT_SWAP((reference),(valueref))) : (valueref)) ) : \ - (void)( \ - ((reference) = (valueref)), \ - ( ((arch) != ARCH_NOCONVERT) ? (reference) = INT_SWAP((reference),(reference)) : 0 ) \ - ) \ - ) -/* * In directories inode numbers are stored as unaligned arrays of unsigned * 8bit integers on disk.
include/xfs_attr_leaf.h +0 -12
@@ -151,8 +151,6 @@ typedef struct xfs_attr_leafblock {/* * Cast typed pointers for "local" and "remote" name/value structs. */ -#define XFS_ATTR_LEAF_NAME_REMOTE (leafp,idx) \ - xfs_attr_leaf_name_remote(leafp,idx)static inline xfs_attr_leaf_name_remote_t *xfs_attr_leaf_name_remote (xfs_attr_leafblock_t *leafp,int idx) {
@@ -160,8 +158,6 @@ xfs_attr_leaf_name_remote(xfs_attr_leafblock_t *leafp, int idx) &((char *)leafp)[be16_to_cpu (leafp->entries[idx].nameidx)]; } -#define XFS_ATTR_LEAF_NAME_LOCAL (leafp,idx) \ - xfs_attr_leaf_name_local(leafp,idx)static inline xfs_attr_leaf_name_local_t *xfs_attr_leaf_name_local (xfs_attr_leafblock_t *leafp,int idx) {
@@ -169,8 +165,6 @@ xfs_attr_leaf_name_local(xfs_attr_leafblock_t *leafp, int idx) &((char *)leafp)[be16_to_cpu (leafp->entries[idx].nameidx)]; } -#define XFS_ATTR_LEAF_NAME (leafp,idx) \ - xfs_attr_leaf_name(leafp,idx)static inline char *xfs_attr_leaf_name (xfs_attr_leafblock_t *leafp,int idx) {return &((char *)leafp)[be16_to_cpu (leafp->entries[idx].nameidx)];
@@ -181,24 +175,18 @@ static inline char *xfs_attr_leaf_name(xfs_attr_leafblock_t *leafp, int idx)* a "local" name/value structure, a "remote" name/value structure, and * a pointer which might be either. */ -#define XFS_ATTR_LEAF_ENTSIZE_REMOTE (nlen) \ - xfs_attr_leaf_entsize_remote(nlen)static inline int xfs_attr_leaf_entsize_remote (int nlen) {return ((uint )sizeof (xfs_attr_leaf_name_remote_t) -1 + (nlen) + \XFS_ATTR_LEAF_NAME_ALIGN -1 ) & ~(XFS_ATTR_LEAF_NAME_ALIGN -1 ); } -#define XFS_ATTR_LEAF_ENTSIZE_LOCAL (nlen,vlen) \ - xfs_attr_leaf_entsize_local(nlen,vlen)static inline int xfs_attr_leaf_entsize_local (int nlen,int vlen) {return ((uint )sizeof (xfs_attr_leaf_name_local_t) -1 + (nlen) + (vlen) +XFS_ATTR_LEAF_NAME_ALIGN -1 ) & ~(XFS_ATTR_LEAF_NAME_ALIGN -1 ); } -#define XFS_ATTR_LEAF_ENTSIZE_LOCAL_MAX (bsize) \ - xfs_attr_leaf_entsize_local_max(bsize)static inline int xfs_attr_leaf_entsize_local_max (int bsize) {return (((bsize) >>1 ) + ((bsize) >>2 ));
include/xfs_attr_sf.h +1 -41
58 lines not on this page · raw message
include/xfs_bit.h +1 -9
@@ -23,24 +23,16 @@*/ /* -* masks with n high/low bits set, 32-bit values & 64-bit values +* masks with n high/low bits set, 64-bit values */ -#define XFS_MASK32HI (n) xfs_mask32hi(n) -static inline __uint32_t xfs_mask32hi (int n) -{ -return (__uint32_t)-1 << (32 - (n)); -} -#define XFS_MASK64HI (n) xfs_mask64hi(n)static inline __uint64_t xfs_mask64hi (int n) {return (__uint64_t)-1 << (64 - (n)); } -#define XFS_MASK32LO (n) xfs_mask32lo(n)static inline __uint32_t xfs_mask32lo (int n) {return ((__uint32_t )1 << (n)) -1 ; } -#define XFS_MASK64LO (n) xfs_mask64lo(n)static inline __uint64_t xfs_mask64lo (int n) {return ((__uint64_t )1 << (n)) -1 ;
include/xfs_bmap.h +67 -66
212 lines not on this page · raw message
include/xfs_bmap_btree.h +3 -17
@@ -46,20 +46,12 @@ typedef struct xfs_bmdr_block {#define BMBT_STARTBLOCK_BITLEN 52#define BMBT_BLOCKCOUNT_BITLEN 21 - -#define BMBT_USE_64 1 - -typedef struct xfs_bmbt_rec_32 -{ -__uint32_t l0, l1, l2, l3; -}xfs_bmbt_rec_32_t ; -typedef struct xfs_bmbt_rec_64 -{ +typedef struct xfs_bmbt_rec {__be64 l0, l1; -}xfs_bmbt_rec_64_t ; +}xfs_bmbt_rec_t ;typedef __uint64_t xfs_bmbt_rec_base_t ;/* use this for casts */ -typedef xfs_bmbt_rec_64_t xfs_bmbt_rec_t ,xfs_bmdr_rec_t ; +typedef xfs_bmbt_rec_t xfs_bmdr_rec_t ; typedef struct xfs_bmbt_rec_host { __uint64_t l0, l1;
@@ -76,26 +68,22 @@ typedef struct xfs_bmbt_rec_host {#define DSTARTBLOCKMASK \ (((((xfs_dfsbno_t)1) << DSTARTBLOCKMASKBITS) - 1) << STARTBLOCKVALBITS) -#define ISNULLSTARTBLOCK (x) isnullstartblock(x)static inline int isnullstartblock (xfs_fsblock_t x) {return ((x) &STARTBLOCKMASK ) ==STARTBLOCKMASK ; } -#define ISNULLDSTARTBLOCK (x) isnulldstartblock(x)static inline int isnulldstartblock (xfs_dfsbno_t x) {return ((x) &DSTARTBLOCKMASK ) ==DSTARTBLOCKMASK ; } -#define NULLSTARTBLOCK (k) nullstartblock(k)static inline xfs_fsblock_t nullstartblock (int k) {ASSERT (k < (1 <<STARTBLOCKVALBITS ));return STARTBLOCKMASK | (k); } -#define STARTBLOCKVAL (x) startblockval(x)static inline xfs_filblks_t startblockval (xfs_fsblock_t x) {return (xfs_filblks_t)((x) & ~STARTBLOCKMASK );
@@ -224,7 +212,6 @@ extern xfs_fsblock_t xfs_bmbt_get_startblock(xfs_bmbt_rec_host_t *r);extern xfs_fileoff_t xfs_bmbt_get_startoff (xfs_bmbt_rec_host_t *r);extern xfs_exntst_t xfs_bmbt_get_state (xfs_bmbt_rec_host_t *r); -extern void xfs_bmbt_disk_get_all (xfs_bmbt_rec_t *r,xfs_bmbt_irec_t *s);extern xfs_filblks_t xfs_bmbt_disk_get_blockcount (xfs_bmbt_rec_t *r);extern xfs_fileoff_t xfs_bmbt_disk_get_startoff (xfs_bmbt_rec_t *r);
@@ -236,7 +223,6 @@ extern void xfs_bmbt_set_startblock(xfs_bmbt_rec_host_t *r, xfs_fsblock_t v);extern void xfs_bmbt_set_startoff (xfs_bmbt_rec_host_t *r,xfs_fileoff_t v);extern void xfs_bmbt_set_state (xfs_bmbt_rec_host_t *r,xfs_exntst_t v); -extern void xfs_bmbt_disk_set_all (xfs_bmbt_rec_t *r,xfs_bmbt_irec_t *s);extern void xfs_bmbt_disk_set_allf (xfs_bmbt_rec_t *r,xfs_fileoff_t o,xfs_fsblock_t b,xfs_filblks_t c,xfs_exntst_t v);
include/xfs_btree.h +2 -29
@@ -41,7 +41,7 @@ extern kmem_zone_t *xfs_btree_cur_zone;/* * Generic btree header. * -* This is a comination of the actual format used on disk for short and long +* This is a combination of the actual format used on disk for short and long * format btrees. The first three fields are shared by both format, but * the pointers are different and should be used with care. *
@@ -152,9 +152,7 @@ struct xfs_btree_ops {/* update btree root pointer */ void (*set_root)(struct xfs_btree_cur *cur, -union xfs_btree_ptr *nptr,int level_change); -int (*kill_root)(struct xfs_btree_cur *cur,struct xfs_buf *bp, -int level,union xfs_btree_ptr *newroot); +union xfs_btree_ptr *nptr,int level_change);/* block allocation / freeing */ int (*alloc_block)(struct xfs_btree_cur *cur,
@@ -379,20 +377,6 @@ xfs_btree_read_bufl( int refval);/* ref count value for buffer *//* -* Get a buffer for the block, return it read in. -* Short-form addressing. -*/ -int /* error */ -xfs_btree_read_bufs ( -struct xfs_mount *mp,/* file system mount point */ -struct xfs_trans *tp,/* transaction pointer */ -xfs_agnumber_t agno,/* allocation group number */ -xfs_agblock_t agbno,/* allocation group block number */ -uint lock,/* lock flags for read_buf */ -struct xfs_buf **bpp,/* buffer for agno/agbno */ -int refval);/* ref count value for buffer */ - -/* * Read-ahead the block, don't wait for it, don't return a buffer. * Long-form addressing. */
@@ -413,16 +397,6 @@ xfs_btree_reada_bufs(xfs_agblock_t agbno,/* allocation group block number */ xfs_extlen_t count); /* count of filesystem blocks */ -/* -* Set the buffer for level "lev" in the cursor to bp, releasing -* any previous buffer. -*/ -void -xfs_btree_setbuf ( -xfs_btree_cur_t *cur,/* btree cursor */ -int lev,/* level in btree */ -struct xfs_buf *bp);/* new buffer to set */ -/* * Common btree core entry points.
@@ -432,7 +406,6 @@ int xfs_btree_decrement(struct xfs_btree_cur *, int, int *);int xfs_btree_lookup (struct xfs_btree_cur *,xfs_lookup_t ,int *);int xfs_btree_update (struct xfs_btree_cur *,union xfs_btree_rec *);int xfs_btree_new_iroot (struct xfs_btree_cur *,int *,int *); -int xfs_btree_kill_iroot (struct xfs_btree_cur *);int xfs_btree_insert (struct xfs_btree_cur *,int *);int xfs_btree_delete (struct xfs_btree_cur *,int *);int xfs_btree_get_rec (struct xfs_btree_cur *,union xfs_btree_rec **,int *);
include/xfs_btree_trace.h +0 -17
@@ -58,8 +58,6 @@ void xfs_btree_trace_argbi(const char *, struct xfs_btree_cur *, struct xfs_buf *, int, int);void xfs_btree_trace_argbii (const char *,struct xfs_btree_cur *,struct xfs_buf *,int ,int ,int ); -void xfs_btree_trace_argfffi (const char *,struct xfs_btree_cur *, -xfs_dfiloff_t ,xfs_dfsbno_t ,xfs_dfilblks_t ,int ,int );void xfs_btree_trace_argi (const char *,struct xfs_btree_cur *,int ,int );void xfs_btree_trace_argipk (const char *,struct xfs_btree_cur *,int ,union xfs_btree_ptr ,union xfs_btree_key *,int );
@@ -71,24 +69,10 @@ void xfs_btree_trace_argr(const char *, struct xfs_btree_cur *, union xfs_btree_rec *, int);void xfs_btree_trace_cursor (const char *,struct xfs_btree_cur *,int ,int ); - -#define XFS_ALLOCBT_TRACE_SIZE 4096/* size of global trace buffer */ -extern ktrace_t *xfs_allocbt_trace_buf; - -#define XFS_INOBT_TRACE_SIZE 4096/* size of global trace buffer */ -extern ktrace_t *xfs_inobt_trace_buf; - -#define XFS_BMBT_TRACE_SIZE 4096/* size of global trace buffer */ -#define XFS_BMBT_KTRACE_SIZE 32/* size of per-inode trace buffer */ -extern ktrace_t *xfs_bmbt_trace_buf; - -#define XFS_BTREE_TRACE_ARGBI (c, b, i) \ xfs_btree_trace_argbi(__func__, c, b, i, __LINE__)#define XFS_BTREE_TRACE_ARGBII (c, b, i, j) \ xfs_btree_trace_argbii(__func__, c, b, i, j, __LINE__) -#define XFS_BTREE_TRACE_ARGFFFI (c, o, b, i, j) \ - xfs_btree_trace_argfffi(__func__, c, o, b, i, j, __LINE__)#define XFS_BTREE_TRACE_ARGI (c, i) \ xfs_btree_trace_argi(__func__, c, i, __LINE__)#define XFS_BTREE_TRACE_ARGIPK (c, i, p, k) \
@@ -104,7 +88,6 @@ extern ktrace_t *xfs_bmbt_trace_buf;#else #define XFS_BTREE_TRACE_ARGBI (c, b, i)#define XFS_BTREE_TRACE_ARGBII (c, b, i, j) -#define XFS_BTREE_TRACE_ARGFFFI (c, o, b, i, j)#define XFS_BTREE_TRACE_ARGI (c, i)#define XFS_BTREE_TRACE_ARGIPK (c, i, p, s)#define XFS_BTREE_TRACE_ARGIPR (c, i, p, r)
include/xfs_da_btree.h +15 -6
@@ -91,9 +91,9 @@ enum xfs_dacmp {* Structure to ease passing around component names. */ typedef struct xfs_da_args { - const uchar_t *name; /* string (maybe not NULL terminated) */ + const __uint8_t *name; /* string (maybe not NULL terminated) */ int namelen; /* length of string (maybe no NULL) */ - uchar_t *value; /* set of bytes (maybe contain NULLs) */ + __uint8_t *value; /* set of bytes (maybe contain NULLs) */ int valuelen; /* length of value */ int flags; /* argument flags (eg: ATTR_NOCREATE) */ xfs_dahash_t hashval; /* hash value of name */
@@ -125,6 +125,13 @@ typedef struct xfs_da_args {#define XFS_DA_OP_OKNOENT 0x0008/* lookup/add op, ENOENT ok, else die */ #define XFS_DA_OP_CILOOKUP 0x0010/* lookup to return CI name if found */ +#define XFS_DA_OP_FLAGS \ + { XFS_DA_OP_JUSTCHECK, "JUSTCHECK" }, \ + { XFS_DA_OP_RENAME, "RENAME" }, \ + { XFS_DA_OP_ADDNAME, "ADDNAME" }, \ + { XFS_DA_OP_OKNOENT, "OKNOENT" }, \ + { XFS_DA_OP_CILOOKUP, "CILOOKUP" } +/* * Structure to describe buffer(s) for a block. * This is needed in the directory version 2 format case, when
@@ -185,7 +192,7 @@ typedef struct xfs_da_state {unsigned char inleaf;/* insert into 1->lf, 0->splf */ unsigned char extravalid;/* T/F: extrablk is in use */ unsigned char extraafter;/* T/F: extrablk is after new */ -xfs_da_state_blk_t extrablk;/* for double-splits on leafs */ +xfs_da_state_blk_t extrablk;/* for double-splits on leaves */ /* for dirv2 extrablk is data */ } xfs_da_state_t;
@@ -202,7 +209,8 @@ typedef struct xfs_da_state {*/ struct xfs_nameops {xfs_dahash_t (*hashname)(struct xfs_name *); -enum xfs_dacmp (*compname)(struct xfs_da_args *,const char *,int ); +enum xfs_dacmp (*compname)(struct xfs_da_args *, +const unsigned char *,int ); };
@@ -251,9 +259,9 @@ xfs_daddr_t xfs_da_reada_buf(struct xfs_trans *trans, struct xfs_inode *dp,int xfs_da_shrink_inode (xfs_da_args_t *args,xfs_dablk_t dead_blkno,xfs_dabuf_t *dead_buf); -uint xfs_da_hashname (const uchar_t *name_string,int name_length); +uint xfs_da_hashname (const __uint8_t *name_string,int name_length);enum xfs_dacmp xfs_da_compname (struct xfs_da_args *args, -const char *name,int len); +const unsigned char *name,int len);xfs_da_state_t *xfs_da_state_alloc (void );
@@ -268,5 +276,6 @@ xfs_daddr_t xfs_da_blkno(xfs_dabuf_t *dabuf);extern struct kmem_zone *xfs_da_state_zone;extern struct kmem_zone *xfs_dabuf_zone; +extern const struct xfs_nameops xfs_default_nameops;#endif /* __XFS_DA_BTREE_H__ */
include/xfs_dfrag.h +1 -4
@@ -46,10 +46,7 @@ typedef struct xfs_swapext/* * Syscall interface for xfs_swapext */ -int xfs_swapext (struct xfs_swapext __user *sx); - -int xfs_swap_extents (struct xfs_inode *ip,struct xfs_inode *tip, -struct xfs_swapext *sxp); +int xfs_swapext (struct xfs_swapext *sx);#endif /* __KERNEL__ */
include/xfs_dinode.h +55 -94
208 lines not on this page · raw message
include/xfs_dir2.h +2 -2
@@ -100,7 +100,7 @@ extern int xfs_dir2_isleaf(struct xfs_trans *tp, struct xfs_inode *dp,extern int xfs_dir2_shrink_inode (struct xfs_da_args *args,xfs_dir2_db_t db,struct xfs_dabuf *bp); -extern int xfs_dir_cilookup_result (struct xfs_da_args *args,const char *name, -int len); +extern int xfs_dir_cilookup_result (struct xfs_da_args *args, +const unsigned char *name,int len);#endif /* __XFS_DIR2_H__ */
include/xfs_dir2_data.h +1 -1
@@ -38,7 +38,7 @@ struct xfs_trans;/* * Directory address space divided into sections, -* spaces separated by 32gb. +* spaces separated by 32GB. */ #define XFS_DIR2_SPACE_SIZE (1ULL << (32 + XFS_DIR2_DATA_ALIGN_LOG))#define XFS_DIR2_DATA_SPACE 0
include/xfs_dir2_node.h +0 -2
@@ -75,8 +75,6 @@ xfs_dir2_db_to_fdindex(struct xfs_mount *mp, xfs_dir2_db_t db)return ((db) %XFS_DIR2_MAX_FREE_BESTS (mp)); } -extern void xfs_dir2_free_log_bests (struct xfs_trans *tp,struct xfs_dabuf *bp, -int first,int last);extern int xfs_dir2_leaf_to_node (struct xfs_da_args *args,struct xfs_dabuf *lbp);extern xfs_dahash_t xfs_dir2_leafn_lasthash (struct xfs_dabuf *bp,int *count);
include/xfs_dir2_sf.h +0 -7
@@ -34,13 +34,6 @@ struct xfs_mount;struct xfs_trans ;/* -* Maximum size of a shortform directory. -*/ -#define XFS_DIR2_SF_MAX_SIZE \ - (XFS_DINODE_MAX_SIZE - (uint)sizeof(xfs_dinode_core_t) - \ - (uint)sizeof(xfs_agino_t)) - -/* * Inode number stored as 8 8-bit values. */ typedef struct {__uint8_t i[8 ]; }xfs_dir2_ino8_t ;
include/xfs_fs.h +11 -19
@@ -113,22 +113,16 @@ struct getbmapx {#define BMV_IF_ATTRFORK 0x1/* return attr fork rather than data */ #define BMV_IF_NO_DMAPI_READ 0x2/* Do not generate DMAPI read event */ #define BMV_IF_PREALLOC 0x4/* rtn status BMV_OF_PREALLOC if req */ -#define BMV_IF_VALID (BMV_IF_ATTRFORK|BMV_IF_NO_DMAPI_READ|BMV_IF_PREALLOC) -#ifdef __KERNEL__ -#define BMV_IF_EXTENDED 0x40000000/* getpmapx if set */ -#endif +#define BMV_IF_DELALLOC 0x8/* rtn status BMV_OF_DELALLOC if req */ +#define BMV_IF_NO_HOLES 0x10/* Do not return holes */ +#define BMV_IF_VALID \ + (BMV_IF_ATTRFORK|BMV_IF_NO_DMAPI_READ|BMV_IF_PREALLOC| \ + BMV_IF_DELALLOC|BMV_IF_NO_HOLES) -/* bmv_oflags values - returned for for each non-header segment */ +/* bmv_oflags values - returned for each non-header segment */ #define BMV_OF_PREALLOC 0x1/* segment = unwritten pre-allocation */ - -/* Convert getbmap <-> getbmapx - move fields from p1 to p2. */ -#define GETBMAP_CONVERT (p1,p2) { \ - p2.bmv_offset = p1.bmv_offset; \ - p2.bmv_block = p1.bmv_block; \ - p2.bmv_length = p1.bmv_length; \ - p2.bmv_count = p1.bmv_count; \ - p2.bmv_entries = p1.bmv_entries; } - +#define BMV_OF_DELALLOC 0x2/* segment = delayed allocation */ +#define BMV_OF_LAST 0x4/* segment is the last in the file */ /* * Structure for XFS_IOC_FSSETDM.
@@ -300,7 +294,7 @@ typedef struct xfs_bstat {__s32 bs_extents;/* number of extents */ __u32 bs_gen;/* generation count */ __u16 bs_projid_lo;/* lower part of project id */ -#define bs_projid bs_projid_lo +#define bs_projid bs_projid_lo/* (previously just bs_projid) */ __u16 bs_forkoff;/* inode fork offset in bytes */ __u16 bs_projid_hi;/* higher part of project id */ unsigned char bs_pad[10 ];/* pad space, unused */
@@ -432,10 +426,6 @@ typedef struct xfs_handle {#define XFS_IOC_GETXFLAGS FS_IOC_GETFLAGS#define XFS_IOC_SETXFLAGS FS_IOC_SETFLAGS#define XFS_IOC_GETVERSION FS_IOC_GETVERSION -/* 32-bit compat counterparts */ -#define XFS_IOC32_GETXFLAGS FS_IOC32_GETFLAGS -#define XFS_IOC32_SETXFLAGS FS_IOC32_SETFLAGS -#define XFS_IOC32_GETVERSION FS_IOC32_GETVERSION/* * ioctl commands that replace IRIX fcntl()'s
@@ -484,6 +474,8 @@ typedef struct xfs_handle {#define XFS_IOC_ERROR_INJECTION _IOW ('X', 116, struct xfs_error_injection)#define XFS_IOC_ERROR_CLEARALL _IOW ('X', 117, struct xfs_error_injection)/* XFS_IOC_ATTRCTL_BY_HANDLE -- deprecated 118 */ +/* XFS_IOC_FREEZE -- FIFREEZE 119 */ +/* XFS_IOC_THAW -- FITHAW 120 */ #define XFS_IOC_FREEZE _IOWR('X', 119, int)#define XFS_IOC_THAW _IOWR('X', 120, int)#define XFS_IOC_FSSETDM_BY_HANDLE _IOW ('X', 121, struct xfs_fsop_setdm_handlereq)
include/xfs_ialloc.h +9 -21
@@ -20,6 +20,7 @@struct xfs_buf ;struct xfs_dinode ; +struct xfs_imap ;struct xfs_mount ;struct xfs_trans ;
@@ -38,7 +39,6 @@ struct xfs_trans;/* * Make an inode pointer out of the buffer/offset. */ -#define XFS_MAKE_IPTR (mp,b,o) xfs_make_iptr(mp,b,o)static inline struct xfs_dinode *xfs_make_iptr (struct xfs_mount *mp,struct xfs_buf *b,int o) {
@@ -49,7 +49,6 @@ xfs_make_iptr(struct xfs_mount *mp, struct xfs_buf *b, int o)/* * Find a free (set) bit in the inode bitmask. */ -#define XFS_IALLOC_FIND_FREE (fp) xfs_ialloc_find_free(fp)static inline int xfs_ialloc_find_free (xfs_inofree_t *fp) {return xfs_lowbit64 (*fp);
@@ -104,17 +103,14 @@ xfs_difree( xfs_ino_t *first_ino); /* first inode in deleted cluster *//* -* Return the location of the inode in bno/len/off, -* for mapping it into a buffer. +* Return the location of the inode in imap, for mapping it into a buffer. */ int -xfs_dilocate ( +xfs_imap (struct xfs_mount *mp,/* file system mount structure */ struct xfs_trans *tp,/* transaction pointer */ xfs_ino_t ino,/* inode to locate */ -xfs_fsblock_t *bno,/* output: block containing inode */ -int *len,/* output: num blocks in cluster*/ -int *off,/* output: index in block of inode */ +struct xfs_imap *imap,/* location map structure */ uint flags);/* flags for inode btree lookup */ /*
@@ -154,23 +150,15 @@ xfs_ialloc_pagi_init( xfs_agnumber_t agno); /* allocation group number *//* -* Lookup the first record greater than or equal to ino -* in the btree given by cur. +* Lookup a record by ino in the btree given by cur. */ -int xfs_inobt_lookup_ge (struct xfs_btree_cur *cur,xfs_agino_t ino, -__int32_t fcnt,xfs_inofree_t free,int *stat); - -/* -* Lookup the first record less than or equal to ino -* in the btree given by cur. -*/ -int xfs_inobt_lookup_le (struct xfs_btree_cur *cur,xfs_agino_t ino, -__int32_t fcnt,xfs_inofree_t free,int *stat); +int xfs_inobt_lookup (struct xfs_btree_cur *cur,xfs_agino_t ino, +xfs_lookup_t dir,int *stat);/* * Get the data from the pointed-to record. */ -extern int xfs_inobt_get_rec (struct xfs_btree_cur *cur,xfs_agino_t *ino, -__int32_t *fcnt,xfs_inofree_t *free,int *stat); +extern int xfs_inobt_get_rec (struct xfs_btree_cur *cur, +xfs_inobt_rec_incore_t *rec,int *stat);#endif /* __XFS_IALLOC_H__ */
include/xfs_ialloc_btree.h +4 -19
@@ -32,15 +32,14 @@ struct xfs_mount;#define XFS_IBT_MAGIC 0x49414254/* 'IABT' */ typedef __uint64_t xfs_inofree_t ; -#define XFS_INODES_PER_CHUNK (NBBY * sizeof(xfs_inofree_t)) +#define XFS_INODES_PER_CHUNK (NBBY * sizeof(xfs_inofree_t))#define XFS_INODES_PER_CHUNK_LOG (XFS_NBBYLOG + 3) -#define XFS_INOBT_ALL_FREE ((xfs_inofree_t)-1) +#define XFS_INOBT_ALL_FREE ((xfs_inofree_t)-1) +#define XFS_INOBT_MASK (i) ((xfs_inofree_t)1 << (i)) -#define XFS_INOBT_MASKN (i,n) xfs_inobt_maskn(i,n)static inline xfs_inofree_t xfs_inobt_maskn (int i,int n) { -return (((n) >=XFS_INODES_PER_CHUNK ? \ - (xfs_inofree_t )0 : ((xfs_inofree_t )1 << (n))) -1 ) << (i); +return ((n >=XFS_INODES_PER_CHUNK ?0 :XFS_INOBT_MASK (n)) -1 ) << i; }/*
@@ -70,20 +69,6 @@ typedef struct xfs_inobt_key {typedef __be32 xfs_inobt_ptr_t ;/* -* Bit manipulations for ir_free. -*/ -#define XFS_INOBT_MASK (i) ((xfs_inofree_t)1 << (i)) -#define XFS_INOBT_IS_FREE (rp,i) \ - (((rp)->ir_free & XFS_INOBT_MASK(i)) != 0) -#define XFS_INOBT_SET_FREE (rp,i) ((rp)->ir_free |= XFS_INOBT_MASK(i)) -#define XFS_INOBT_CLR_FREE (rp,i) ((rp)->ir_free &= ~XFS_INOBT_MASK(i)) - -/* -* Maximum number of inode btree levels. -*/ -#define XFS_IN_MAXLEVELS (mp) ((mp)->m_in_maxlevels) - -/* * block numbers in the AG. */ #define XFS_IBT_BLOCK (mp) ((xfs_agblock_t)(XFS_CNT_BLOCK(mp) + 1))
include/xfs_imap.h deleted +0 -38
@@ -1,38 +0,0 @@ -/* -* Copyright (c) 2000,2005 Silicon Graphics, Inc. -* All Rights Reserved. -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License as -* published by the Free Software Foundation. -* -* This program is distributed in the hope that it would be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write the Free Software Foundation, -* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ -#ifndef __XFS_IMAP_H__ -#define __XFS_IMAP_H__ - -/* -* This is the structure passed to xfs_imap() to map -* an inode number to its on disk location. -*/ -typedef struct xfs_imap { -xfs_daddr_t im_blkno;/* starting BB of inode chunk */ -uint im_len;/* length in BBs of inode chunk */ -xfs_agblock_t im_agblkno;/* logical block of inode chunk in ag */ -ushort im_ioffset;/* inode offset in block in "inodes" */ -ushort im_boffset;/* inode offset in block in bytes */ -}xfs_imap_t ; - -struct xfs_mount ; -struct xfs_trans ; -int xfs_imap (struct xfs_mount *,struct xfs_trans *,xfs_ino_t , -xfs_imap_t *,uint ); - -#endif /* __XFS_IMAP_H__ */
include/xfs_inode.h +96 -114
370 lines not on this page · raw message
include/xfs_inode_item.h +6 -24
@@ -103,26 +103,16 @@ typedef struct xfs_inode_log_format_64 { XFS_ILOG_ADATA | XFS_ILOG_AEXT | \ XFS_ILOG_ABROOT) -#define XFS_ILI_HOLD 0x1 -#define XFS_ILI_IOLOCKED_EXCL 0x2 -#define XFS_ILI_IOLOCKED_SHARED 0x4 - -#define XFS_ILI_IOLOCKED_ANY (XFS_ILI_IOLOCKED_EXCL | XFS_ILI_IOLOCKED_SHARED) - - -#define XFS_ILOG_FBROOT (w) xfs_ilog_fbroot(w)static inline int xfs_ilog_fbroot (int w) {return (w ==XFS_DATA_FORK ?XFS_ILOG_DBROOT :XFS_ILOG_ABROOT ); } -#define XFS_ILOG_FEXT (w) xfs_ilog_fext(w)static inline int xfs_ilog_fext (int w) {return (w ==XFS_DATA_FORK ?XFS_ILOG_DEXT :XFS_ILOG_AEXT ); } -#define XFS_ILOG_FDATA (w) xfs_ilog_fdata(w)static inline int xfs_ilog_fdata (int w) {return (w ==XFS_DATA_FORK ?XFS_ILOG_DDATA :XFS_ILOG_ADATA );
@@ -131,7 +121,7 @@ static inline int xfs_ilog_fdata(int w)#ifdef __KERNEL__struct xfs_buf ; -struct xfs_bmbt_rec_64 ; +struct xfs_bmbt_rec ;struct xfs_inode ;struct xfs_mount ;
@@ -141,21 +131,13 @@ typedef struct xfs_inode_log_item {struct xfs_inode *ili_inode;/* inode ptr */ xfs_lsn_t ili_flush_lsn;/* lsn at last flush */ xfs_lsn_t ili_last_lsn;/* lsn at last transaction */ -unsigned short ili_ilock_recur;/* lock recursion count */ -unsigned short ili_iolock_recur;/* lock recursion count */ -unsigned short ili_flags;/* misc flags */ +unsigned short ili_lock_flags;/* lock flags */ unsigned short ili_logged;/* flushed logged data */ unsigned int ili_last_fields;/* fields when flushed */ -struct xfs_bmbt_rec_64 *ili_extents_buf;/* array of logged +struct xfs_bmbt_rec *ili_extents_buf;/* array of logged data exts */ -struct xfs_bmbt_rec_64 *ili_aextents_buf;/* array of logged +struct xfs_bmbt_rec *ili_aextents_buf;/* array of logged attr exts */ -unsigned int ili_pushbuf_flag;/* one bit used in push_ail */ - -#ifdef DEBUG -uint64_t ili_push_owner;/* one who sets pushbuf_flag -above gets to push the buf */ -#endif #ifdef XFS_TRANS_DEBUG int ili_root_size;char *ili_orig_root;
@@ -173,8 +155,8 @@ static inline int xfs_inode_clean(xfs_inode_t *ip)extern void xfs_inode_item_init (struct xfs_inode *,struct xfs_mount *);extern void xfs_inode_item_destroy (struct xfs_inode *); -extern void xfs_iflush_done (struct xfs_buf *,xfs_inode_log_item_t *); -extern void xfs_istale_done (struct xfs_buf *,xfs_inode_log_item_t *); +extern void xfs_iflush_done (struct xfs_buf *,struct xfs_log_item *); +extern void xfs_istale_done (struct xfs_buf *,struct xfs_log_item *);extern void xfs_iflush_abort (struct xfs_inode *);extern int xfs_inode_item_format_convert (xfs_log_iovec_t *,xfs_inode_log_format_t *);
include/xfs_inum.h +0 -1
@@ -72,7 +72,6 @@ struct xfs_mount;#if XFS_BIG_INUMS #define XFS_MAXINUMBER ((xfs_ino_t)((1ULL << 56) - 1ULL)) -#define XFS_INO64_OFFSET ((xfs_ino_t)(1ULL << 32))#else #define XFS_MAXINUMBER ((xfs_ino_t)((1ULL << 32) - 1ULL))#endif
include/xfs_mount.h +59 -200
432 lines not on this page · raw message
include/xfs_quota.h +82 -78
12 lines not on this page · raw message
include/xfs_sb.h +87 -81
168 lines not on this page · raw message
include/xfs_trace.h +76 -0
76 lines not on this page · raw message
libxfs/init.c +118 -15
133 lines not on this page · raw message
libxfs/util.c +41 -34
75 lines not on this page · raw message
libxfs/xfs_alloc.c +295 -304
599 lines not on this page · raw message
libxfs/xfs_alloc_btree.c +9 -37
46 lines not on this page · raw message
libxfs/xfs_attr.c +68 -70
138 lines not on this page · raw message
libxfs/xfs_attr_leaf.c +66 -69
135 lines not on this page · raw message
libxfs/xfs_bmap.c +877 -896
1,773 lines not on this page · raw message
libxfs/xfs_bmap_btree.c +61 -68
129 lines not on this page · raw message
libxfs/xfs_btree.c +65 -31
96 lines not on this page · raw message
libxfs/xfs_da_btree.c +23 -25
48 lines not on this page · raw message
libxfs/xfs_ialloc.c +607 -550
1,157 lines not on this page · raw message
libxfs/xfs_inode.c +129 -148
277 lines not on this page · raw message
libxfs/xfs_mount.c +32 -90
122 lines not on this page · raw message
repair/dinode.c +132 -143
275 lines not on this page · raw message
repair/phase6.c +38 -38
76 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 6 lines
1.7.2.3 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Part of the diff is not shown here. View the raw message.
Re: [PATCH 2/3] libxlog: sync up with 2.6.38 kernel code
In reply to Dave Chinnerinclude/atomic.h line 28
Quoted 8 lines
include/atomic.h new file +8
-0+typedef int32_t atomic_t ; +typedef int64_t atomic64_t ; + +#define atomic_inc_return (x) (++(*(x))) +#define atomic_dec_return (x) (--(*(x))) + +#define atomic64_read (x) *(x) +#define atomic64_set (x, v) (*(x) = v)
These defintions are pretty dangerous if we ever happens to use
them in multi-threaded code like repair. Currently we're not,
but they should grow a larger warning comment.
include/hlist.h
Quoted 2 lines
include/hlist.h new file +0
-0
Why not add the hlist helpers to list.h, like in the kernel tree?
Otherwise looks good,
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 3/3] libxfs: sync files with 2.6.38 kernel code
In reply to Dave Chinnerdb/inode.c const field_t inode_hfld[] = { · line 66
Quoted 9 lines
db/inode.c +3
-4+/* XXX: fix this up! */ #define OFF (f) bitize(offsetof(xfs_dinode_t, di_ ## f))const field_t inode_flds[] = { - {"core" ,FLDT_DINODE_CORE ,OI (OFF (core)),C1 ,0 ,TYP_NONE }, - {"next_unlinked" ,FLDT_AGINO ,OI (OFF (next_unlinked)),C1 ,0 , -TYP_INODE }, - {"u" ,FLDT_DINODE_U ,OI (OFF (u)),C1 ,0 ,TYP_NONE }, + {"core" ,FLDT_DINODE_CORE ,OI (OFF (magic)),C1 ,0 ,TYP_NONE }, + {"u" ,FLDT_DINODE_U , inode_u_offset,C1 ,FLD_OFFSET ,TYP_NONE },
I think the right way to fix this is to copy over all fields from the dinode core, and keep a "virtual" core field and the inode_core table for backwards compatiblity.
db/inode.c const field_t inode_core_flds[] = { · line 151
Quoted 2 lines
db/inode.c +2
-0+ {"next_unlinked" ,FLDT_AGINO ,OI (OFF (next_unlinked)),C1 ,0 , + TYP_INODE },
I think this one should only be added to the real dinode, not the core.
libxfs/xfs.h roundup_pow_of_two(uint v) · line 193
Quoted 5 lines
#define
XFS_BUF_LOCK0
#defineXFS_BUF_TRYLOCK0libxfs/xfs.h +3
-0+#define XBF_LOCK XFS_BUF_LOCK +#define XBF_TRYLOCK XFS_BUF_TRYLOCK +#define XBF_DONT_BLOCK 0
Please kill off the XFS_BUF_* flags, just like in kernelspace.
Looks good,
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 1/3] libxfs: reintroduce old xfs_repair radix-tree code
In reply to Dave ChinnerQuoted 8 lines · Dave Chinner
From: Dave Chinner <[email protected]>
The current kernel code uses radix trees more widely than the previous code, so for the next sync we need radix tree support in libxfs. Pull the old radix tree code out the
xfs_repairgit history and move it into libxfs to simplify the kernel code sync.Signed-off-by Dave Chinner <[email protected]>
Looks good,
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 2/3] libxlog: sync up with 2.6.38 kernel code
In reply to Christoph HellwigQuoted 4 lines · Christoph Hellwig
Quoted 4 lines
include/atomic.h new file +4
-0+typedef int32_t atomic_t ; +typedef int64_t atomic64_t ; + +#define atomic_inc_return (x) (++(*(x)))
Quoted 8 lines
include/atomic.h line 28
Quoted 4 lines
include/atomic.h new file +4
-0+#define atomic_dec_return (x) (--(*(x))) + +#define atomic64_read (x) *(x) +#define atomic64_set (x, v) (*(x) = v)These defintions are pretty dangerous if we ever happens to use
them in multi-threaded code like repair. Currently we're not,
but they should grow a larger warning comment.
Ok, I'll add a warning to that effect.
Quoted 4 lines
include/hlist.h
Quoted 2 lines
include/hlist.h new file +0
-0Why not add the hlist helpers to
list.h, like in the kernel tree?
It was just a side effect of the process I followed to add the bits of missing functionality that were needed. I can add it to list.h if you want, but I don't think it really matters either way...
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 3/3] libxfs: sync files with 2.6.38 kernel code
In reply to Christoph HellwigQuoted 5 lines · Christoph Hellwig
Quoted 5 lines
db/inode.c +1
-2+/* XXX: fix this up! */ #define OFF (f) bitize(offsetof(xfs_dinode_t, di_ ## f))const field_t inode_flds[] = { - {"core" ,FLDT_DINODE_CORE ,OI (OFF (core)),C1 ,0 ,TYP_NONE }, - {"next_unlinked" ,FLDT_AGINO ,OI (OFF (next_unlinked)),C1 ,0 ,
Quoted 8 lines
db/inode.c const field_t inode_hfld[] = { · line 66
Quoted 4 lines
db/inode.c +2
-2- TYP_INODE }, - { "u", FLDT_DINODE_U, OI(OFF(u)), C1, 0, TYP_NONE }, + { "core", FLDT_DINODE_CORE, OI(OFF(magic)), C1, 0, TYP_NONE }, + { "u", FLDT_DINODE_U, inode_u_offset, C1, FLD_OFFSET, TYP_NONE },I think the right way to fix this is to copy over all fields from the dinode core, and keep a "virtual" core field and the
inode_coretable for backwards compatiblity.
OK. By "virtual" core field, do you mean something like what I have about, or something different?
Quoted 4 lines
db/inode.c const field_t inode_core_flds[] = { · line 151
Quoted 2 lines
db/inode.c +2
-0+ {"next_unlinked" ,FLDT_AGINO ,OI (OFF (next_unlinked)),C1 ,0 , + TYP_INODE },I think this one should only be added to the real dinode, not the core.
Good catch. I mixed up what was in xfs_icdinode and xfs_dinode there.
Quoted 8 lines
libxfs/xfs.h roundup_pow_of_two(uint v) · line 193
Quoted 6 lines
#define
XFS_BUF_LOCK0
#defineXFS_BUF_TRYLOCK0libxfs/xfs.h +3
-0+#define XBF_LOCK XFS_BUF_LOCK +#define XBF_TRYLOCK XFS_BUF_TRYLOCK +#define XBF_DONT_BLOCK 0Please kill off the XFS_BUF_* flags, just like in kernelspace.
Will do.
Thanks for spending the time to look over these huge patches, Christoph.
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 1/3] libxfs: reintroduce old xfs_repair radix-tree code
In reply to Dave ChinnerQuoted 8 lines · Dave Chinner
From: Dave Chinner <[email protected]>
The current kernel code uses radix trees more widely than the previous code, so for the next sync we need radix tree support in libxfs. Pull the old radix tree code out the
xfs_repairgit history and move it into libxfs to simplify the kernel code sync.Signed-off-by Dave Chinner <[email protected]>
OK, I actually reviewed this code, even though it had already been present in the source tree prior to commit:379397bf9... ("repair: use a btree instead of a radix tree for the prefetch queue").
And I have some suggestions, and I have at least one thing that I think is a bug.
I also notice that this code apparently formed the basis of the kernel's implementation. That's good. It's probably worth reviewing the kernel version's history to see if there are any bug fixes that ought to be brought back into this code (and vice-versa).
All that being said, I think the right thing to do is to include this change as-is as a commit. It includes both "radix-tree.c" and "radix-tree.h" as identical copies of what was removed (though each now resides in a different directory from before), thereby preserving the provenance of the code.
Then, after it's committed, I can offer my suggested changes, or even just implement and propose them myself.
So unless you disagree with this approach I think it's fine to commit it as you originally posted it.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 2/3] libxlog: sync up with 2.6.38 kernel code
In reply to Dave ChinnerQuoted 5 lines · Dave Chinner
From: Dave Chinner <[email protected]>
Update libxlog with the current 2.6.38 kernel code and well as updating the necessary parts of libxfs and variaous header files to ensure that it compiles correctly.
OK, I went through this fairly exhaustively. That being said, I only verified that the stuff you are changing makes sense as compared to the stuff that was there before. I have not done any significant checks to try to be sure the existing code was all good.
At a very high level, I think this all looks good.
It points out that there is (or will be) a fairly small set of things that need to really differ between the kernel and libxfs/libxfslog code.
I don't expect we'll ever truly converge on one set of code, but we probably could come closer to that with a little restructuring of some things.
Since so much of this is code shared with the kernel, I think it should be pretty solid. I
have a little bit of concern about the things
that do differ--specifically the problems you
note in the next patch about the log sector
size and the inode reference counting. It
seems that ought to get a bit more scrutiny
or testing somehow. Stuff in "libxfs/logitem.c" and "libxfs_trans.c" I didn't really think too hard about, for example.
Otherwise, I guess I'll say that I've reviewed
this code and, with perhaps a little bit of
trepidation say it looks OK.
Quoted 21 lines
Signed-off-by Dave Chinner <[email protected]>--- include/Makefile | 5 +- include/atomic.h | 31 ++ include/hlist.h | 76 +++++ include/libxfs.h | 17 +- include/libxlog.h | 16 +- include/list.h | 11 + include/xfs_buf_item.h | 50 ++--- include/xfs_extfree_item.h | 17 +- include/xfs_inode_item.h | 2 - include/xfs_log.h | 70 +++-- include/xfs_log_priv.h | 331 +++++++++++++++++------ include/xfs_log_recover.h | 25 +- include/xfs_trace.h | 9 + include/xfs_trans.h | 648 ++++++-------------------------------------- include/xfs_types.h | 2 + libxfs/logitem.c | 365 +------------------------ libxfs/trans.c | 209 +++++---------- libxfs/xfs.h | 12 +- libxfs/xfs_mount.c | 1 -
Quoted 9 lines
libxfs/xfs_trans.c | 492 ++++++++++++++++++++++++++++++--- libxlog/xfs_log_recover.c | 606 ++++++++++++++++++++++------------------- logprint/log_print_all.c | 13 +- logprint/log_print_trans.c | 4 +- 23 files changed, 1431 insertions(+), 1581 deletions(-) create mode 100644 include/atomic.h create mode 100644 include/hlist.h create mode 100644 include/xfs_trace.h
. . .
include/hlist.h line 1
Quoted 7 lines
include/hlist.h new file +1
-0@@ -0,0 +1,76 @@ +/*
This is a technicality unrelated to the code itself.
No copyright ownership assertion? I realize it was taken from the kernel headers and therefore you don't want to pretend it's your work. But on the other hand, shouldn't *someone* own this particular set of bits?
Quoted 9 lines
include/hlist.h new file +9
-0+* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation. +* +* This program is distributed in the hope that it would be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*
include/hlist.h line 20
Quoted 10 lines
include/hlist.h new file +10
-0+* You should have received a copy of the GNU General Public License +* along with this program; if not, write the Free Software Foundation, +* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ +#ifndef __HLIST_H__ +#define __HLIST_H__ + +/* +* double-linked hash list with single head implementation taken from linux +* kernel headers.
Maybe you could add a commit id, or perhaps just a kernel version (like 2.6.37) to make more precise the version from which this code derives (as long as you're creating a new file to contain this).
include/hlist.h line 26
Quoted 6 lines
include/hlist.h new file +6
-0+*/ + +struct hlist_node { +struct hlist_node *next; +struct hlist_node **pprev; +};
. . .
include/libxfs.h
Quoted 4 lines
include/libxfs.h +0
-0
. . .
include/libxfs.h typedef struct xfs_inode_log_item { · line 344
Quoted 6 lines
include/libxfs.h +1
-0@@ -330,6 +340,7 @@ typedef struct xfs_inode_log_item {unsigned short ili_flags;/* misc flags */ unsigned int ili_last_fields;/* fields when flushed*/ xfs_inode_log_format_t ili_format;/* logged structure */ +int ili_lock_flags; } xfs_inode_log_item_t;
There is a file "include/xfs_inode_item.c" present in the xfsprogs tree (and it would otherwise also need this field added to it). As far as I can tell, nobody uses it. Do you know why it's there? Would you mind including its deletion along with this change? (There may be other similar unused files, but I won't worry about that for now.)
include/libxfs.h typedef struct xfs_trans { · line 368
Quoted 8 lines
include/libxfs.h +1
-1typedef struct xfs_buf_log_item {@@ -353,7 +364,7 @@ typedef struct xfs_trans {long t_fdblocks_delta;/* superblock fdblocks chg */ long t_frextents_delta;/* superblock freextents chg */ unsigned int t_items_free;/* log item descs free */ -xfs_log_item_chunk_t t_items;/* first log item desc chunk */ +struct list_head t_items;/* first log item desc chunk */ } xfs_trans_t;
Here too, file "include/xfs_trans.h" also defines xfs_trans_t but doesn't have a t_items field. The header file itself does not appear to be used. Maybe we do need to do a sweep through all the files and kill off the ones that are never used. Do you know the history here, whether/why files like that were ever used? Maybe they are used, and I'm somehow missing it with my cscope database.
. . .
include/xfs_extfree_item.h
Quoted 4 lines
include/xfs_extfree_item.h +0
-0
I think it would be worth noting in the commit message that this file is becoming identical to the file in the kernel at "fs/xfs/xfs_extfree_item.h". This is the case for a number of other files as well (I'll try to call attention to them as I go through).
Actually, I dug a little deeper on this and I see it's a bit more complicated than that. Many of the files are becoming identical to their kernel counterparts. I'll send something out later with some analysis on that.
include/xfs_log.h
Quoted 4 lines
include/xfs_log.h +0
-0
The latest change to this file in the kernel source changes the return type of xfs_log_commit_cil() to void (not reflected in this version for user space).
. . .
include/xfs_trace.h
Quoted 5 lines
include/xfs_trace.h new file +0
-0
You should add a boilerplate copyright and license section to this file. I realize this will probably triple its size...
. . .
libxfs/logitem.c
Quoted 4 lines
libxfs/logitem.c +0
-0
Stuff in this file I find is generally quite different from what's in the kernel. I'm going to chalk that up to some of the stuff that still needs to be sorted out between kernel and user space reference counting model.
I have looked at the differences in the hunks here and unless I've noted it I've tried to verify that the change looks sensible.
. . .
libxfs/logitem.c xfs_trans_buf_item_match(
Quoted 1 line
libxfs/logitem.c +0
-0@@ -250,149 +41,21 @@ xfs_trans_buf_item_match(
This appears to be identical to the one in the kernel, but the spacing is slightly different and the header comment differs a bit. You should
make them actually identical.
. . .
libxfs/trans.c libxfs_trans_alloc( · line 39
Quoted 9 lines
libxfs/trans.c +0
-1@@ -36,8 +36,7 @@ libxfs_trans_alloc( } ptr->t_mountp = mp; ptr->t_type = type; - ptr->t_items_free =XFS_LIC_NUM_SLOTS ;
t_items_free is removed from the xfs_trans structure in "include/xfs_trans.h" but it remains in the version of that structure defined in "include/libxfs.h".
I believe the latter is the one we want to keep, but if that's the case you'd better delete the field definition there. (The compiler isn't warning you that you neglected to initialize a field.)
libxfs/trans.c libxfs_trans_alloc( · line 42
Quoted 5 lines
libxfs/trans.c +1
-1-xfs_lic_init (&ptr->t_items); +INIT_LIST_HEAD (&ptr->t_items);#ifdef XACT_DEBUG fprintf (stderr,"allocated new transaction %p\n" , ptr);#endif
. . .
libxfs/trans.c xfs_trans_log_inode( · line 242
Quoted 11 lines
libxfs/trans.c +0
-2@@ -224,19 +235,14 @@ xfs_trans_log_inode( xfs_inode_t *ip, uint flags) { -xfs_log_item_desc_t *lidp; -ASSERT (ip->i_transp == tp);ASSERT (ip->i_itemp !=NULL );#ifdef XACT_DEBUG fprintf (stderr,"dirtied inode %llu, transaction %p\n" , ip->i_ino, tp);#endif
The only difference between this function and the one in the kernel is that the kernel has an assert here (xfs_isilocked()) rather than the debug fprintf().
. . .
libxfs/xfs.h
Quoted 4 lines
libxfs/xfs.h +0
-0
This file is *nearly* identical to its kernel
counterpart. Maybe those last few differences
can get resolved soon.
In any case, this file looks good.
. . .
libxfs/xfs_mount.c xfs_mount_common(xfs_mount_t *mp, xfs_sb_t *sbp) · line 273
Quoted 9 lines
libxfs/xfs_mount.c +0
-1@@ -270,7 +270,6 @@ xfs_mount_common(xfs_mount_t *mp, xfs_sb_t *sbp) mp->m_blockmask = sbp->sb_blocksize -1 ; mp->m_blockwsize = sbp->sb_blocksize >>XFS_WORDLOG ; mp->m_blockwmask = mp->m_blockwsize -1 ; -INIT_LIST_HEAD (&mp->m_del_inodes);
This hunk belongs in the next patch, not this one.
libxfs/xfs_trans.c
Quoted 7 lines
libxfs/xfs_mount.c +0
-0/* * Setup for attributes, in case they get created. libxfs/xfs_trans.c +0
-0
This file looks good.
. . .
libxlog/xfs_log_recover.c
Quoted 4 lines
libxlog/xfs_log_recover.c +0
-0
This file looks generally good, but I've made a few notes below.
. . .
libxlog/xfs_log_recover.c xlog_bread(
Quoted 1 line
libxlog/xfs_log_recover.c +0
-0@@ -82,26 +136,24 @@ xlog_bread(
. . .
libxlog/xfs_log_recover.c xlog_bread( · line 140
Quoted 2 lines
libxlog/xfs_log_recover.c +2
-0+int +xlog_bread(
This function is marked STATIC in the kernel, not here. (They're otherwise identical.)
. . .
libxlog/xfs_log_recover.c xlog_find_cycle_start(
Quoted 1 line
libxlog/xfs_log_recover.c +0
-0@@ -118,39 +170,38 @@ xlog_find_cycle_start(
This function is marked STATIC in the kernel, not here. (They're otherwise identical.)
. . .
libxlog/xfs_log_recover.c xlog_find_tail(
Quoted 1 line
libxlog/xfs_log_recover.c +0
-0@@ -620,13 +679,14 @@ xlog_find_tail(
This function is marked STATIC in the kernel, not here. (They're otherwise identical.)
. . .
libxlog/xfs_log_recover.c xlog_find_zeroed(
Quoted 1 line
libxlog/xfs_log_recover.c +0
-0@@ -820,9 +878,10 @@ xlog_find_zeroed(
This function is marked STATIC in the kernel, not here. (They're otherwise identical.)
. . .
libxlog/xfs_log_recover.c xlog_recover_insert_item_backq(
Quoted 1 line
libxlog/xfs_log_recover.c +0
-0@@ -1089,41 +1118,43 @@ xlog_recover_insert_item_backq(
. . .
libxlog/xfs_log_recover.c xlog_recover_insert_item_backq( · line 1146
Quoted 8 lines
libxlog/xfs_log_recover.c +6
-0+/* +* Perform the transaction. +* +* If the transaction modifies a buffer or inode, do it now. Otherwise, +* EFIs and EFDs get queued up by adding entries into the AIL for them. +*/ STATIC int xlog_recover_commit_trans(
This function differs from the kernel version. Is this an example of where the old ijoin/ihold interface is being preserved?
. . .
libxlog/xfs_log_recover.c xlog_recover_unmount_trans( · line 1180
Quoted 3 lines
libxlog/xfs_log_recover.c +0
-0@@ -1148,7 +1179,7 @@ xlog_recover_unmount_trans( STATIC int xlog_recover_process_data(
This function is missing a call to WARN_ON()
in the case "bad length" gets reported. Is
that just because we have no WARN_ON() macro
already? The kernel and user space versions
are otherwise identical.
. . .
libxlog/xfs_log_recover.c xlog_do_recovery_pass(
Quoted 1 line
libxlog/xfs_log_recover.c +0
-0@@ -1312,12 +1345,12 @@ xlog_do_recovery_pass(
This function is marked STATIC in the kernel, not here. (They're otherwise identical.)
. . .
logprint/log_print_all.c xlog_print_find_oldest(
Quoted 5 lines
logprint/log_print_all.c +0
-0@@ -36,10 +36,10 @@ xlog_print_find_oldest(
This file looks good. (Taking into account the caveat mentioned in your next patch about fixing up xlog_bread().)
. . .
logprint/log_print_trans.c
Quoted 4 lines
logprint/log_print_trans.c +0
-0
This file looks good.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 3/3] libxfs: sync files with 2.6.38 kernel code
In reply to Dave ChinnerQuoted 15 lines · Dave Chinner
Bring the libxfs headers and code into sync with the 2.6.37 kernel code. Update the rest of xfsprogs to work with the new code.
Note: this does not convert xfsprogs to the kernel xfs_trans_ijoin\ijoin_ref interface, it maintains the older ijoin/ihold interface because of the different way the inode reference counting works in libxfs. More work will be needed to change it over to a manner compatible with the current kernel API.
Note: log sector size handling needs to be sorted out. Specifically, initialising l_sectbb_log/l_sectBBsize correctly and removing the hacks in
xlog_breadand friends (libxlog/xfs_log_recover.c) to work around the fact they are not initialised correctly. (FWIW, I don't think xfsprogs handles large log sector size correctly as a result, and especially not if the log device sector size is different to the data device sector size).
Quoted 7 lines
Testing:
Currently passes xfstests on
x86_64w/ 4k block sizes and 512 byte block/2k directory block filesystems. No obvious regressions are occurring during xfstests runs.Signed-off-by Dave Chinner <[email protected]>
OK, I spent a lot of time on this. At first I thought the changes were small enough that I was fairly confident they were OK. But after getting into it for a while I realized it was really too much to review at once, so instead I worked on some more systematic analysis based mostly on comparing what I could with corresponding kernel code. More on all this below.
As a bottom line summary though:
- Generally this looks fine. The kernel code has been updated a bit since you submitted this patch, and it would be nice if you could update things to reflect that. I don't expect you to track that moving target, but at least now that it's undergone an initial review, future reviews won't require much effort so you can get pretty close.
- We really need to subject this to as much testing as we can before committing to the change. I don't know how much is reasonable, or if there is more we could add to xfstests to ensure we have good coverage. On the other hand, I don't want to wait too long either (because of the constantly changing kernel code base).
- Now that we'll be fairly well sync'ed, what can we do to keep things in sync in the future? It would be nice if at least pieces of that process could be automated so we can keep things current incrementally rather than doing a big update every so often.
That's probably enough discussion. I guess you might as well consider this reviewed by me; I'm not going to review it as closely as this again. I do think an update would be warranted before committing though.
Without further ado...
Why are you dropping the use of the symbols XFS_DINODE_VERSION_1 and XFS_DINODE_VERSION_2 in favor of just using 1 and 2? I recognize the symbolic names offer little value on their face but at least you can search for them. (I'll not comment on all the instances where this occurs in your patch.)
Here are some things that are included in these changes. They're simple, but widespread.
- xfs_dinode_core is gone; xfs_dinode incorporates its fields directly rather than having them in a substructure. This accounts for the bulk of the changes.
- Put in xfs_perag_get() and xfs_perag_put() calls in places where the perag structure was just used naked before.
- Drop the "delta" argument from xfs_bmapi() and xfs_bunmapi().
- Drop the "bno" and "imap_flags" arguments from xfs_itobp().
- Change xfs_ichgtime() references to xfs_trans_ichgtime().
- Pointless macros like XFS_ATTR_LEAVE_NAME_LOCAL() have been eliminated.
- xfs_bmbt_rec_64_t is gone, replaced by xfs_bmbt_rec_t.
- Use of XFS_DFORK_DPTR() in some places rather than using the union fields.
- New log item descriptor memory zone/slab.
- Switch from the old (xfs_*_trace_*()) to the new (trace_xfs_*()) tracing interfaces.
- A few objects and interfaces have switched to use (unsigned char) rather than (char).
- Spelling errors in comments fixed.
I started out reviewing all of the changes, and came up with the above list in the process. Then I took a different approach and tried to eliminate a bunch of the files by finding any that have kernel counterparts and eliminating them if they were identical. That is, if they match what's in the kernel I assume that's good and correct (which is not a valid assumption, I realize).
These header files, found under xfsprogs/include, are now (after applying this patch series) identical to their counterparts found under fs/xfs in the kernel tree. I have therefore not really reviewed them:
include/xfs_alloc_btree.h (not affected by this patch) include/xfs_arch.h
include/xfs_attr_leaf.h
include/xfs_attr_sf.h
include/xfs_bit.h
include/xfs_bmap_btree.h
include/xfs_bmap.h
include/xfs_btree.h
include/xfs_btree_trace.h include/xfs_da_btree.h
include/xfs_dfrag.h
include/xfs_dinode.h
include/xfs_dir2_block.h (not affected by this patch) include/xfs_dir2_data.h
include/xfs_dir2.h
include/xfs_dir2_leaf.h include/xfs_dir2_node.h
include/xfs_dir2_sf.h include/xfs_extfree_item.h (not affected by this patch) include/xfs_ialloc_btree.h include/xfs_ialloc.h
include/xfs_inode_item.h
include/xfs_inum.h
include/xfs_log_priv.h (not affected by this patch) include/xfs_log_recover.h (not affected by this patch) include/xfs_rtalloc.h
include/xfs_trans.h
include/xfs_trans_space.h
include/xfs_types.h
For the rest of the files affected by this patch I have reviewed each and have commented below. If a file has a kernel counterpart, I mainly just report what now differs between the two; in such cases the review is mostly superficial.
. . .
db/attr.c
Quoted 1 line
db/attr.c +0
-0
This file looks good.
db/attrset.c attr_set_f( · line 162
Quoted 11 lines
db/attrset.c +2
-1@@ -158,7 +158,8 @@ attr_set_f( goto out; } -if (libxfs_attr_set (ip, name, value, valuelen, flags)) { +if (libxfs_attr_set (ip, (unsigned char *)name, + (unsigned char *)value, valuelen, flags)) {
Maybe just change the types of "name" and "value", and cast them when they are assigned. (And drop the needless cast of the value returned by memalign() when you do.)
And another aside in this function. What the hell is this?
memset(value, 0xfeedface, valuelen);
db/attrset.c attr_remove_f( · line 237
Quoted 9 lines
db/attrset.c +1
-1dbprintf (_ ("failed to set attr %s on inode %llu\n" ), name, (unsigned long long )iocur_top->ino); goto out;@@ -233,7 +234,7 @@ attr_remove_f( goto out; } -if (libxfs_attr_remove (ip, name, flags)) { +if (libxfs_attr_remove (ip, (unsigned char *)name, flags)) {
Again, I'd rather see the cast occur when "name" gets assigned.
db/bmap.c
Quoted 4 lines
db/attrset.c +0
-0dbprintf (_ ("failed to remove attr %s from inode %llu\n" ), name, (unsigned long long )iocur_top->ino); goto out;db/bmap.c +0
-0
This file looks good.
db/bmap.h
Quoted 1 line
db/bmap.h +0
-0
This file looks good.
db/check.c
Quoted 1 line
db/check.c +0
-0
This file looks good.
db/convert.c
Quoted 1 line
db/convert.c +0
-0
This file looks good.
db/dir2sf.c
Quoted 1 line
db/dir2sf.c +0
-0
This file looks good.
db/field.c
Quoted 1 line
db/field.c +0
-0
This file looks good.
db/frag.c
Quoted 1 line
db/frag.c +0
-0
This file looks good.
db/inode.c
Quoted 1 line
db/inode.c +0
-0
This file looks good.
db/metadump.c
Quoted 1 line
db/metadump.c +0
-0
This file looks good.
include/libxfs.h
Quoted 1 line
include/libxfs.h +0
-0
This file looks good. It collects some things from several other files; I didn't verify everthing but it all seems reasonable.
include/xfs_ag.h
Quoted 4 lines
include/xfs_ag.h +0
-0
This file looks good.
include/xfs_alloc.h
Quoted 1 line
include/xfs_alloc.h +0
-0
Here is how this file differs from the kernel:
- Missing "xfs: limit extent length for allocation to AG size"
- Missing "xfs: add FITRIM support"
They'll be identical if you update I think.
include/xfs_fs.h
Quoted 4 lines
include/xfs_fs.h +0
-0
This file looks good. It is now nearly identical to the kernel version, with these exceptions:
- This version includes the definition of bstat_get_projid(). It's used once, but it should be deleted and the one use should be converted to use xfs_get_projid() if that can be arranged.
- XFS_IOC_FREEZE and XFS_IOC_THAW are still defined in this version. The code that uses it here could possibly be converted to use the Linux generic FIFREEZE and FITHAW instead.
include/xfs_imap.h
Quoted 5 lines
include/xfs_imap.h deleted +0
-0
This looks good (file now gone, both places).
include/xfs_inode.h
Quoted 4 lines
include/xfs_inode.h +0
-0
Here is how this file differs from the kernel:
- For some reason, xfs_get_projid() and xfs_set_projid() are defined twice in this version.
- Missing "xfs: add lockdep annotations for the rt inodes"
- And there are a few lines where prototypes differ (struct versus typedef usage).
include/xfs_mount.h
Quoted 4 lines
include/xfs_mount.h +0
-0
Here is how this file differs from the kernel:
- The perag_get/put function declarations sit in different parts of the file. (Easily reconciled.)
include/xfs_quota.h
Quoted 4 lines
include/xfs_quota.h +0
-0
Here is how this file differs from the kernel:
- A few prototypes are in different parts of the two files.
- I think all of the other differences are simply declarations of stub routines for the user space code.
include/xfs_sb.h
Quoted 4 lines
include/xfs_sb.h +0
-0
Kernel is missing xfs_sb_version_addprojid32bit(). Otherwise identical. I'm not sure whether this would be used in the kernel, but maybe we should make the two files identical.
include/xfs_trace.h
Quoted 4 lines
include/xfs_trace.h +0
-0
This file is the only one located under the linux-2.6 directory in the kernel tree. Pretty much everything here seems to be just setting up stub routines, which I'm going to assume is fine (without any really deep review).
libxfs/init.c
Quoted 4 lines
libxfs/init.c +0
-0
. . .
libxfs/init.c libxfs_dirv1_mount( · line 521
Quoted 6 lines
libxfs/init.c +6
-0+static int +libxfs_initialize_perag ( +xfs_mount_t *mp, +xfs_agnumber_t agcount, +xfs_agnumber_t *maxagi) +{
This function is identical to what's in the kernel except the pag_ici_root is not initialized.
libxfs/init.c libxfs_mount( · line 643
Quoted 5 lines
libxfs/init.c +1
-0@@ -534,6 +640,7 @@ libxfs_mount( mp->m_logdev = logdev; mp->m_flags = (LIBXFS_MOUNT_32BITINODES |LIBXFS_MOUNT_32BITINOOPT ); mp->m_sb = *sb; +INIT_RADIX_TREE (&mp->m_perag_tree,GFP_KERNEL );
This looks like it's where the initialization moved to, but the GFP is different (it's GFP_ATOMIC in the kernel).
libxfs/logitem.c
Quoted 1 line
libxfs/logitem.c +0
-0
This file looks good.
libxfs/trans.c
Quoted 1 line
libxfs/trans.c +0
-0
This file looks good.
libxfs/util.c
Quoted 4 lines
libxfs/util.c +0
-0
. . .
libxfs/util.c libxfs_iread( · line 78
Quoted 3 lines
libxfs/util.c +0
-0@@ -74,22 +77,26 @@ libxfs_iread( ip->i_ino = ino; ip->i_mount = mp;
This function looks like it could possibly be updated to be more closely matched to the kernel code. The changes otherwise look OK.
libxfs/xfs.h
Quoted 4 lines
libxfs/xfs.h +0
-0
This file looks generally OK. The changes look
fairly routine and most of them I remember the
corresponding change going into the kernel.
libxfs/xfs.h typedef __uint32_t inst_t; /* an instruction */ · line 99
Quoted 6 lines
@@ -99,6 +95,8 @@ typedef
__uint32_tinst_t; /* an instruction */
#definespin_unlock(a)((void) 0)
#define likely(x) (x)
#define unlikely(x) (x)libxfs/xfs.h +2
-0+#define rcu_read_lock () ((void) 0) +#define rcu_read_unlock () ((void) 0)
As Christoph pointed out elsewhere, we ought to do some thinking about how to manage locking interfaces like this to support actual locking when doing multithreaded work.
Quoted 3 lines
/*
* random32 is used fordi_geninode allocation, it must be zero for libxfs
. . .
libxfs/xfs_alloc.c
Quoted 1 line
libxfs/xfs_alloc.c +0
-0
Here is how this file differs from the kernel:
- Different set of included header files.
- A few functions declared STATIC here but not in the kernel, and vice-versa.
- A pointless assignment to "rlen" remains here, but has been deleted from the kernel version.
- The busy list management functions are not present in the user space code.
- Maybe a comment different here and there.
libxfs/xfs_alloc_btree.c
Quoted 1 line
libxfs/xfs_alloc_btree.c +0
-0
This file looks good. The only difference between it and its kernel counterpart is the set of included header files.
libxfs/xfs_attr.c
Quoted 1 line
libxfs/xfs_attr.c +0
-0
Here is how this file differs from the kernel:
- Different set of included header files.
- Seems to be missing "xfs: simplify inode to transaction joining"
- Definitions of a bunch of functions related to attribute lists are not present here (but are in the kernel).
libxfs/xfs_attr_leaf.c
Quoted 1 line
libxfs/xfs_attr_leaf.c +0
-0
Here is how this file differs from the kernel:
- Different set of included header files.
- Definitions of a bunch of functions related to attribute lists are not present here (but are in the kernel).
- Definitions of a bunch of functions related to attributes becoming inactive are not present here.
libxfs/xfs_bmap.c
Quoted 1 line
libxfs/xfs_bmap.c +0
-0
Here is how this file differs from the kernel:
- Different set of included header files.
- Missing "xfs: fix failed write truncation handling." and newer commits.
- Definitions of a bunch of functions are not present here (some of them are DEBUG-only). Includes xfs_getbmap(), xfs_bmap_finish(), and several others.
libxfs/xfs_bmap_btree.c
Quoted 1 line
libxfs/xfs_bmap_btree.c +0
-0
This file looks good.
libxfs/xfs_btree.c
Quoted 1 line
libxfs/xfs_btree.c +0
-0
This file looks good.
libxfs/xfs_da_btree.c
Quoted 1 line
libxfs/xfs_da_btree.c +0
-0
This file looks good.
libxfs/xfs_dir2.c
Quoted 1 line
libxfs/xfs_dir2.c +0
-0
This file looks good.
libxfs/xfs_dir2_block.c
Quoted 1 line
libxfs/xfs_dir2_block.c +0
-0
This file looks good.
libxfs/xfs_dir2_leaf.c
Quoted 1 line
libxfs/xfs_dir2_leaf.c +0
-0
This file looks good.
libxfs/xfs_dir2_node.c
Quoted 1 line
libxfs/xfs_dir2_node.c +0
-0
This file looks good.
libxfs/xfs_dir2_sf.c
Quoted 1 line
libxfs/xfs_dir2_sf.c +0
-0
This file looks good.
libxfs/xfs_ialloc.c
Quoted 4 lines
libxfs/xfs_ialloc.c +0
-0
. . .
libxfs/xfs_ialloc.c xfs_ialloc_ag_select( · line 510
Quoted 11 lines
libxfs/xfs_ialloc.c +1
-1@@ -546,7 +504,7 @@ xfs_ialloc_ag_select( agbp =NULL ; goto nextag; } -up_read (&mp->m_peraglock); +xfs_perag_put (pag);return agbp; } }
. . . (below is xfs_imap())
libxfs/xfs_ialloc.c nextag: · line 1083
Quoted 4 lines
libxfs/xfs_ialloc.c +1
-2-int i;/* temp state */ int offset;/* index of inode in its buffer */ -int offset_agbno;/* blks from chunk start to inode */ +xfs_agblock_t offset_agbno;/* blks from chunk start to inode */
This one is still an int in kernel code for some reason
libxfs/xfs_ialloc_btree.c
Quoted 7 lines
ASSERT(ino != NULLFSINO);libxfs/xfs_ialloc.c +1
-0+/* libxfs/xfs_ialloc_btree.c +0
-0
This file looks good.
libxfs/xfs_inode.c
Quoted 4 lines
libxfs/xfs_inode.c +0
-0
. . .
libxfs/xfs_inode.c xfs_iformat(
Quoted 1 line
libxfs/xfs_inode.c +0
-0@@ -266,55 +277,65 @@ xfs_iformat(
. . .
libxfs/xfs_inode.c xfs_iformat( · line 306
Quoted 2 lines
libxfs/xfs_inode.c +2
-0+if (unlikely ((ip->i_d.di_flags &XFS_DIFLAG_REALTIME ) && + !ip->i_mount->m_rtdev)) {
!ip->i_mount->m_rtdev_targp
With the exception of this, this function is identical to the kernel version. I don't know why there's this difference.
libxfs/xfs_inode.c xfs_iformat( · line 311
Quoted 5 lines
libxfs/xfs_inode.c +5
-0+xfs_fs_repair_cmn_err (CE_WARN , ip->i_mount, +"corrupt dinode %Lu, has realtime flag set." , + ip->i_ino); +XFS_CORRUPTION_ERROR ("xfs_iformat(realtime)" , +XFS_ERRLEVEL_LOW , ip->i_mount, dip);
. . .
libxfs/xfs_mount.c
Quoted 1 line
libxfs/xfs_mount.c +0
-0
This file looks good.
logprint/log_misc.c
Quoted 1 line
logprint/log_misc.c +0
-0
This file looks good.
mkfs/proto.c
Quoted 1 line
mkfs/proto.c +0
-0
This file looks good.
mkfs/xfs_mkfs.c
Quoted 1 line
mkfs/xfs_mkfs.c +0
-0
This file looks good.
repair/attr_repair.c
Quoted 1 line
repair/attr_repair.c +0
-0
This file looks good.
repair/dino_chunks.c
Quoted 1 line
repair/dino_chunks.c +0
-0
This file looks good.
repair/dinode.c
Quoted 1 line
repair/dinode.c +0
-0
This file looks good.
repair/dir.c
Quoted 1 line
repair/dir.c +0
-0
This file looks good.
repair/dir2.c
Quoted 1 line
repair/dir2.c +0
-0
This file looks good.
repair/incore.h
Quoted 1 line
repair/incore.h +0
-0
This file looks good.
repair/phase6.c
Quoted 4 lines
repair/phase6.c +0
-0
. . .
repair/phase6.c mk_rbmino(xfs_mount_t *mp) · line 447
Quoted 6 lines
repair/phase6.c +1
-1@@ -444,11 +444,11 @@ mk_rbmino(xfs_mount_t *mp) error); } -memset (&ip->i_d,0 ,sizeof (xfs_dinode_core_t)); +memset (&ip->i_d,0 ,sizeof (xfs_icdinode_t));
Was this just a bug that you're fixing now? (Wrong data type used in the size.) Same thing in mk_rsumino() and mk_root_dir().
. . .
repair/prefetch.c
Quoted 1 line
repair/prefetch.c +0
-0
This file looks good.
repair/rt.c
Quoted 1 line
repair/rt.c +0
-0
This file looks good.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 1/3] libxfs: reintroduce old xfs_repair radix-tree code
In reply to Alex ElderQuoted 32 lines · Alex Elder
Quoted 8 lines · Dave Chinner
From: Dave Chinner <[email protected]>
The current kernel code uses radix trees more widely than the previous code, so for the next sync we need radix tree support in libxfs. Pull the old radix tree code out the
xfs_repairgit history and move it into libxfs to simplify the kernel code sync.Signed-off-by Dave Chinner <[email protected]>OK, I actually reviewed this code, even though it had already been present in the source tree prior to commit:
379397bf9... ("repair: use a btree instead of a radix tree for the prefetch queue").And I have some suggestions, and I have at least one thing that I think is a bug.
I also notice that this code apparently formed the basis of the kernel's implementation. That's good. It's probably worth reviewing the kernel version's history to see if there are any bug fixes that ought to be brought back into this code (and vice-versa).
All that being said, I think the right thing to do is to include this change as-is as a commit. It includes both "
radix-tree.c" and "radix-tree.h" as identical copies of what was removed (though each now resides in a different directory from before), thereby preserving the provenance of the code.
Quoted 6 lines
Then, after it's committed, I can offer my suggested changes, or even just implement and propose them myself.
So unless you disagree with this approach I think it's fine to commit it as you originally posted it.
I think that is a fine way to proceed ;)
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 2/3] libxlog: sync up with 2.6.38 kernel code
In reply to Alex ElderQuoted 22 lines · Alex Elder
Quoted 5 lines · Dave Chinner
From: Dave Chinner <[email protected]>
Update libxlog with the current 2.6.38 kernel code and well as updating the necessary parts of libxfs and variaous header files to ensure that it compiles correctly.
OK, I went through this fairly exhaustively. That being said, I only verified that the stuff you are changing makes sense as compared to the stuff that was there before. I have not done any significant checks to try to be sure the existing code was all good.
At a very high level, I think this all looks good.
It points out that there is (or will be) a fairly small set of things that need to really differ between the kernel and libxfs/libxfslog code.
I don't expect we'll ever truly converge on one set of code, but we probably could come closer to that with a little restructuring of some things.
Quoted 10 lines
Since so much of this is code shared with the kernel, I think it should be pretty solid. I
have a little bit of concern about the things
that do differ--specifically the problems you
note in the next patch about the log sector
size and the inode reference counting. It
seems that ought to get a bit more scrutiny
or testing somehow. Stuff in "libxfs/logitem.c" and "libxfs_trans.c" I didn't really think too hard about, for example.
I think they can be dealt with separately to the syncing of the code. They are relatively small, isolated pieces of work comapred to the large sync up that needs tobe done first...
Quoted 50 lines
Otherwise, I guess I'll say that I've reviewed
this code and, with perhaps a little bit of
trepidation say it looks OK.Reviewed-by Alex Elder <[email protected]>Quoted 21 lines
Signed-off-by Dave Chinner <[email protected]>--- include/Makefile | 5 +- include/atomic.h | 31 ++ include/hlist.h | 76 +++++ include/libxfs.h | 17 +- include/libxlog.h | 16 +- include/list.h | 11 + include/xfs_buf_item.h | 50 ++--- include/xfs_extfree_item.h | 17 +- include/xfs_inode_item.h | 2 - include/xfs_log.h | 70 +++-- include/xfs_log_priv.h | 331 +++++++++++++++++------ include/xfs_log_recover.h | 25 +- include/xfs_trace.h | 9 + include/xfs_trans.h | 648 ++++++-------------------------------------- include/xfs_types.h | 2 + libxfs/logitem.c | 365 +------------------------ libxfs/trans.c | 209 +++++---------- libxfs/xfs.h | 12 +- libxfs/xfs_mount.c | 1 -Quoted 9 lines
libxfs/xfs_trans.c | 492 ++++++++++++++++++++++++++++++--- libxlog/xfs_log_recover.c | 606 ++++++++++++++++++++++------------------- logprint/log_print_all.c | 13 +- logprint/log_print_trans.c | 4 +- 23 files changed, 1431 insertions(+), 1581 deletions(-) create mode 100644 include/atomic.h create mode 100644 include/hlist.h create mode 100644 include/xfs_trace.h. . .
include/hlist.h line 1
Quoted 7 lines
include/hlist.h new file +1
-0@@ -0,0 +1,76 @@ +/* This is a technicality unrelated to the code itself.
Quoted 4 lines
No copyright ownership assertion? I realize it was taken from the kernel headers and therefore you don't want to pretend it's your work. But on the other hand, shouldn't *someone* own this particular set of bits?
There is no specific copyright on the kernel header file these are derived from, so I can't really add anything specific other than document where it came from....
Quoted 16 lines
Quoted 16 lines
include/hlist.h new file +16
-0+* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation. +* +* This program is distributed in the hope that it would be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write the Free Software Foundation, +* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ +#ifndef __HLIST_H__ +#define __HLIST_H__ +
Quoted 8 lines
include/hlist.h line 20
Quoted 3 lines
include/hlist.h new file +3
-0+/* +* double-linked hash list with single head implementation taken from linux +* kernel headers. Maybe you could add a commit id, or perhaps just a kernel version (like 2.6.37) to make more precise the version from which this code derives (as long as you're creating a new file to contain this).
Sure, I can add "taken from linux kernel header file include/linux/list.h as of 2.6.38-rc1".
Quoted 7 lines
include/libxfs.h
Quoted 4 lines
include/libxfs.h +0
-0. . .
Quoted 14 lines
include/libxfs.h typedef struct xfs_inode_log_item { · line 344
Quoted 6 lines
include/libxfs.h +1
-0@@ -330,6 +340,7 @@ typedef struct xfs_inode_log_item {unsigned short ili_flags;/* misc flags */ unsigned int ili_last_fields;/* fields when flushed*/ xfs_inode_log_format_t ili_format;/* logged structure */ +int ili_lock_flags; } xfs_inode_log_item_t;There is a file "
include/xfs_inode_item.c" present in the xfsprogs tree (and it would otherwise also need this field added to it). As far as I can tell, nobody uses it. Do you know why it's there? Would you mind including its deletion along with this change? (There may be other similar unused files, but I won't worry about that for now.)
It is used by the newer kernel ijoin/trans_iget code that I have not pooorted the rest of across. I added to the inode item rather than leave it as an unexplained difference between the userspace/kernel header files...
Quoted 13 lines
include/libxfs.h typedef struct xfs_trans { · line 368
Quoted 9 lines
include/libxfs.h +1
-1typedef struct xfs_buf_log_item {@@ -353,7 +364,7 @@ typedef struct xfs_trans {long t_fdblocks_delta;/* superblock fdblocks chg */ long t_frextents_delta;/* superblock freextents chg */ unsigned int t_items_free;/* log item descs free */ -xfs_log_item_chunk_t t_items;/* first log item desc chunk */ +struct list_head t_items;/* first log item desc chunk */ } xfs_trans_t;Here too, file "
include/xfs_trans.h" also definesxfs_trans_tbut doesn't have at_itemsfield. The header file itself does not appear to be used.
Sure - that's because userspace doesn't have any of the transaction infrastructure, and we are using the kernel header files which does need them. Once again, the cahnge is made to keep the userspace hdr the same as the kernel hdr even though userspace doesn't use that field...
Quoted 5 lines
Maybe we do need to do a sweep through
all the files and kill off the ones that are never used. Do you know the history here, whether/why files like that were ever used? Maybe they are used, and I'm somehow missing it with my cscope database.
No, I don't know the exact history - the original xfsprogs code on Irix used the Irix kernel code and headers directly, but the linux xfsprogs could not do that. Hence libxfs started out as ijust the necessary subset of the kernel headers and code that was needed by xfsprogs. As the code has changed, I'm sure there's bits that are now unused by userspace and should be cleaned up. We also need to make another pass over the kernel headers to refine what is in #idef__KERNEL__ regions as there is some problems in that area as well. That doesn't have to be done right now, though...
Quoted 12 lines
. . .
include/xfs_extfree_item.h
Quoted 4 lines
include/xfs_extfree_item.h +0
-0I think it would be worth noting in the commit message that this file is becoming identical to the file in the kernel at "
fs/xfs/xfs_extfree_item.h". This is the case for a number of other files as well (I'll try to call attention to them as I go through).
I don't see much point in adding such messages as the header files _should_ be identical to the kernel headers. After all, that's the reason for the "ifdef __KERNEL__" sections of the kernel header files...
Quoted 5 lines
Actually, I dug a little deeper on this and I see it's a bit more complicated than that. Many of the files are becoming identical to their kernel counterparts. I'll send something out later with some analysis on that.
Quoted 8 lines
include/xfs_log.h
Quoted 4 lines
include/xfs_log.h +0
-0The latest change to this file in the kernel source changes the return type of
xfs_log_commit_cil()to void (not reflected in this version for user space).
That's because that commit occurred after I did this sync... ;)
Quoted 9 lines
include/xfs_trace.h
Quoted 5 lines
include/xfs_trace.h new file +0
-0You should add a boilerplate copyright and license section to this file. I realize this will probably triple its size...
OK.
Quoted 9 lines
libxfs/logitem.c
Quoted 4 lines
libxfs/logitem.c +0
-0Stuff in this file I find is generally quite different from what's in the kernel. I'm going to chalk that up to some of the stuff that still needs to be sorted out between kernel and user space reference counting model.
Partially, also due to the fact there is no journaling subsystemin userspace and hence a slightly different life cycle for objects...
Quoted 4 lines
I have looked at the differences in the hunks here and unless I've noted it I've tried to verify that the change looks sensible.
Quoted 8 lines
. . .
libxfs/logitem.c xfs_trans_buf_item_match(
Quoted 1 line
libxfs/logitem.c +0
-0@@ -250,149 +41,21 @@ xfs_trans_buf_item_match(This appears to be identical to the one in the kernel, but the spacing is slightly different and the header comment differs a bit. You should
make them actually identical.
I thought I did. I'll clean it up.
Quoted 17 lines
. . .
libxfs/trans.c libxfs_trans_alloc( · line 39
Quoted 9 lines
libxfs/trans.c +0
-1@@ -36,8 +36,7 @@ libxfs_trans_alloc( } ptr->t_mountp = mp; ptr->t_type = type; - ptr->t_items_free =XFS_LIC_NUM_SLOTS ;
t_items_freeis removed from thexfs_transstructure in "include/xfs_trans.h" but it remains in the version of that structure defined in "include/libxfs.h".
Quoted 5 lines
I believe the latter is the one we want to keep, but if that's the case you'd better delete the field definition there. (The compiler isn't warning you that you neglected to initialize a field.)
Nor is it warning about a duplicate definition by the sound of it. I'll fix it up.
Quoted 9 lines
libxfs/trans.c libxfs_trans_alloc( · line 42
Quoted 6 lines
libxfs/trans.c +1
-1-xfs_lic_init (&ptr->t_items); +INIT_LIST_HEAD (&ptr->t_items);#ifdef XACT_DEBUG fprintf (stderr,"allocated new transaction %p\n" , ptr);#endif . . .
Quoted 15 lines
libxfs/trans.c xfs_trans_log_inode( · line 242
Quoted 11 lines
libxfs/trans.c +0
-2@@ -224,19 +235,14 @@ xfs_trans_log_inode( xfs_inode_t *ip, uint flags) { -xfs_log_item_desc_t *lidp; -ASSERT (ip->i_transp == tp);ASSERT (ip->i_itemp !=NULL );#ifdef XACT_DEBUG fprintf (stderr,"dirtied inode %llu, transaction %p\n" , ip->i_ino, tp);#endif The only difference between this function and the one in the kernel is that the kernel has an assert here (
xfs_isilocked()) rather than the debugfprintf().
That's because there is no inode locking in userspace:
#define xfs_ilock(ip,mode) ((void) 0)
so the assert is meaningless. Knowing that the inode was modified, however, is actually useful ;)
Quoted 12 lines
libxfs/xfs_mount.c xfs_mount_common(xfs_mount_t *mp, xfs_sb_t *sbp) · line 273
Quoted 9 lines
libxfs/xfs_mount.c +0
-1@@ -270,7 +270,6 @@ xfs_mount_common(xfs_mount_t *mp, xfs_sb_t *sbp) mp->m_blockmask = sbp->sb_blocksize -1 ; mp->m_blockwsize = sbp->sb_blocksize >>XFS_WORDLOG ; mp->m_blockwmask = mp->m_blockwsize -1 ; -INIT_LIST_HEAD (&mp->m_del_inodes);This hunk belongs in the next patch, not this one.
OK.
Quoted 27 lines
libxfs/xfs_trans.c
Quoted 7 lines
libxfs/xfs_mount.c +0
-0/* * Setup for attributes, in case they get created. libxfs/xfs_trans.c +0
-0This file looks good.
. . .
libxlog/xfs_log_recover.c
Quoted 4 lines
libxlog/xfs_log_recover.c +0
-0This file looks generally good, but I've made a few notes below.
. . .
libxlog/xfs_log_recover.c xlog_bread(
Quoted 1 line
libxlog/xfs_log_recover.c +0
-0@@ -82,26 +136,24 @@ xlog_bread(. . .
Quoted 5 lines
libxlog/xfs_log_recover.c xlog_bread( · line 140
Quoted 2 lines
libxlog/xfs_log_recover.c +2
-0+int +xlog_bread(This function is marked STATIC in the kernel, not here. (They're otherwise identical.)
Because they are used by the logprint code directly. same for all the other ones.
Quoted 9 lines
libxlog/xfs_log_recover.c xlog_recover_insert_item_backq( · line 1146
Quoted 8 lines
libxlog/xfs_log_recover.c +6
-0+/* +* Perform the transaction. +* +* If the transaction modifies a buffer or inode, do it now. Otherwise, +* EFIs and EFDs get queued up by adding entries into the AIL for them. +*/ STATIC int xlog_recover_commit_trans(
Quoted 3 lines
This function differs from the kernel version. Is this an example of where the old ijoin/ihold interface is being preserved?
No, it's a reflection that we don't actually do recovery in userspace. Hence we don't reorder transaction items, nor do we do multiple passes across the transactions to find cancelled transactions to avoid replaying them...
Quoted 12 lines
. . .
libxlog/xfs_log_recover.c xlog_recover_unmount_trans( · line 1180
Quoted 3 lines
libxlog/xfs_log_recover.c +0
-0@@ -1148,7 +1179,7 @@ xlog_recover_unmount_trans( STATIC int xlog_recover_process_data(This function is missing a call to
WARN_ON()
in the case "bad length" gets reported. Is
that just because we have noWARN_ON()macro
already? The kernel and user space versions
are otherwise identical.
I just ignored differences like this when merging - the original userspace code doesn't have any WARN_ON() calls in it at all, so I didn't merge this one...
I'll fix all these things up. Thanks for looking at it.
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 2/3] libxlog: sync up with 2.6.38 kernel code
Quoted 7 lines · Dave Chinner
Quoted 6 lines · Alex Elder
Quoted 5 lines · Dave Chinner
From: Dave Chinner <[email protected]>
Update libxlog with the current 2.6.38 kernel code and well as updating the necessary parts of libxfs and variaous header files to ensure that it compiles correctly.
.....
Quoted 5 lines
xfsprogs. As the code has changed, I'm sure there's bits that are now unused by userspace and should be cleaned up. We also need to make another pass over the kernel headers to refine what is in #idef__KERNEL__ regions as there is some problems in that area as well. That doesn't have to be done right now, though...
....
Quoted 14 lines
Quoted 14 lines
libxfs/trans.c libxfs_trans_alloc( · line 39
Quoted 9 lines
libxfs/trans.c +0
-1@@ -36,8 +36,7 @@ libxfs_trans_alloc( } ptr->t_mountp = mp; ptr->t_type = type; - ptr->t_items_free =XFS_LIC_NUM_SLOTS ;
t_items_freeis removed from thexfs_transstructure in "include/xfs_trans.h" but it remains in the version of that structure defined in "include/libxfs.h".
Quoted 8 lines
Quoted 5 lines
I believe the latter is the one we want to keep, but if that's the case you'd better delete the field definition there. (The compiler isn't warning you that you neglected to initialize a field.)
Nor is it warning about a duplicate definition by the sound of it. I'll fix it up.
There are two declarations of struct xfs_trans in userspace but only the one in libxfs.h is used because the one in include/xfs_trans.h is surrounded bu #ifdef __KERNEL__. Just an example of the sort of cleanup I mentioned above that is needed...
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 2/3] libxlog: sync up with 2.6.38 kernel code
In reply to Dave ChinnerQuoted 7 lines · Dave Chinner
Quoted 6 lines · Alex Elder
Quoted 5 lines · Dave Chinner
From: Dave Chinner <[email protected]>
Update libxlog with the current 2.6.38 kernel code and well as updating the necessary parts of libxfs and variaous header files to ensure that it compiles correctly.
....
Quoted 13 lines
Quoted 12 lines
libxfs/xfs_mount.c xfs_mount_common(xfs_mount_t *mp, xfs_sb_t *sbp) · line 273
Quoted 9 lines
libxfs/xfs_mount.c +0
-1@@ -270,7 +270,6 @@ xfs_mount_common(xfs_mount_t *mp, xfs_sb_t *sbp) mp->m_blockmask = sbp->sb_blocksize -1 ; mp->m_blockwsize = sbp->sb_blocksize >>XFS_WORDLOG ; mp->m_blockwmask = mp->m_blockwsize -1 ; -INIT_LIST_HEAD (&mp->m_del_inodes);This hunk belongs in the next patch, not this one.
Quoted 1 line
OK.
Actually, it has to be in this patch, because the only reason it compiled prior to this patch was that INIT_LIST_HEAD() was defined to a null macro. It is actually implemented in this patch, so this does need to be removed here or the patch won't compile....
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
I just updated these patches at:
git://git.kernel.org/pub/scm/fs/xfs/xfsprogs-dev kernel-2.6.38-sync
With all the review comments addressed.
Cheers,
Dave.
Quoted 159 lines · Dave Chinner
This is version 2 of the 2.6.38 kernel code sync to userspace. It currently passes xfstests on
x86_64with no new regressions regardless of the filesystem block size combination I throw at it.Note: this does not convert xfsprogs to the kernel xfs_trans_ijoin\
ijoin_refinterface, it maintains the older ijoin/ihold interface because of the different way the inode reference counting works in libxfs. More work will be needed to change it over to a manner compatible with the current kernel API.Note: log sector size handling needs to be sorted out. Specifically, initialising l_sectbb_log/l_sectBBsize correctly and removing the hacks in
xlog_breadand friends (libxlog/xfs_log_recover.c) to work around the fact they are not initialised correctly. (FWIW, I don't think xfsprogs handles large log sector size correctly as a result, and especially not if the log device sector size is different to the data device sector size).Version 2:
- split into three patches:
- reintroduction of radix tree code
- libxlog resync
- includes required libxfs transaction code changes
- updates logprint to use new interfaces
- libxfs resync
- updates libxfs
- updates all xfsprogs to use new libxfs interfaces.
- fixes xfstest 033cache_purgebug
- was a problem in handling theXFS_ILI_HOLDflag removal.---
The following changes since commit
adfdbed6a014a412529864a66b09117e6a4bee64:Update xfsprogs Debian maintainer annotation, bump version. (2010-11-11 21:11:44 +1100)
are available in the git repository at:
git://git.kernel.org/pub/scm/fs/xfs/xfsprogs-devkernel-2.6.38-syncDave Chinner (5):
repair: warn if running in low memory mode
xfs_repair: multithread phase 2
libxfs: reintroduce oldxfs_repairradix-tree code
libxlog: sync up with 2.6.38 kernel code
libxfs: sync files with 2.6.38 kernel codedb/attr.c | 16 +- db/attrset.c | 5 +- db/bmap.c | 18 +- db/bmap.h | 4 +- db/check.c | 50 +- db/convert.c | 6 +- db/dir2sf.c | 6 +- db/field.c | 2 +- db/frag.c | 6 +- db/inode.c | 124 ++-- db/metadump.c | 20 +- include/Makefile | 5 +- include/atomic.h | 31 + include/hlist.h | 76 ++ include/libxfs.h | 44 +- include/libxlog.h | 16 +- include/list.h | 11 + include/radix-tree.h | 76 ++ include/xfs_ag.h | 100 ++- include/xfs_alloc.h | 58 +- include/xfs_arch.h | 32 - include/xfs_attr_leaf.h | 12 - include/xfs_attr_sf.h | 42 +- include/xfs_bit.h | 10 +- include/xfs_bmap.h | 133 ++-- include/xfs_bmap_btree.h | 20 +- include/xfs_btree.h | 31 +- include/xfs_btree_trace.h | 17 - include/xfs_buf_item.h | 50 +- include/xfs_da_btree.h | 21 +- include/xfs_dfrag.h | 5 +- include/xfs_dinode.h | 149 ++--- include/xfs_dir2.h | 4 +- include/xfs_dir2_data.h | 2 +- include/xfs_dir2_node.h | 2 - include/xfs_dir2_sf.h | 7 - include/xfs_extfree_item.h | 17 +- include/xfs_fs.h | 30 +- include/xfs_ialloc.h | 30 +- include/xfs_ialloc_btree.h | 23 +- include/xfs_imap.h | 38 - include/xfs_inode.h | 210 +++--- include/xfs_inode_item.h | 32 +- include/xfs_inum.h | 1 - include/xfs_log.h | 70 +- include/xfs_log_priv.h | 331 +++++++-- include/xfs_log_recover.h | 25 +- include/xfs_mount.h | 259 ++----- include/xfs_quota.h | 160 ++-- include/xfs_rtalloc.h | 19 +- include/xfs_sb.h | 168 +++-- include/xfs_trace.h | 85 +++ include/xfs_trans.h | 648 +++-------------- include/xfs_trans_space.h | 2 +- include/xfs_types.h | 18 +- libxfs/Makefile | 2 +- libxfs/init.c | 133 +++- libxfs/logitem.c | 371 +--------- libxfs/radix-tree.c | 805 ++++++++++++++++++++ libxfs/trans.c | 211 ++---- libxfs/util.c | 75 +- libxfs/xfs.h | 49 +- libxfs/xfs_alloc.c | 599 ++++++++-------- libxfs/xfs_alloc_btree.c | 46 +- libxfs/xfs_attr.c | 138 ++-- libxfs/xfs_attr_leaf.c | 135 ++-- libxfs/xfs_bmap.c | 1773 ++++++++++++++++++++++---------------------- libxfs/xfs_bmap_btree.c | 129 ++-- libxfs/xfs_btree.c | 96 ++- libxfs/xfs_da_btree.c | 48 +- libxfs/xfs_dir2.c | 31 +- libxfs/xfs_dir2_block.c | 28 +- libxfs/xfs_dir2_leaf.c | 21 +- libxfs/xfs_dir2_node.c | 29 +- libxfs/xfs_dir2_sf.c | 24 +- libxfs/xfs_ialloc.c | 1157 +++++++++++++++-------------- libxfs/xfs_ialloc_btree.c | 35 +- libxfs/xfs_inode.c | 277 ++++---- libxfs/xfs_mount.c | 123 +--- libxfs/xfs_trans.c | 492 +++++++++++-- libxlog/xfs_log_recover.c | 606 ++++++++------- logprint/log_misc.c | 2 +- logprint/log_print_all.c | 13 +- logprint/log_print_trans.c | 4 +- mkfs/proto.c | 18 +- mkfs/xfs_mkfs.c | 3 +- repair/attr_repair.c | 14 +- repair/dino_chunks.c | 12 +- repair/dinode.c | 275 ++++---- repair/dir.c | 18 +- repair/dir2.c | 22 +- repair/incore.h | 3 + repair/phase2.c | 20 +- repair/phase6.c | 76 +- repair/prefetch.c | 29 +- repair/rt.c | 2 +- repair/scan.c | 294 +++++---- repair/scan.h | 39 +- repair/xfs_repair.c | 26 +- 99 files changed, 6094 insertions(+), 5586 deletions(-) create mode 100644 include/atomic.h create mode 100644 include/hlist.h create mode 100644 include/radix-tree.h delete mode 100644 include/xfs_imap.h create mode 100644 include/xfs_trace.h create mode 100644 libxfs/radix-tree.c_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Quoted 5 lines · Dave Chinner
I just updated these patches at:
git://git.kernel.org/pub/scm/fs/xfs/xfsprogs-devkernel-2.6.38-syncWith all the review comments addressed.
This branch includes the following patch that you did not previously post. I'm going to send the patch out on your behalf shortly, just so it's on the list.
xfs_repair: validate inode di_flaaags field
-Alex
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Alex Elder
Reviewed-byQuoted 5 lines · Dave Chinner
I just updated these patches at:
git://git.kernel.org/pub/scm/fs/xfs/xfsprogs-devkernel-2.6.38-syncWith all the review comments addressed.
It looks to me like you may not have done much with the third patch since I first reviewed it. I'm not going to spend as much time on it this time around, but I will try to condense my original response into a more useful form than the first time.
Please consider my suggestions below. But even if you don't address everything I'm OK with it, provided we ensure we do as much test coverage as possible.
1) Please verify that the updated user space files match an up-to-date version of the kernel headers.
2) Many of the files become identical to their kernel counterparts with this update. Can you create a script that verifies that it's still the case? That will also serve the purpose of documenting which files are identical now.
3) Why are you dropping the use of the symbols XFS_DINODE_VERSION_1 and XFS_DINODE_VERSION_2 in favor of just using 1 and 2? (I guess I'm OK with it, but wanted to call it out anyway.)
A few things on specific files follow. I've dropped a few of the things I commented on the first time around.
include/xfs_fs.h
Quoted 4 lines
include/xfs_fs.h +0
-0
This file looks good. It is now nearly identical to the kernel version, with these exceptions:
- This version includes the definition of bstat_get_projid(). It's used once, but it should be deleted and the one use should be converted to use xfs_get_projid() if that can be arranged.
- XFS_IOC_FREEZE and XFS_IOC_THAW are still defined in this version. The code that uses it here could possibly be converted to use the Linux generic FIFREEZE and FITHAW instead.
include/xfs_inode.h
Quoted 4 lines
include/xfs_inode.h +0
-0
Here is how this file differs from the kernel:
version.
- Missing "xfs: add lockdep annotations for the rt inodes"
- And there are a few lines where prototypes differ (struct versus typedef usage).
include/xfs_mount.h
Quoted 4 lines
include/xfs_mount.h +0
-0
Here is how this file differs from the kernel:
- The perag_get/put function declarations sit in different parts of the file.
libxfs/xfs_inode.c
Quoted 4 lines
libxfs/xfs_inode.c +0
-0
. . .
libxfs/xfs_inode.c xfs_iformat(
Quoted 1 line
libxfs/xfs_inode.c +0
-0@@ -266,55 +277,65 @@ xfs_iformat(
. . .
libxfs/xfs_inode.c xfs_iformat( · line 278
Quoted 2 lines
libxfs/xfs_inode.c +2
-0+if (unlikely ((ip->i_d.di_flags &XFS_DIFLAG_REALTIME ) && + !ip->i_mount->m_rtdev)) {
!ip->i_mount->m_rtdev_targp
With the exception of this, this function is identical to the kernel version. I don't know why there's this difference.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 4 lines · Alex Elder
3) Why are you dropping the use of the symbols
XFS_DINODE_VERSION_1andXFS_DINODE_VERSION_2in favor of just using 1 and 2? (I guess I'm OK with it, but wanted to call it out anyway.)
Because we dropped them from the kernel a while ago. The removal in kernel land was my patch and the reason is that it simply doesn't buy anything over using the numerical constants.
Quoted 4 lines
-
XFS_IOC_FREEZEandXFS_IOC_THAWare still defined in this version. The code that uses it here could possibly be converted to use the Linux generic FIFREEZE and FITHAW instead.
That would require all users to include <linux/fs.h> first.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Alex Elder
Reviewed-byQuoted 10 lines · Dave Chinner
I just updated these patches at:
git://git.kernel.org/pub/scm/fs/xfs/xfsprogs-devkernel-2.6.38-syncWith all the review comments addressed.
Cheers,
Dave.
Below is an edited version of my review for the third patch in this series from an earlier time you posted it for review. I've compared what's in the updated git branch with what I originally said, and have ripped out a lot of stuff I wrote, leaving only the things that I'd like you to consider updating before committing this to the xfsprogs-dev tree.
In general, I assume that your plan is to do an initial commit, then update again later with something that will bring things more closely in line with the kernel code (specifically, I think you mentioned 2.6.38 or .39 on IRC). The code has diverged a bit since last time I looked this over, but I'm pretty sure it will sync up fine later.
Thereafter it would be nice to update with each kernel release. For header files at least, it would be nice to transition our way so we can just point to the kernel headers directory rather than including copies of the header files here.
I'll leave it to your discretion to do what you think is best. Whatever you do, you can consider it reviewed by me.
Quoted 1 line · Dave Chinner
Bring the libxfs headers and code into sync with the 2.6.37 kernel
code.
Quoted 3 lines
Update the rest of xfsprogs to work with the new code.
Note: this does not convert xfsprogs to the kernel
xfs_trans_ijoin
\ijoin_ref
Quoted 2 lines
interface, it maintains the older ijoin/ihold interface because of the different way the inode reference counting works in libxfs. More work
will be
Quoted 1 line
needed to change it over to a manner compatible with the current
kernel API.
Quoted 1 line
------------
db/attrset.c attr_set_f( · line 162
Quoted 11 lines
db/attrset.c +2
-1@@ -158,7 +158,8 @@ attr_set_f( goto out; } -if (libxfs_attr_set (ip, name, value, valuelen, flags)) { + if (libxfs_attr_set(ip, (unsigned char *)name, + (unsigned char *)value, valuelen,
flags)) {
Maybe just change the types of "name" and "value", and cast them when they are assigned. (And drop the needless cast of the value returned by memalign() when you do.)
And another aside in this function. What the hell is this?
memset(value, 0xfeedface, valuelen);
db/attrset.c attr_remove_f( · line 237
Quoted 9 lines
db/attrset.c +1
-1dbprintf (_ ("failed to set attr %s on inode %llu\n" ), name, (unsigned long long )iocur_top->ino); goto out;@@ -233,7 +234,7 @@ attr_remove_f( goto out; } -if (libxfs_attr_remove (ip, name, flags)) { +if (libxfs_attr_remove (ip, (unsigned char *)name, flags)) {
Again, I'd rather see the cast occur when "name" gets assigned.
db/attrset.c attr_remove_f( · line 238
Quoted 1 line
db/attrset.c +0
-0dbprintf(_("failed to remove attr %s from inode %llu
\n"),
db/attrset.c attr_remove_f( · line 240
Quoted 2 lines
db/attrset.c +0
-0name, (unsigned long long)iocur_top->ino); goto out;
------------
include/xfs_fs.h
Quoted 4 lines
include/xfs_fs.h +0
-0
This file looks good. It is now nearly identical to the kernel version, with these exceptions:
- This version includes the definition of bstat_get_projid(). It's used once, but it should be deleted and the one use should be converted to use xfs_get_projid() if that can be arranged.
- XFS_IOC_FREEZE and XFS_IOC_THAW are still defined in this version. The code that uses it here could possibly be converted to use the Linux generic FIFREEZE and FITHAW instead.
------------
include/xfs_mount.h
Quoted 4 lines
include/xfs_mount.h +0
-0
Here is how this file differs from the kernel:
- The perag_get/put function declarations sit in different parts of the file. (Easily reconciled.)
------------
include/xfs_sb.h
Quoted 4 lines
include/xfs_sb.h +0
-0
Kernel is missing xfs_sb_version_addprojid32bit(). Otherwise identical. I'm not sure whether this would be used in the kernel, but maybe we should make the two files identical.
------------
libxfs/xfs_inode.c
Quoted 4 lines
libxfs/xfs_inode.c +0
-0
. . .
libxfs/xfs_inode.c xfs_iformat(
Quoted 1 line
libxfs/xfs_inode.c +0
-0@@ -266,55 +277,65 @@ xfs_iformat(
. . .
libxfs/xfs_inode.c xfs_iformat( · line 278
Quoted 2 lines
libxfs/xfs_inode.c +2
-0+if (unlikely ((ip->i_d.di_flags &XFS_DIFLAG_REALTIME ) && + !ip->i_mount->m_rtdev)) {
!ip->i_mount->m_rtdev_targp
With the exception of this, this function is nearly identical to the kernel version. I don't know why there's this difference.
libxfs/xfs_inode.c xfs_iformat( · line 283
Quoted 5 lines
libxfs/xfs_inode.c +5
-0+xfs_fs_repair_cmn_err (CE_WARN , ip->i_mount, +"corrupt dinode %Lu, has realtime flag set." , + ip->i_ino); + XFS_CORRUPTION_ERROR("xfs_iformat(realtime)", + XFS_ERRLEVEL_LOW, ip->i_mount,
dip);
------------
repair/phase6.c
Quoted 4 lines
repair/phase6.c +0
-0
. . .
repair/phase6.c mk_rbmino(xfs_mount_t *mp) · line 447
Quoted 6 lines
repair/phase6.c +1
-1@@ -444,11 +444,11 @@ mk_rbmino(xfs_mount_t *mp) error); } -memset (&ip->i_d,0 ,sizeof (xfs_dinode_core_t)); +memset (&ip->i_d,0 ,sizeof (xfs_icdinode_t));
Was this just a bug that you're fixing now? (Wrong data type used in the size.) Same thing in mk_rsumino() and mk_root_dir().
. . .
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs