current patch queue for 3.12
cover current patch queue for 3.12
Hi folks,
The following mass of patches is my current patch queue I have pending for the 3.12 cycle. There are 4 main pieces in this:
1. kernel/user libxfs rework
This is the first 34 patches of the series, and they have the single aim of removing all the differences between the shared userspace and kernel code. There are several new header files created for shared user/kernel definitions to remove all the __KERNEL__ sections from our header files. The result is about 1500 lines of code in headers files are no longer needlessly shared with userspace.
Similarly, the C code itself is split up in such a ways that kernel only functionality is separated from the shared code. For example, all the readdir code is moved to xfs_dir2_readdir.c, and all the attribute listing code is moved to xfs_attr_list.c This means that the files shared with userpace are now mostly identical (except for #includes) and don't have big diffs when kernel-only code was cut out of the userspace versions. The only remaining significant differences are in xfs_rtalloc.c (needs splitting into kernel only/shared versions) and the generic btree code (different tracing in userspace).
2. Log space reservation rework from Jeff Liu
Rebasing on the above work, and now takes into account the log stripe unit when determining the maximum transaction reservation size. This will warning if a filesystem config is mounted where the log may actually be physically too small because old mkfs programs didn't take into account the log stripe unit when calculating the minimum size.
3. CIL commit optimisation patchset
This is a split up version of the RFC patch that has had a lot more testing and now doesn't randomly assert fail.
4. Directory entry file type support
This adds a single byte field into the directory entries that indicate the type of inode that the dirent points to. This brings XFS up to the same functionality as ext4 and btrfs, and enables us to support whiteout dirents for union mounts. It also greatly speeds use directory traversals as we no longer need to stat every inode to find out which ones are subdirectories that need to be walked.
I have one remaining bit of functionality to complete for 3.12, and that is a new extent swap implementation for CRC enabled filesystems. I hope to have that complete and ready for review within a week.
This series will be followed by an xfsprogs patchset that complements this series to be applied to the crc-dev branch. It makes all the same changes and gives us the most similar code base between kernel and userspace that we've had in many, many years....
Comments, flames, testing and crazy emails all welcome.
Cheers,
Dave.
$ git diff --stat -C -M --summary --minimal 47188d3..3899f80 fs/xfs/Makefile | 20 +- fs/xfs/xfs_acl.c | 4 +- fs/xfs/xfs_ag.h | 53 - fs/xfs/xfs_alloc.c | 6 +- fs/xfs/xfs_aops.c | 4 +- fs/xfs/xfs_attr.c | 426 +----- fs/xfs/xfs_attr.h | 9 + fs/xfs/xfs_attr_inactive.c | 453 ++++++ fs/xfs/xfs_attr_leaf.c | 655 +------- fs/xfs/xfs_attr_leaf.h | 2 + fs/xfs/xfs_attr_list.c | 655 ++++++++ fs/xfs/xfs_attr_remote.c | 18 +- fs/xfs/xfs_bmap.c | 817 +--------- fs/xfs/xfs_bmap.h | 56 +- fs/xfs/xfs_bmap_btree.c | 6 +- fs/xfs/xfs_bmap_util.c | 2026 ++++++++++++++++++++++++ fs/xfs/xfs_bmap_util.h | 110 ++ fs/xfs/xfs_btree.h | 2 - fs/xfs/xfs_buf.c | 1 + fs/xfs/xfs_buf_item.c | 52 +- fs/xfs/xfs_buf_item.h | 100 +- fs/xfs/xfs_da_btree.c | 8 +- fs/xfs/xfs_da_btree.h | 1 + fs/xfs/xfs_dfrag.c | 459 ------ fs/xfs/xfs_dfrag.h | 53 - fs/xfs/xfs_dir2.c | 42 +- fs/xfs/xfs_dir2.h | 45 + fs/xfs/xfs_dir2_block.c | 122 +- fs/xfs/xfs_dir2_data.c | 25 +- fs/xfs/xfs_dir2_format.h | 186 ++- fs/xfs/xfs_dir2_leaf.c | 404 +---- fs/xfs/xfs_dir2_node.c | 14 +- fs/xfs/xfs_dir2_priv.h | 49 +- fs/xfs/xfs_dir2_readdir.c | 696 +++++++++ fs/xfs/xfs_dir2_sf.c | 240 ++- fs/xfs/xfs_discard.c | 5 +- fs/xfs/xfs_dquot.c | 8 +- fs/xfs/xfs_dquot_item.c | 23 +- fs/xfs/xfs_error.c | 1 - fs/xfs/xfs_export.c | 5 +- fs/xfs/xfs_extfree_item.c | 50 +- fs/xfs/xfs_extfree_item.h | 88 +- fs/xfs/xfs_file.c | 3 +- fs/xfs/xfs_filestream.c | 8 +- fs/xfs/xfs_filestream.h | 4 - fs/xfs/xfs_format.h | 169 ++ fs/xfs/xfs_fs.h | 32 + fs/xfs/xfs_fsops.c | 8 +- fs/xfs/xfs_ialloc.c | 3 +- fs/xfs/xfs_icache.c | 3 +- fs/xfs/xfs_icache.h | 7 + fs/xfs/xfs_icreate_item.c | 21 +- fs/xfs/xfs_icreate_item.h | 18 - fs/xfs/xfs_inode.c | 3732 ++++++++++++++++++--------------------------- fs/xfs/xfs_inode.h | 312 +--- fs/xfs/xfs_inode_buf.c | 444 ++++++ fs/xfs/xfs_inode_buf.h | 52 + fs/xfs/xfs_inode_fork.c | 1921 +++++++++++++++++++++++ fs/xfs/xfs_inode_fork.h | 171 +++ fs/xfs/xfs_inode_item.c | 53 +- fs/xfs/xfs_inode_item.h | 115 +- fs/xfs/xfs_ioctl.c | 113 +- fs/xfs/xfs_ioctl.h | 10 + fs/xfs/xfs_ioctl32.c | 4 +- fs/xfs/xfs_iomap.c | 21 +- fs/xfs/xfs_iops.c | 40 +- fs/xfs/xfs_iops.h | 13 + fs/xfs/xfs_linux.h | 32 + fs/xfs/xfs_log.c | 109 +- fs/xfs/xfs_log.h | 90 +- fs/xfs/xfs_log_cil.c | 369 ++--- fs/xfs/xfs_log_format.h | 846 ++++++++++ fs/xfs/xfs_log_priv.h | 155 +- fs/xfs/xfs_log_recover.c | 12 +- fs/xfs/xfs_log_rlimit.c | 145 ++ fs/xfs/xfs_mount.c | 833 +--------- fs/xfs/xfs_mount.h | 113 +- fs/xfs/xfs_qm.c | 13 +- fs/xfs/xfs_qm_bhv.c | 1 + fs/xfs/xfs_qm_syscalls.c | 15 +- fs/xfs/xfs_quota.h | 260 +--- fs/xfs/xfs_quota_defs.h | 157 ++ fs/xfs/xfs_quotaops.c | 4 +- fs/xfs/xfs_rename.c | 346 ----- fs/xfs/xfs_rtalloc.c | 28 +- fs/xfs/xfs_rtalloc.h | 53 +- fs/xfs/xfs_sb.c | 771 ++++++++++ fs/xfs/xfs_sb.h | 59 +- fs/xfs/xfs_super.c | 6 +- fs/xfs/xfs_symlink.c | 189 +-- fs/xfs/xfs_symlink.h | 41 +- fs/xfs/xfs_symlink_remote.c | 200 +++ fs/xfs/xfs_trace.c | 1 + fs/xfs/xfs_trans.c | 709 +-------- fs/xfs/xfs_trans.h | 293 +--- fs/xfs/xfs_trans_dquot.c | 1 + fs/xfs/xfs_trans_priv.h | 3 + fs/xfs/xfs_trans_resv.c | 769 ++++++++++ fs/xfs/xfs_trans_resv.h | 116 ++ fs/xfs/xfs_types.h | 60 +- fs/xfs/xfs_utils.c | 314 ---- fs/xfs/xfs_utils.h | 27 - fs/xfs/xfs_vnodeops.c | 1870 ----------------------- fs/xfs/xfs_vnodeops.h | 55 - fs/xfs/xfs_xattr.c | 2 +- 105 files changed, 12629 insertions(+), 11714 deletions(-) create mode 100644 fs/xfs/xfs_attr_inactive.c create mode 100644 fs/xfs/xfs_attr_list.c create mode 100644 fs/xfs/xfs_bmap_util.c create mode 100644 fs/xfs/xfs_bmap_util.h delete mode 100644 fs/xfs/xfs_dfrag.c delete mode 100644 fs/xfs/xfs_dfrag.h create mode 100644 fs/xfs/xfs_dir2_readdir.c create mode 100644 fs/xfs/xfs_format.h create mode 100644 fs/xfs/xfs_inode_buf.c create mode 100644 fs/xfs/xfs_inode_buf.h create mode 100644 fs/xfs/xfs_inode_fork.c create mode 100644 fs/xfs/xfs_inode_fork.h create mode 100644 fs/xfs/xfs_log_format.h create mode 100644 fs/xfs/xfs_log_rlimit.c create mode 100644 fs/xfs/xfs_quota_defs.h delete mode 100644 fs/xfs/xfs_rename.c create mode 100644 fs/xfs/xfs_sb.c create mode 100644 fs/xfs/xfs_symlink_remote.c
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 1/49 xfs: separate out log format definitions
From: Dave Chinner <[email protected]>
The on-disk format definitions for the log are spread randoms through a couple of header files. Consolidate it all in a single file that can be shared easily with userspace. This means that xfs_log.h and xfs_log_priv.h no longer need to be shared with userspace.
--- fs/xfs/xfs_log.h | 89 ++++++------------------ fs/xfs/xfs_log_format.h | 178 +++++++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_log_priv.h | 146 ++------------------------------------ fs/xfs/xfs_log_recover.c | 2 + 4 files changed, 207 insertions(+), 208 deletions(-) create mode 100644 fs/xfs/xfs_log_format.h
fs/xfs/xfs_log.h +21 -68
@@ -18,14 +18,29 @@#ifndef __XFS_LOG_H__#define __XFS_LOG_H__ -/* get lsn fields */ -#define CYCLE_LSN (lsn) ((uint)((lsn)>>32)) -#define BLOCK_LSN (lsn) ((uint)(lsn)) +#include "xfs_log_format.h" -/* this is used in a spot where we might otherwise double-endian-flip */ -#define CYCLE_LSN_DISK (lsn) (((__be32 *)&(lsn))[0]) +struct xfs_log_vec { +struct xfs_log_vec *lv_next;/* next lv in build list */ +int lv_niovecs;/* number of iovecs in lv */ +struct xfs_log_iovec *lv_iovecp;/* iovec array */ +struct xfs_log_item *lv_item;/* owner */ +char *lv_buf;/* formatted buffer */ +int lv_buf_len;/* size of formatted buffer */ +}; + +#define XFS_LOG_VEC_ORDERED (-1) + +/* +* Structure used to pass callback function and the function's argument +* to the log manager. +*/ +typedef struct xfs_log_callback { +struct xfs_log_callback *cb_next; +void (*cb_func)(void *,int ); +void *cb_arg; +}xfs_log_callback_t ; -#ifdef __KERNEL__/* * By comparing each component, we don't have to worry about extra * endian issues in treating two 32 bit numbers as one 64 bit number
@@ -59,67 +74,6 @@ static inline xfs_lsn_t _lsn_cmp(xfs_lsn_t lsn1, xfs_lsn_t lsn2)*/ #define XFS_LOG_SYNC 0x1 -#endif /* __KERNEL__ */ - - -/* Log Clients */ -#define XFS_TRANSACTION 0x69 -#define XFS_VOLUME 0x2 -#define XFS_LOG 0xaa - - -/* Region types for iovec's i_type */ -#define XLOG_REG_TYPE_BFORMAT 1 -#define XLOG_REG_TYPE_BCHUNK 2 -#define XLOG_REG_TYPE_EFI_FORMAT 3 -#define XLOG_REG_TYPE_EFD_FORMAT 4 -#define XLOG_REG_TYPE_IFORMAT 5 -#define XLOG_REG_TYPE_ICORE 6 -#define XLOG_REG_TYPE_IEXT 7 -#define XLOG_REG_TYPE_IBROOT 8 -#define XLOG_REG_TYPE_ILOCAL 9 -#define XLOG_REG_TYPE_IATTR_EXT 10 -#define XLOG_REG_TYPE_IATTR_BROOT 11 -#define XLOG_REG_TYPE_IATTR_LOCAL 12 -#define XLOG_REG_TYPE_QFORMAT 13 -#define XLOG_REG_TYPE_DQUOT 14 -#define XLOG_REG_TYPE_QUOTAOFF 15 -#define XLOG_REG_TYPE_LRHEADER 16 -#define XLOG_REG_TYPE_UNMOUNT 17 -#define XLOG_REG_TYPE_COMMIT 18 -#define XLOG_REG_TYPE_TRANSHDR 19 -#define XLOG_REG_TYPE_ICREATE 20 -#define XLOG_REG_TYPE_MAX 20 - -typedef struct xfs_log_iovec { -void *i_addr;/* beginning address of region */ -int i_len;/* length in bytes of region */ -uint i_type;/* type of region */ -}xfs_log_iovec_t ; - -struct xfs_log_vec { -struct xfs_log_vec *lv_next;/* next lv in build list */ -int lv_niovecs;/* number of iovecs in lv */ -struct xfs_log_iovec *lv_iovecp;/* iovec array */ -struct xfs_log_item *lv_item;/* owner */ -char *lv_buf;/* formatted buffer */ -int lv_buf_len;/* size of formatted buffer */ -}; - -#define XFS_LOG_VEC_ORDERED (-1) - -/* -* Structure used to pass callback function and the function's argument -* to the log manager. -*/ -typedef struct xfs_log_callback { -struct xfs_log_callback *cb_next; -void (*cb_func)(void *,int ); -void *cb_arg; -}xfs_log_callback_t ; - - -#ifdef __KERNEL__/* Log manager interfaces */ struct xfs_mount ;struct xlog_in_core ;
@@ -188,5 +142,4 @@ void xfs_log_work_queue(struct xfs_mount *mp);void xfs_log_worker (struct work_struct *work);void xfs_log_quiesce (struct xfs_mount *mp); -#endif #endif /* __XFS_LOG_H__ */
fs/xfs/xfs_log_format.h new file +178 -0
178 lines not on this page · raw message
fs/xfs/xfs_log_priv.h +6 -140
184 lines not on this page · raw message
fs/xfs/xfs_log_recover.c +2 -0
@@ -55,6 +55,8 @@#include "xfs_attr_leaf.h" #include "xfs_attr_remote.h" +#define BLK_AVG (blk1, blk2) ((blk1+blk2) >> 1) + STATIC int xlog_find_zeroed( struct xlog *,
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 01/49] xfs: separate out log format definitions
Quoted 10 lines · Dave Chinner
From: Dave Chinner <[email protected]>
The on-disk format definitions for the log are spread randoms through a couple of header files. Consolidate it all in a single file that can be shared easily with userspace. This means that
xfs_log.handxfs_log_priv.hno longer need to be shared with userspace.Signed-off-by Dave Chinner <[email protected]>---
Quoted 505 lines
fs/xfs/xfs_log.h | 89 ++++++------------------ fs/xfs/xfs_log_format.h | 178 +++++++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_log_priv.h | 146 ++------------------------------------ fs/xfs/xfs_log_recover.c | 2 + 4 files changed, 207 insertions(+), 208 deletions(-) create mode 100644 fs/xfs/xfs_log_format.hfs/xfs/xfs_log.h +21
-68@@ -18,14 +18,29 @@#ifndef __XFS_LOG_H__#define __XFS_LOG_H__ -/* get lsn fields */ -#define CYCLE_LSN (lsn) ((uint)((lsn)>>32)) -#define BLOCK_LSN (lsn) ((uint)(lsn)) +#include "xfs_log_format.h" -/* this is used in a spot where we might otherwise double-endian-flip */ -#define CYCLE_LSN_DISK (lsn) (((__be32 *)&(lsn))[0]) +struct xfs_log_vec { +struct xfs_log_vec *lv_next;/* next lv in build list */ +int lv_niovecs;/* number of iovecs in lv */ +struct xfs_log_iovec *lv_iovecp;/* iovec array */ +struct xfs_log_item *lv_item;/* owner */ +char *lv_buf;/* formatted buffer */ +int lv_buf_len;/* size of formatted buffer */ +}; + +#define XFS_LOG_VEC_ORDERED (-1) + +/* +* Structure used to pass callback function and the function's argument +* to the log manager. +*/ +typedef struct xfs_log_callback { +struct xfs_log_callback *cb_next; +void (*cb_func)(void *,int ); +void *cb_arg; +}xfs_log_callback_t ; -#ifdef __KERNEL__/* * By comparing each component, we don't have to worry about extra * endian issues in treating two 32 bit numbers as one 64 bit number @@ -59,67 +74,6 @@ static inline xfs_lsn_t _lsn_cmp(xfs_lsn_t lsn1, xfs_lsn_t lsn2)*/ #define XFS_LOG_SYNC 0x1 -#endif /* __KERNEL__ */ - - -/* Log Clients */ -#define XFS_TRANSACTION 0x69 -#define XFS_VOLUME 0x2 -#define XFS_LOG 0xaa - - -/* Region types for iovec's i_type */ -#define XLOG_REG_TYPE_BFORMAT 1 -#define XLOG_REG_TYPE_BCHUNK 2 -#define XLOG_REG_TYPE_EFI_FORMAT 3 -#define XLOG_REG_TYPE_EFD_FORMAT 4 -#define XLOG_REG_TYPE_IFORMAT 5 -#define XLOG_REG_TYPE_ICORE 6 -#define XLOG_REG_TYPE_IEXT 7 -#define XLOG_REG_TYPE_IBROOT 8 -#define XLOG_REG_TYPE_ILOCAL 9 -#define XLOG_REG_TYPE_IATTR_EXT 10 -#define XLOG_REG_TYPE_IATTR_BROOT 11 -#define XLOG_REG_TYPE_IATTR_LOCAL 12 -#define XLOG_REG_TYPE_QFORMAT 13 -#define XLOG_REG_TYPE_DQUOT 14 -#define XLOG_REG_TYPE_QUOTAOFF 15 -#define XLOG_REG_TYPE_LRHEADER 16 -#define XLOG_REG_TYPE_UNMOUNT 17 -#define XLOG_REG_TYPE_COMMIT 18 -#define XLOG_REG_TYPE_TRANSHDR 19 -#define XLOG_REG_TYPE_ICREATE 20 -#define XLOG_REG_TYPE_MAX 20 - -typedef struct xfs_log_iovec { -void *i_addr;/* beginning address of region */ -int i_len;/* length in bytes of region */ -uint i_type;/* type of region */ -}xfs_log_iovec_t ; - -struct xfs_log_vec { -struct xfs_log_vec *lv_next;/* next lv in build list */ -int lv_niovecs;/* number of iovecs in lv */ -struct xfs_log_iovec *lv_iovecp;/* iovec array */ -struct xfs_log_item *lv_item;/* owner */ -char *lv_buf;/* formatted buffer */ -int lv_buf_len;/* size of formatted buffer */ -}; - -#define XFS_LOG_VEC_ORDERED (-1) - -/* -* Structure used to pass callback function and the function's argument -* to the log manager. -*/ -typedef struct xfs_log_callback { -struct xfs_log_callback *cb_next; -void (*cb_func)(void *,int ); -void *cb_arg; -}xfs_log_callback_t ; - - -#ifdef __KERNEL__/* Log manager interfaces */ struct xfs_mount ;struct xlog_in_core ;@@ -188,5 +142,4 @@ void xfs_log_work_queue(struct xfs_mount *mp);void xfs_log_worker (struct work_struct *work);void xfs_log_quiesce (struct xfs_mount *mp); -#endif #endif /* __XFS_LOG_H__ */ fs/xfs/xfs_log_format.h new file +178
-0@@ -0,0 +1,178 @@ +/* +* Copyright (c) 2000-2003,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_LOG_FORMAT_H__ +#define __XFS_LOG_FORMAT_H__ + +typedef __uint32_t xlog_tid_t ; + +#define XLOG_MIN_ICLOGS 2 +#define XLOG_MAX_ICLOGS 8 +#define XLOG_HEADER_MAGIC_NUM 0xFEEDbabe/* Invalid cycle number */ +#define XLOG_VERSION_1 1 +#define XLOG_VERSION_2 2/* Large IClogs, Log sunit */ +#define XLOG_VERSION_OKBITS (XLOG_VERSION_1 | XLOG_VERSION_2) +#define XLOG_MIN_RECORD_BSIZE (16*1024)/* eventually 32k */ +#define XLOG_BIG_RECORD_BSIZE (32*1024)/* 32k buffers */ +#define XLOG_MAX_RECORD_BSIZE (256*1024) +#define XLOG_HEADER_CYCLE_SIZE (32*1024)/* cycle data in header */ +#define XLOG_MIN_RECORD_BSHIFT 14/* 16384 == 1 << 14 */ +#define XLOG_BIG_RECORD_BSHIFT 15/* 32k == 1 << 15 */ +#define XLOG_MAX_RECORD_BSHIFT 18/* 256k == 1 << 18 */ +#define XLOG_BTOLSUNIT (log, b) (((b)+(log)->l_mp->m_sb.sb_logsunit-1) / \ + (log)->l_mp->m_sb.sb_logsunit) +#define XLOG_LSUNITTOB (log, su) ((su) * (log)->l_mp->m_sb.sb_logsunit) + +#define XLOG_HEADER_SIZE 512 + +#define XLOG_REC_SHIFT (log) \ + BTOBB(1 << (xfs_sb_version_haslogv2(&log->l_mp->m_sb) ? \ + XLOG_MAX_RECORD_BSHIFT : XLOG_BIG_RECORD_BSHIFT)) +#define XLOG_TOTAL_REC_SHIFT (log) \ + BTOBB(XLOG_MAX_ICLOGS << (xfs_sb_version_haslogv2(&log->l_mp->m_sb) ? \ + XLOG_MAX_RECORD_BSHIFT : XLOG_BIG_RECORD_BSHIFT)) + +/* get lsn fields */ +#define CYCLE_LSN (lsn) ((uint)((lsn)>>32)) +#define BLOCK_LSN (lsn) ((uint)(lsn)) + +/* this is used in a spot where we might otherwise double-endian-flip */ +#define CYCLE_LSN_DISK (lsn) (((__be32 *)&(lsn))[0]) + +static inline xfs_lsn_t xlog_assign_lsn (uint cycle,uint block) +{ +return ((xfs_lsn_t )cycle <<32 ) | block; +} + +static inline uint xlog_get_cycle (char *ptr) +{ +if (be32_to_cpu (*(__be32 *)ptr) ==XLOG_HEADER_MAGIC_NUM ) +return be32_to_cpu (*((__be32 *)ptr +1 )); +else +return be32_to_cpu (*(__be32 *)ptr); +} + +/* Log Clients */ +#define XFS_TRANSACTION 0x69 +#define XFS_VOLUME 0x2 +#define XFS_LOG 0xaa + +#define XLOG_UNMOUNT_TYPE 0x556e/* Un for Unmount */ + +/* Region types for iovec's i_type */ +#define XLOG_REG_TYPE_BFORMAT 1 +#define XLOG_REG_TYPE_BCHUNK 2 +#define XLOG_REG_TYPE_EFI_FORMAT 3 +#define XLOG_REG_TYPE_EFD_FORMAT 4 +#define XLOG_REG_TYPE_IFORMAT 5 +#define XLOG_REG_TYPE_ICORE 6 +#define XLOG_REG_TYPE_IEXT 7 +#define XLOG_REG_TYPE_IBROOT 8 +#define XLOG_REG_TYPE_ILOCAL 9 +#define XLOG_REG_TYPE_IATTR_EXT 10 +#define XLOG_REG_TYPE_IATTR_BROOT 11 +#define XLOG_REG_TYPE_IATTR_LOCAL 12 +#define XLOG_REG_TYPE_QFORMAT 13 +#define XLOG_REG_TYPE_DQUOT 14 +#define XLOG_REG_TYPE_QUOTAOFF 15 +#define XLOG_REG_TYPE_LRHEADER 16 +#define XLOG_REG_TYPE_UNMOUNT 17 +#define XLOG_REG_TYPE_COMMIT 18 +#define XLOG_REG_TYPE_TRANSHDR 19 +#define XLOG_REG_TYPE_ICREATE 20 +#define XLOG_REG_TYPE_MAX 20 + +/* +* Flags to log operation header +* +* The first write of a new transaction will be preceded with a start +* record, XLOG_START_TRANS. Once a transaction is committed, a commit +* record is written, XLOG_COMMIT_TRANS. If a single region can not fit into +* the remainder of the current active in-core log, it is split up into +* multiple regions. Each partial region will be marked with a +* XLOG_CONTINUE_TRANS until the last one, which gets marked with XLOG_END_TRANS. +* +*/ +#define XLOG_START_TRANS 0x01/* Start a new transaction */ +#define XLOG_COMMIT_TRANS 0x02/* Commit this transaction */ +#define XLOG_CONTINUE_TRANS 0x04/* Cont this trans into new region */ +#define XLOG_WAS_CONT_TRANS 0x08/* Cont this trans into new region */ +#define XLOG_END_TRANS 0x10/* End a continued transaction */ +#define XLOG_UNMOUNT_TRANS 0x20/* Unmount a filesystem transaction */ + + +typedef struct xlog_op_header { +__be32 oh_tid;/* transaction id of operation : 4 b */ +__be32 oh_len;/* bytes in data region : 4 b */ +__u8 oh_clientid;/* who sent me this : 1 b */ +__u8 oh_flags;/* : 1 b */ +__u16 oh_res2;/* 32 bit align : 2 b */ +}xlog_op_header_t ; + + +/* valid values for h_fmt */ +#define XLOG_FMT_UNKNOWN 0 +#define XLOG_FMT_LINUX_LE 1 +#define XLOG_FMT_LINUX_BE 2 +#define XLOG_FMT_IRIX_BE 3 + +/* our fmt */ +#ifdef XFS_NATIVE_HOST +#define XLOG_FMT XLOG_FMT_LINUX_BE +#else +#define XLOG_FMT XLOG_FMT_LINUX_LE +#endif + +typedef struct xlog_rec_header { +__be32 h_magicno;/* log record (LR) identifier : 4 */ +__be32 h_cycle;/* write cycle of log : 4 */ +__be32 h_version;/* LR version : 4 */ +__be32 h_len;/* len in bytes; should be 64-bit aligned: 4 */ +__be64 h_lsn;/* lsn of this LR : 8 */ +__be64 h_tail_lsn;/* lsn of 1st LR w/ buffers not committed: 8 */ +__le32 h_crc;/* crc of log record : 4 */ +__be32 h_prev_block;/* block number to previous LR : 4 */ +__be32 h_num_logops;/* number of log operations in this LR : 4 */ +__be32 h_cycle_data[XLOG_HEADER_CYCLE_SIZE /BBSIZE ]; +/* new fields */ +__be32 h_fmt;/* format of log record : 4 */ +uuid_t h_fs_uuid;/* uuid of FS : 16 */ +__be32 h_size;/* iclog size : 4 */ +}xlog_rec_header_t ; + +typedef struct xlog_rec_ext_header { +__be32 xh_cycle;/* write cycle of log : 4 */ +__be32 xh_cycle_data[XLOG_HEADER_CYCLE_SIZE /BBSIZE ];/* : 256 */ +}xlog_rec_ext_header_t ; + +/* +* Quite misnamed, because this union lays out the actual on-disk log buffer. +*/ +typedef union xlog_in_core2 { +xlog_rec_header_t hic_header; +xlog_rec_ext_header_t hic_xheader; +char hic_sector[XLOG_HEADER_SIZE ]; +}xlog_in_core_2_t ; + +/* not an on-disk structure, but needed by log recovery in userspace */ +typedef struct xfs_log_iovec { +void *i_addr;/* beginning address of region */ +int i_len;/* length in bytes of region */ +uint i_type;/* type of region */ +}xfs_log_iovec_t ; + +#endif /* __XFS_LOG_FORMAT_H__ */ fs/xfs/xfs_log_priv.h +6
-140@@ -24,51 +24,13 @@ struct xlog_ticket;struct xfs_mount ;/* -* Macros, structures, prototypes for internal log manager use. +* Flags for log structure */ - -#define XLOG_MIN_ICLOGS 2 -#define XLOG_MAX_ICLOGS 8 -#define XLOG_HEADER_MAGIC_NUM 0xFEEDbabe/* Invalid cycle number */ -#define XLOG_VERSION_1 1 -#define XLOG_VERSION_2 2/* Large IClogs, Log sunit */ -#define XLOG_VERSION_OKBITS (XLOG_VERSION_1 | XLOG_VERSION_2) -#define XLOG_MIN_RECORD_BSIZE (16*1024)/* eventually 32k */ -#define XLOG_BIG_RECORD_BSIZE (32*1024)/* 32k buffers */ -#define XLOG_MAX_RECORD_BSIZE (256*1024) -#define XLOG_HEADER_CYCLE_SIZE (32*1024)/* cycle data in header */ -#define XLOG_MIN_RECORD_BSHIFT 14/* 16384 == 1 << 14 */ -#define XLOG_BIG_RECORD_BSHIFT 15/* 32k == 1 << 15 */ -#define XLOG_MAX_RECORD_BSHIFT 18/* 256k == 1 << 18 */ -#define XLOG_BTOLSUNIT (log, b) (((b)+(log)->l_mp->m_sb.sb_logsunit-1) / \ - (log)->l_mp->m_sb.sb_logsunit) -#define XLOG_LSUNITTOB (log, su) ((su) * (log)->l_mp->m_sb.sb_logsunit) - -#define XLOG_HEADER_SIZE 512 - -#define XLOG_REC_SHIFT (log) \ - BTOBB(1 << (xfs_sb_version_haslogv2(&log->l_mp->m_sb) ? \ - XLOG_MAX_RECORD_BSHIFT : XLOG_BIG_RECORD_BSHIFT)) -#define XLOG_TOTAL_REC_SHIFT (log) \ - BTOBB(XLOG_MAX_ICLOGS << (xfs_sb_version_haslogv2(&log->l_mp->m_sb) ? \ - XLOG_MAX_RECORD_BSHIFT : XLOG_BIG_RECORD_BSHIFT)) - -static inline xfs_lsn_t xlog_assign_lsn (uint cycle,uint block) -{ -return ((xfs_lsn_t )cycle <<32 ) | block; -} - -static inline uint xlog_get_cycle (char *ptr) -{ -if (be32_to_cpu (*(__be32 *)ptr) ==XLOG_HEADER_MAGIC_NUM ) -return be32_to_cpu (*((__be32 *)ptr +1 )); -else -return be32_to_cpu (*(__be32 *)ptr); -} - -#define BLK_AVG (blk1, blk2) ((blk1+blk2) >> 1) - -#ifdef __KERNEL__ +#define XLOG_ACTIVE_RECOVERY 0x2/* in the middle of recovery */ +#define XLOG_RECOVERY_NEEDED 0x4/* log was recovered */ +#define XLOG_IO_ERROR 0x8/* log hit an I/O error, and being +shutdown */ +#define XLOG_TAIL_WARN 0x10/* log tail verify warning issued */ /* * get client id from packed copy. @@ -101,28 +63,8 @@ static inline uint xlog_get_client_id(__be32 i)#define XLOG_STATE_IOERROR 0x0080/* IO error happened in sync'ing log */ #define XLOG_STATE_ALL 0x7FFF/* All possible valid flags */ #define XLOG_STATE_NOTUSED 0x8000/* This IC log not being used */ -#endif /* __KERNEL__ */ /* -* Flags to log operation header -* -* The first write of a new transaction will be preceded with a start -* record, XLOG_START_TRANS. Once a transaction is committed, a commit -* record is written, XLOG_COMMIT_TRANS. If a single region can not fit into -* the remainder of the current active in-core log, it is split up into -* multiple regions. Each partial region will be marked with a -* XLOG_CONTINUE_TRANS until the last one, which gets marked with XLOG_END_TRANS. -* -*/ -#define XLOG_START_TRANS 0x01/* Start a new transaction */ -#define XLOG_COMMIT_TRANS 0x02/* Commit this transaction */ -#define XLOG_CONTINUE_TRANS 0x04/* Cont this trans into new region */ -#define XLOG_WAS_CONT_TRANS 0x08/* Cont this trans into new region */ -#define XLOG_END_TRANS 0x10/* End a continued transaction */ -#define XLOG_UNMOUNT_TRANS 0x20/* Unmount a filesystem transaction */ - -#ifdef __KERNEL__ -/* * Flags to log ticket */ #define XLOG_TIC_INITED 0x1/* has been initialized */ @@ -132,22 +74,6 @@ static inline uint xlog_get_client_id(__be32 i) { XLOG_TIC_INITED, "XLOG_TIC_INITED" }, \ { XLOG_TIC_PERM_RESERV, "XLOG_TIC_PERM_RESERV" } -#endif /* __KERNEL__ */ - -#define XLOG_UNMOUNT_TYPE 0x556e/* Un for Unmount */ - -/* -* Flags for log structure -*/ -#define XLOG_ACTIVE_RECOVERY 0x2/* in the middle of recovery */ -#define XLOG_RECOVERY_NEEDED 0x4/* log was recovered */ -#define XLOG_IO_ERROR 0x8/* log hit an I/O error, and being -shutdown */ -#define XLOG_TAIL_WARN 0x10/* log tail verify warning issued */ - -typedef __uint32_t xlog_tid_t ; - -#ifdef __KERNEL__/* * Below are states for covering allocation transactions. * By covering, we mean changing the h_tail_lsn in the last on-disk @@ -223,7 +149,6 @@ typedef __uint32_t xlog_tid_t;#define XLOG_COVER_OPS 5 -/* Ticket reservation region accounting */ #define XLOG_TIC_LEN_MAX 15@@ -258,64 +183,6 @@ typedef struct xlog_ticket {xlog_res_t t_res_arr[XLOG_TIC_LEN_MAX ];/* array of res : 8 * 15 */ } xlog_ticket_t; -#endif - - -typedef struct xlog_op_header { -__be32 oh_tid;/* transaction id of operation : 4 b */ -__be32 oh_len;/* bytes in data region : 4 b */ -__u8 oh_clientid;/* who sent me this : 1 b */ -__u8 oh_flags;/* : 1 b */ -__u16 oh_res2;/* 32 bit align : 2 b */ -}xlog_op_header_t ; - - -/* valid values for h_fmt */ -#define XLOG_FMT_UNKNOWN 0 -#define XLOG_FMT_LINUX_LE 1 -#define XLOG_FMT_LINUX_BE 2 -#define XLOG_FMT_IRIX_BE 3 - -/* our fmt */ -#ifdef XFS_NATIVE_HOST -#define XLOG_FMT XLOG_FMT_LINUX_BE -#else -#define XLOG_FMT XLOG_FMT_LINUX_LE -#endif - -typedef struct xlog_rec_header { -__be32 h_magicno;/* log record (LR) identifier : 4 */ -__be32 h_cycle;/* write cycle of log : 4 */ -__be32 h_version;/* LR version : 4 */ -__be32 h_len;/* len in bytes; should be 64-bit aligned: 4 */ -__be64 h_lsn;/* lsn of this LR : 8 */ -__be64 h_tail_lsn;/* lsn of 1st LR w/ buffers not committed: 8 */ -__le32 h_crc;/* crc of log record : 4 */ -__be32 h_prev_block;/* block number to previous LR : 4 */ -__be32 h_num_logops;/* number of log operations in this LR : 4 */ -__be32 h_cycle_data[XLOG_HEADER_CYCLE_SIZE /BBSIZE ]; -/* new fields */ -__be32 h_fmt;/* format of log record : 4 */ -uuid_t h_fs_uuid;/* uuid of FS : 16 */ -__be32 h_size;/* iclog size : 4 */ -}xlog_rec_header_t ; - -typedef struct xlog_rec_ext_header { -__be32 xh_cycle;/* write cycle of log : 4 */ -__be32 xh_cycle_data[XLOG_HEADER_CYCLE_SIZE /BBSIZE ];/* : 256 */ -}xlog_rec_ext_header_t ; - -#ifdef __KERNEL__ - -/* -* Quite misnamed, because this union lays out the actual on-disk log buffer. -*/ -typedef union xlog_in_core2 { -xlog_rec_header_t hic_header; -xlog_rec_ext_header_t hic_xheader; -char hic_sector[XLOG_HEADER_SIZE ]; -}xlog_in_core_2_t ; -/* * - A log record header is 512 bytes. There is plenty of room to grow the * xlog_rec_header_t into the reserved space. @@ -686,6 +553,5 @@ static inline void xlog_wait(wait_queue_head_t *wq, spinlock_t *lock)schedule (); remove_wait_queue(wq, &wait); } -#endif /* __KERNEL__ */ #endif /* __XFS_LOG_PRIV_H__ */ fs/xfs/xfs_log_recover.c +0
-0
fs/xfs/xfs_log_recover.c line 62
Quoted 8 lines
fs/xfs/xfs_log_recover.c +2
-0@@ -55,6 +55,8 @@#include "xfs_attr_leaf.h" #include "xfs_attr_remote.h" +#define BLK_AVG (blk1, blk2) ((blk1+blk2) >> 1) + STATIC int xlog_find_zeroed( struct xlog *,
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 2/49 xfs: split out inode log item format definition
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Th elog item format definitions are shared with userspace. split the out of header files that contain kernel only defintions to make it simple to shared them.
--- fs/xfs/xfs_acl.c | 1 + fs/xfs/xfs_filestream.c | 2 +- fs/xfs/xfs_inode.h | 69 ------------------ fs/xfs/xfs_inode_item.h | 115 +---------------------------- fs/xfs/xfs_log_format.h | 189 ++++++++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_types.h | 6 ++ fs/xfs/xfs_xattr.c | 1 + 7 files changed, 200 insertions(+), 183 deletions(-)
fs/xfs/xfs_acl.c +1 -0
@@ -16,6 +16,7 @@* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "xfs.h" +#include "xfs_log_format.h" #include "xfs_acl.h" #include "xfs_attr.h" #include "xfs_bmap_btree.h"
fs/xfs/xfs_filestream.c +1 -1
@@ -16,12 +16,12 @@* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "xfs.h" +#include "xfs_log.h" #include "xfs_bmap_btree.h" #include "xfs_inum.h" #include "xfs_dinode.h" #include "xfs_inode.h" #include "xfs_ag.h" -#include "xfs_log.h" #include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_mount.h"
fs/xfs/xfs_inode.h +0 -69
87 lines not on this page · raw message
fs/xfs/xfs_inode_item.h +2 -113
138 lines not on this page · raw message
fs/xfs/xfs_log_format.h +189 -0
199 lines not on this page · raw message
fs/xfs/xfs_types.h +6 -0
@@ -146,6 +146,12 @@ typedef __uint64_t xfs_filblks_t; /* number of blocks in a file */#define XFS_MAX_SECTORSIZE (1 << XFS_MAX_SECTORSIZE_LOG)/* +* Inode fork identifiers. +*/ +#define XFS_DATA_FORK 0 +#define XFS_ATTR_FORK 1 + +/* * Min numbers of data/attr fork btree root pointers. */ #define MINDBTPTRS 3
fs/xfs/xfs_xattr.c +1 -0
@@ -17,6 +17,7 @@*/ #include "xfs.h" +#include "xfs_log_format.h" #include "xfs_da_btree.h" #include "xfs_bmap_btree.h" #include "xfs_inode.h"
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 02/49] xfs: split out inode log item format definition
Quoted 8 lines · Dave Chinner
From: Dave Chinner <[email protected]>
Th elog item format definitions are shared with userspace. split the out of header files that contain kernel only defintions to make it simple to shared them.
Signed-off-by Dave Chinner <[email protected]>---
Quoted 506 lines
fs/xfs/xfs_acl.c | 1 + fs/xfs/xfs_filestream.c | 2 +- fs/xfs/xfs_inode.h | 69 ------------------ fs/xfs/xfs_inode_item.h | 115 +---------------------------- fs/xfs/xfs_log_format.h | 189 ++++++++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_types.h | 6 ++ fs/xfs/xfs_xattr.c | 1 + 7 files changed, 200 insertions(+), 183 deletions(-)fs/xfs/xfs_acl.c +1
-0@@ -16,6 +16,7 @@* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "xfs.h" +#include "xfs_log_format.h" #include "xfs_acl.h" #include "xfs_attr.h" #include "xfs_bmap_btree.h" fs/xfs/xfs_filestream.c +1
-1@@ -16,12 +16,12 @@* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "xfs.h" +#include "xfs_log.h" #include "xfs_bmap_btree.h" #include "xfs_inum.h" #include "xfs_dinode.h" #include "xfs_inode.h" #include "xfs_ag.h" -#include "xfs_log.h" #include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_mount.h" fs/xfs/xfs_inode.h +0
-69@@ -23,12 +23,6 @@ struct xfs_dinode;struct xfs_inode ;/* -* Fork identifiers. -*/ -#define XFS_DATA_FORK 0 -#define XFS_ATTR_FORK 1 - -/* * The following xfs_ext_irec_t struct introduces a second (top) level * to the in-core extent allocation scheme. These structs are allocated * in a contiguous block, creating an indirection array where each entry @@ -114,68 +108,6 @@ struct xfs_imap {* chain off the mount structure by xfs_sync calls. */ -typedef struct xfs_ictimestamp { -__int32_t t_sec;/* timestamp seconds */ -__int32_t t_nsec;/* timestamp nanoseconds */ -}xfs_ictimestamp_t ; - -/* -* NOTE: This structure must be kept identical to struct xfs_dinode -* in xfs_dinode.h except for the endianness annotations. -*/ -typedef struct xfs_icdinode { -__uint16_t di_magic;/* inode magic # = XFS_DINODE_MAGIC */ -__uint16_t di_mode;/* mode and type of file */ -__int8_t di_version;/* inode version */ -__int8_t di_format;/* format of di_c data */ -__uint16_t di_onlink;/* old number of links to file */ -__uint32_t di_uid;/* owner's user id */ -__uint32_t di_gid;/* owner's group id */ -__uint32_t di_nlink;/* number of links to file */ -__uint16_t di_projid_lo;/* lower part of owner's project id */ -__uint16_t di_projid_hi;/* higher part of owner's project id */ -__uint8_t di_pad[6 ];/* unused, zeroed space */ -__uint16_t di_flushiter;/* incremented on flush */ -xfs_ictimestamp_t di_atime;/* time last accessed */ -xfs_ictimestamp_t di_mtime;/* time last modified */ -xfs_ictimestamp_t di_ctime;/* time created/inode modified */ -xfs_fsize_t di_size;/* number of bytes in file */ -xfs_drfsbno_t di_nblocks;/* # of direct & btree blocks used */ -xfs_extlen_t di_extsize;/* basic/minimum extent size for file */ -xfs_extnum_t di_nextents;/* number of extents in data fork */ -xfs_aextnum_t di_anextents;/* number of extents in attribute fork*/ -__uint8_t di_forkoff;/* attr fork offs, <<3 for 64b align */ -__int8_t di_aformat;/* format of attr fork's data */ -__uint32_t di_dmevmask;/* DMIG event mask */ -__uint16_t di_dmstate;/* DMIG state info */ -__uint16_t di_flags;/* random flags, XFS_DIFLAG_... */ -__uint32_t di_gen;/* generation number */ - -/* di_next_unlinked is the only non-core field in the old dinode */ -xfs_agino_t di_next_unlinked;/* agi unlinked list ptr */ - -/* start of the extended dinode, writable fields */ -__uint32_t di_crc;/* CRC of the inode */ -__uint64_t di_changecount;/* number of attribute changes */ -xfs_lsn_t di_lsn;/* flush sequence */ -__uint64_t di_flags2;/* more random flags */ -__uint8_t di_pad2[16 ];/* more padding for future expansion */ - -/* fields only written to during inode creation */ -xfs_ictimestamp_t di_crtime;/* time created */ -xfs_ino_t di_ino;/* inode number */ -uuid_t di_uuid;/* UUID of the filesystem */ - -/* structure must be padded to 64 bit alignment */ -}xfs_icdinode_t ; - -static inline uint xfs_icdinode_size (int version) -{ -if (version ==3 ) -return sizeof (struct xfs_icdinode ); -return offsetof(struct xfs_icdinode , di_next_unlinked); -} -/* * Flags for xfs_ichgtime(). */ @@ -626,7 +558,6 @@ void xfs_inobp_check(struct xfs_mount *, struct xfs_buf *);extern struct kmem_zone *xfs_ifork_zone;extern struct kmem_zone *xfs_inode_zone; -extern struct kmem_zone *xfs_ili_zone;extern const struct xfs_buf_ops xfs_inode_buf_ops;#endif /* __XFS_INODE_H__ */ fs/xfs/xfs_inode_item.h +2
-113@@ -18,123 +18,13 @@ #ifndef __XFS_INODE_ITEM_H__ #define __XFS_INODE_ITEM_H__ -/* - * This is the structure used to lay out an inode log item in the - * log. The size of the inline data/extents/b-tree root to be logged - * (if any) is indicated in the ilf_dsize field. Changes to this structure - * must be added on to the end. - */ -typedef struct xfs_inode_log_format { - __uint16_t ilf_type; /* inode log item type */ - __uint16_t ilf_size; /* size of this item */ - __uint32_t ilf_fields; /* flags for fields logged */ - __uint16_t ilf_asize; /* size of attr d/ext/root */ - __uint16_t ilf_dsize; /* size of data/ext/root */ - __uint64_t ilf_ino; /* inode number */ - union { - __uint32_t ilfu_rdev; /* rdev value for dev inode*/ - uuid_t ilfu_uuid; /* mount point value */ - } ilf_u; - __int64_t ilf_blkno; /* blkno of inode buffer */ - __int32_t ilf_len; /* len of inode buffer */ - __int32_t ilf_boffset; /* off of inode in buffer */ -} xfs_inode_log_format_t; - -typedef struct xfs_inode_log_format_32 { - __uint16_t ilf_type; /* inode log item type */ - __uint16_t ilf_size; /* size of this item */ - __uint32_t ilf_fields; /* flags for fields logged */ - __uint16_t ilf_asize; /* size of attr d/ext/root */ - __uint16_t ilf_dsize; /* size of data/ext/root */ - __uint64_t ilf_ino; /* inode number */ - union { - __uint32_t ilfu_rdev; /* rdev value for dev inode*/ - uuid_t ilfu_uuid; /* mount point value */ - } ilf_u; - __int64_t ilf_blkno; /* blkno of inode buffer */ - __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; - -typedef struct xfs_inode_log_format_64 { - __uint16_t ilf_type; /* inode log item type */ - __uint16_t ilf_size; /* size of this item */ - __uint32_t ilf_fields; /* flags for fields logged */ - __uint16_t ilf_asize; /* size of attr d/ext/root */ - __uint16_t ilf_dsize; /* size of data/ext/root */ - __uint32_t ilf_pad; /* pad for 64 bit boundary */ - __uint64_t ilf_ino; /* inode number */ - union { - __uint32_t ilfu_rdev; /* rdev value for dev inode*/ - uuid_t ilfu_uuid; /* mount point value */ - } ilf_u; - __int64_t ilf_blkno; /* blkno of inode buffer */ - __int32_t ilf_len; /* len of inode buffer */ - __int32_t ilf_boffset; /* off of inode in buffer */ -} xfs_inode_log_format_64_t; - -/* - * Flags for xfs_trans_log_inode flags field. - */ -#define XFS_ILOG_CORE 0x001 /* log standard inode fields */ -#define XFS_ILOG_DDATA 0x002 /* log i_df.if_data */ -#define XFS_ILOG_DEXT 0x004 /* log i_df.if_extents */ -#define XFS_ILOG_DBROOT 0x008 /* log i_df.i_broot */ -#define XFS_ILOG_DEV 0x010 /* log the dev field */ -#define XFS_ILOG_UUID 0x020 /* log the uuid field */ -#define XFS_ILOG_ADATA 0x040 /* log i_af.if_data */ -#define XFS_ILOG_AEXT 0x080 /* log i_af.if_extents */ -#define XFS_ILOG_ABROOT 0x100 /* log i_af.i_broot */ - - -/* - * The timestamps are dirty, but not necessarily anything else in the inode - * core. Unlike the other fields above this one must never make it to disk - * in the ilf_fields of the inode_log_format, but is purely store in-memory in - * ili_fields in the inode_log_item. - */ -#define XFS_ILOG_TIMESTAMP 0x4000 - -#define XFS_ILOG_NONCORE (XFS_ILOG_DDATA | XFS_ILOG_DEXT | \ - XFS_ILOG_DBROOT | XFS_ILOG_DEV | \ - XFS_ILOG_UUID | XFS_ILOG_ADATA | \ - XFS_ILOG_AEXT | XFS_ILOG_ABROOT) - -#define XFS_ILOG_DFORK (XFS_ILOG_DDATA | XFS_ILOG_DEXT | \ - XFS_ILOG_DBROOT) - -#define XFS_ILOG_AFORK (XFS_ILOG_ADATA | XFS_ILOG_AEXT | \ - XFS_ILOG_ABROOT) - -#define XFS_ILOG_ALL (XFS_ILOG_CORE | XFS_ILOG_DDATA | \ - XFS_ILOG_DEXT | XFS_ILOG_DBROOT | \ - XFS_ILOG_DEV | XFS_ILOG_UUID | \ - XFS_ILOG_ADATA | XFS_ILOG_AEXT | \ - XFS_ILOG_ABROOT | XFS_ILOG_TIMESTAMP) - -static inline int xfs_ilog_fbroot(int w) -{ - return (w == XFS_DATA_FORK ? XFS_ILOG_DBROOT : XFS_ILOG_ABROOT); -} - -static inline int xfs_ilog_fext(int w) -{ - return (w == XFS_DATA_FORK ? XFS_ILOG_DEXT : XFS_ILOG_AEXT); -} - -static inline int xfs_ilog_fdata(int w) -{ - return (w == XFS_DATA_FORK ? XFS_ILOG_DDATA : XFS_ILOG_ADATA); -} - -#ifdef __KERNEL__ +/* kernel only definitions */ struct xfs_buf; struct xfs_bmbt_rec; struct xfs_inode; struct xfs_mount; - typedef struct xfs_inode_log_item { xfs_log_item_t ili_item; /* common portion */ struct xfs_inode *ili_inode; /* inode ptr */@@ -151,7 +41,6 @@ typedef struct xfs_inode_log_item {xfs_inode_log_format_t ili_format;/* logged structure */ } xfs_inode_log_item_t; -static inline int xfs_inode_clean (xfs_inode_t *ip) {return !ip->i_itemp || !(ip->i_itemp->ili_fields &XFS_ILOG_ALL );@@ -165,6 +54,6 @@ extern void xfs_iflush_abort(struct xfs_inode *, bool);extern int xfs_inode_item_format_convert (xfs_log_iovec_t *,xfs_inode_log_format_t *); -#endif /* __KERNEL__ */ +extern struct kmem_zone *xfs_ili_zone;#endif /* __XFS_INODE_ITEM_H__ */ fs/xfs/xfs_log_format.h +189
-0@@ -18,6 +18,16 @@#ifndef __XFS_LOG_FORMAT_H__#define __XFS_LOG_FORMAT_H__ +/* +* On-disk Log Format definitions. +* +* This file contains all the on-disk format definitions used within the log. It +* includes the physical log structure itself, as well as all the log item +* format structures that are written into the log and intepreted by log +* recovery. We start with the physical log format definitions, and then work +* through all the log items definitions and everything they encode into the +* log. +*/ typedef __uint32_t xlog_tid_t ;#define XLOG_MIN_ICLOGS 2@@ -175,4 +185,183 @@ typedef struct xfs_log_iovec {uint i_type;/* type of region */ } xfs_log_iovec_t; + +/* +* Inode Log Item Format definitions. +* +* This is the structure used to lay out an inode log item in the +* log. The size of the inline data/extents/b-tree root to be logged +* (if any) is indicated in the ilf_dsize field. Changes to this structure +* must be added on to the end. +*/ +typedef struct xfs_inode_log_format { +__uint16_t ilf_type;/* inode log item type */ +__uint16_t ilf_size;/* size of this item */ +__uint32_t ilf_fields;/* flags for fields logged */ +__uint16_t ilf_asize;/* size of attr d/ext/root */ +__uint16_t ilf_dsize;/* size of data/ext/root */ +__uint64_t ilf_ino;/* inode number */ +union { +__uint32_t ilfu_rdev;/* rdev value for dev inode*/ +uuid_t ilfu_uuid;/* mount point value */ + } ilf_u; +__int64_t ilf_blkno;/* blkno of inode buffer */ +__int32_t ilf_len;/* len of inode buffer */ +__int32_t ilf_boffset;/* off of inode in buffer */ +}xfs_inode_log_format_t ; + +typedef struct xfs_inode_log_format_32 { +__uint16_t ilf_type;/* inode log item type */ +__uint16_t ilf_size;/* size of this item */ +__uint32_t ilf_fields;/* flags for fields logged */ +__uint16_t ilf_asize;/* size of attr d/ext/root */ +__uint16_t ilf_dsize;/* size of data/ext/root */ +__uint64_t ilf_ino;/* inode number */ +union { +__uint32_t ilfu_rdev;/* rdev value for dev inode*/ +uuid_t ilfu_uuid;/* mount point value */ + } ilf_u; +__int64_t ilf_blkno;/* blkno of inode buffer */ +__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 ; + +typedef struct xfs_inode_log_format_64 { +__uint16_t ilf_type;/* inode log item type */ +__uint16_t ilf_size;/* size of this item */ +__uint32_t ilf_fields;/* flags for fields logged */ +__uint16_t ilf_asize;/* size of attr d/ext/root */ +__uint16_t ilf_dsize;/* size of data/ext/root */ +__uint32_t ilf_pad;/* pad for 64 bit boundary */ +__uint64_t ilf_ino;/* inode number */ +union { +__uint32_t ilfu_rdev;/* rdev value for dev inode*/ +uuid_t ilfu_uuid;/* mount point value */ + } ilf_u; +__int64_t ilf_blkno;/* blkno of inode buffer */ +__int32_t ilf_len;/* len of inode buffer */ +__int32_t ilf_boffset;/* off of inode in buffer */ +}xfs_inode_log_format_64_t ; + +/* +* Flags for xfs_trans_log_inode flags field. +*/ +#define XFS_ILOG_CORE 0x001/* log standard inode fields */ +#define XFS_ILOG_DDATA 0x002/* log i_df.if_data */ +#define XFS_ILOG_DEXT 0x004/* log i_df.if_extents */ +#define XFS_ILOG_DBROOT 0x008/* log i_df.i_broot */ +#define XFS_ILOG_DEV 0x010/* log the dev field */ +#define XFS_ILOG_UUID 0x020/* log the uuid field */ +#define XFS_ILOG_ADATA 0x040/* log i_af.if_data */ +#define XFS_ILOG_AEXT 0x080/* log i_af.if_extents */ +#define XFS_ILOG_ABROOT 0x100/* log i_af.i_broot */ + + +/* +* The timestamps are dirty, but not necessarily anything else in the inode +* core. Unlike the other fields above this one must never make it to disk +* in the ilf_fields of the inode_log_format, but is purely store in-memory in +* ili_fields in the inode_log_item. +*/ +#define XFS_ILOG_TIMESTAMP 0x4000 + +#define XFS_ILOG_NONCORE (XFS_ILOG_DDATA | XFS_ILOG_DEXT | \ + XFS_ILOG_DBROOT | XFS_ILOG_DEV | \ + XFS_ILOG_UUID | XFS_ILOG_ADATA | \ + XFS_ILOG_AEXT | XFS_ILOG_ABROOT) + +#define XFS_ILOG_DFORK (XFS_ILOG_DDATA | XFS_ILOG_DEXT | \ + XFS_ILOG_DBROOT) + +#define XFS_ILOG_AFORK (XFS_ILOG_ADATA | XFS_ILOG_AEXT | \ + XFS_ILOG_ABROOT) + +#define XFS_ILOG_ALL (XFS_ILOG_CORE | XFS_ILOG_DDATA | \ + XFS_ILOG_DEXT | XFS_ILOG_DBROOT | \ + XFS_ILOG_DEV | XFS_ILOG_UUID | \ + XFS_ILOG_ADATA | XFS_ILOG_AEXT | \ + XFS_ILOG_ABROOT | XFS_ILOG_TIMESTAMP) + +static inline int xfs_ilog_fbroot (int w) +{ +return (w ==XFS_DATA_FORK ?XFS_ILOG_DBROOT :XFS_ILOG_ABROOT ); +} + +static inline int xfs_ilog_fext (int w) +{ +return (w ==XFS_DATA_FORK ?XFS_ILOG_DEXT :XFS_ILOG_AEXT ); +} + +static inline int xfs_ilog_fdata (int w) +{ +return (w ==XFS_DATA_FORK ?XFS_ILOG_DDATA :XFS_ILOG_ADATA ); +} + +/* +* Incore version of the on-disk inode core structures. We log this directly +* into the journal in host CPU format (for better or worse) and as such +* directly mirrors the xfs_dinode structure as it must contain all the same +* information. +*/ +typedef struct xfs_ictimestamp { +__int32_t t_sec;/* timestamp seconds */ +__int32_t t_nsec;/* timestamp nanoseconds */ +}xfs_ictimestamp_t ; + +/* +* NOTE: This structure must be kept identical to struct xfs_dinode +* in xfs_dinode.h except for the endianness annotations. +*/ +typedef struct xfs_icdinode { +__uint16_t di_magic;/* inode magic # = XFS_DINODE_MAGIC */ +__uint16_t di_mode;/* mode and type of file */ +__int8_t di_version;/* inode version */ +__int8_t di_format;/* format of di_c data */ +__uint16_t di_onlink;/* old number of links to file */ +__uint32_t di_uid;/* owner's user id */ +__uint32_t di_gid;/* owner's group id */ +__uint32_t di_nlink;/* number of links to file */ +__uint16_t di_projid_lo;/* lower part of owner's project id */ +__uint16_t di_projid_hi;/* higher part of owner's project id */ +__uint8_t di_pad[6 ];/* unused, zeroed space */ +__uint16_t di_flushiter;/* incremented on flush */ +xfs_ictimestamp_t di_atime;/* time last accessed */ +xfs_ictimestamp_t di_mtime;/* time last modified */ +xfs_ictimestamp_t di_ctime;/* time created/inode modified */ +xfs_fsize_t di_size;/* number of bytes in file */ +xfs_drfsbno_t di_nblocks;/* # of direct & btree blocks used */ +xfs_extlen_t di_extsize;/* basic/minimum extent size for file */ +xfs_extnum_t di_nextents;/* number of extents in data fork */ +xfs_aextnum_t di_anextents;/* number of extents in attribute fork*/ +__uint8_t di_forkoff;/* attr fork offs, <<3 for 64b align */ +__int8_t di_aformat;/* format of attr fork's data */ +__uint32_t di_dmevmask;/* DMIG event mask */ +__uint16_t di_dmstate;/* DMIG state info */ +__uint16_t di_flags;/* random flags, XFS_DIFLAG_... */ +__uint32_t di_gen;/* generation number */ + +/* di_next_unlinked is the only non-core field in the old dinode */ +xfs_agino_t di_next_unlinked;/* agi unlinked list ptr */ + +/* start of the extended dinode, writable fields */ +__uint32_t di_crc;/* CRC of the inode */ +__uint64_t di_changecount;/* number of attribute changes */ +xfs_lsn_t di_lsn;/* flush sequence */ +__uint64_t di_flags2;/* more random flags */ +__uint8_t di_pad2[16 ];/* more padding for future expansion */ + +/* fields only written to during inode creation */ +xfs_ictimestamp_t di_crtime;/* time created */ +xfs_ino_t di_ino;/* inode number */ +uuid_t di_uuid;/* UUID of the filesystem */ + +/* structure must be padded to 64 bit alignment */ +}xfs_icdinode_t ; + +static inline uint xfs_icdinode_size (int version) +{ +if (version ==3 ) +return sizeof (struct xfs_icdinode ); +return offsetof(struct xfs_icdinode , di_next_unlinked); +}#endif /* __XFS_LOG_FORMAT_H__ */ fs/xfs/xfs_types.h +6
-0@@ -146,6 +146,12 @@ typedef __uint64_t xfs_filblks_t; /* number of blocks in a file */#define XFS_MAX_SECTORSIZE (1 << XFS_MAX_SECTORSIZE_LOG)/* +* Inode fork identifiers. +*/ +#define XFS_DATA_FORK 0 +#define XFS_ATTR_FORK 1 + +/* * Min numbers of data/attr fork btree root pointers. */ #define MINDBTPTRS 3fs/xfs/xfs_xattr.c +0
-0
fs/xfs/xfs_xattr.c line 23
Quoted 7 lines
fs/xfs/xfs_xattr.c +1
-0@@ -17,6 +17,7 @@*/ #include "xfs.h" +#include "xfs_log_format.h" #include "xfs_da_btree.h" #include "xfs_bmap_btree.h" #include "xfs_inode.h"
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 02/49] xfs: split out inode log item format definition
In reply to Dave ChinnerQuoted 14 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Th elog item format definitions are shared with userspace. split the out of header files that contain kernel only defintions to make it simple to shared them.
Signed-off-by Dave Chinner<[email protected]>---
#include "xfs_mount.h"fs/xfs/xfs_inode.h +0
-0
...
Quoted 5 lines
- * NOTE: This structure must be kept identical to struct
xfs_dinode
- * inxfs_dinode.hexcept for the endianness annotations.
- */fs/xfs/xfs_inode.h +0
-2-typedef struct xfs_icdinode { - __uint16_t di_magic; /* inode magic # = XFS_DINODE_MAGIC */
...
Quoted 5 lines
fs/xfs/xfs_inode.h +0
-5-uuid_t di_uuid;/* UUID of the filesystem */ - -/* structure must be padded to 64 bit alignment */ -} xfs_icdinode_t; -
...
Quoted 18 lines
fs/xfs/xfs_log_format.h +10
-0@@ -18,6 +18,16 @@#ifndef __XFS_LOG_FORMAT_H__#define __XFS_LOG_FORMAT_H__ +/* +* On-disk Log Format definitions. +* +* This file contains all the on-disk format definitions used within the log. It +* includes the physical log structure itself, as well as all the log item +* format structures that are written into the log and intepreted by log +* recovery. We start with the physical log format definitions, and then work +* through all the log items definitions and everything they encode into the +* log. +*/
...
Quoted 23 lines
fs/xfs/xfs_log_format.h +23
-0+static inline int xfs_ilog_fdata (int w) +{ +return (w ==XFS_DATA_FORK ?XFS_ILOG_DDATA :XFS_ILOG_ADATA ); +} + +/* +* Incore version of the on-disk inode core structures. We log this directly +* into the journal in host CPU format (for better or worse) and as such +* directly mirrors the xfs_dinode structure as it must contain all the same +* information. +*/ +typedef struct xfs_ictimestamp { +__int32_t t_sec;/* timestamp seconds */ +__int32_t t_nsec;/* timestamp nanoseconds */ +}xfs_ictimestamp_t ; + +/* +* NOTE: This structure must be kept identical to struct xfs_dinode +* in xfs_dinode.h except for the endianness annotations. +*/ +typedef struct xfs_icdinode { + __uint16_t di_magic; /* inode magic # = XFS_DINODE_MAGIC */ + __uint16_t di_mode; /* mode and type of file */
...
fs/xfs/xfs_log_format.h typedef struct xfs_log_iovec { · line 359
Quoted 4 lines
fs/xfs/xfs_log_format.h +4
-0+uuid_t di_uuid;/* UUID of the filesystem */ + +/* structure must be padded to 64 bit alignment */ +} xfs_icdinode_t;
A log header file does not strike me as the place for the internal representation of the on disk inode structure.
--Mark.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 02/49] xfs: split out inode log item format definition
Quoted 5 lines
Quoted 1 line
+}
xfs_icdinode_t;A log header file does not strike me as the place for the internal representation of the on disk inode structure.
It's not not really the in-core version, I just messed up the name when doing the proper endianess annotations for XFS many years ago.
The correct name would be xfs_log_inode or similar. Maybe the comments should get a little update.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 3/49 xfs: split out buf log item format definitions
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
--- fs/xfs/xfs_buf_item.h | 100 ++---------------------------------------------- fs/xfs/xfs_log_format.h | 97 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+), 97 deletions(-)
fs/xfs/xfs_buf_item.h +3 -97
@@ -18,101 +18,9 @@#ifndef __XFS_BUF_ITEM_H__#define __XFS_BUF_ITEM_H__ -extern kmem_zone_t *xfs_buf_item_zone; - -/* -* This flag indicates that the buffer contains on disk inodes -* and requires special recovery handling. -*/ -#define XFS_BLF_INODE_BUF (1<<0) -/* -* This flag indicates that the buffer should not be replayed -* during recovery because its blocks are being freed. -*/ -#define XFS_BLF_CANCEL (1<<1) - -/* -* This flag indicates that the buffer contains on disk -* user or group dquots and may require special recovery handling. -*/ -#define XFS_BLF_UDQUOT_BUF (1<<2) -#define XFS_BLF_PDQUOT_BUF (1<<3) -#define XFS_BLF_GDQUOT_BUF (1<<4) - -#define XFS_BLF_CHUNK 128 -#define XFS_BLF_SHIFT 7 -#define BIT_TO_WORD_SHIFT 5 -#define NBWORD (NBBY * sizeof(unsigned int)) - -/* -* This is the structure used to lay out a buf log item in the -* log. The data map describes which 128 byte chunks of the buffer -* have been logged. -*/ -#define XFS_BLF_DATAMAP_SIZE ((XFS_MAX_BLOCKSIZE / XFS_BLF_CHUNK) / NBWORD) +/* kernel only definitions */ -typedef struct xfs_buf_log_format { -unsigned short blf_type;/* buf log item type indicator */ -unsigned short blf_size;/* size of this item */ -ushort blf_flags;/* misc state */ -ushort blf_len;/* number of blocks in this buf */ -__int64_t blf_blkno;/* starting blkno of this buf */ -unsigned int blf_map_size;/* used size of data bitmap in words */ -unsigned int blf_data_map[XFS_BLF_DATAMAP_SIZE ];/* dirty bitmap */ -}xfs_buf_log_format_t ; - -/* -* All buffers now need to tell recovery where the magic number -* is so that it can verify and calculate the CRCs on the buffer correctly -* once the changes have been replayed into the buffer. -* -* The type value is held in the upper 5 bits of the blf_flags field, which is -* an unsigned 16 bit field. Hence we need to shift it 11 bits up and down. -*/ -#define XFS_BLFT_BITS 5 -#define XFS_BLFT_SHIFT 11 -#define XFS_BLFT_MASK (((1 << XFS_BLFT_BITS) - 1) << XFS_BLFT_SHIFT) - -enum xfs_blft { -XFS_BLFT_UNKNOWN_BUF =0 , -XFS_BLFT_UDQUOT_BUF , -XFS_BLFT_PDQUOT_BUF , -XFS_BLFT_GDQUOT_BUF , -XFS_BLFT_BTREE_BUF , -XFS_BLFT_AGF_BUF , -XFS_BLFT_AGFL_BUF , -XFS_BLFT_AGI_BUF , -XFS_BLFT_DINO_BUF , -XFS_BLFT_SYMLINK_BUF , -XFS_BLFT_DIR_BLOCK_BUF , -XFS_BLFT_DIR_DATA_BUF , -XFS_BLFT_DIR_FREE_BUF , -XFS_BLFT_DIR_LEAF1_BUF , -XFS_BLFT_DIR_LEAFN_BUF , -XFS_BLFT_DA_NODE_BUF , -XFS_BLFT_ATTR_LEAF_BUF , -XFS_BLFT_ATTR_RMT_BUF , -XFS_BLFT_SB_BUF , -XFS_BLFT_MAX_BUF = (1 <<XFS_BLFT_BITS ), -}; - -static inline void -xfs_blft_to_flags (struct xfs_buf_log_format *blf,enum xfs_blft type) -{ -ASSERT (type >XFS_BLFT_UNKNOWN_BUF && type <XFS_BLFT_MAX_BUF ); - blf->blf_flags &= ~XFS_BLFT_MASK ; - blf->blf_flags |= ((type <<XFS_BLFT_SHIFT ) &XFS_BLFT_MASK ); -} - -static inline __uint16_t -xfs_blft_from_flags (struct xfs_buf_log_format *blf) -{ -return (blf->blf_flags &XFS_BLFT_MASK ) >>XFS_BLFT_SHIFT ; -} - -/* -* buf log item flags -*/ +/* buf log item flags */ #define XFS_BLI_HOLD 0x01#define XFS_BLI_DIRTY 0x02#define XFS_BLI_STALE 0x04
@@ -133,8 +41,6 @@ xfs_blft_from_flags(struct xfs_buf_log_format *blf) { XFS_BLI_ORDERED, "ORDERED" } -#ifdef __KERNEL__ -struct xfs_buf ;struct xfs_mount ;struct xfs_buf_log_item ;
@@ -169,6 +75,6 @@ void xfs_trans_buf_set_type(struct xfs_trans *, struct xfs_buf *, enum xfs_blft);void xfs_trans_buf_copy_type (struct xfs_buf *dst_bp,struct xfs_buf *src_bp); -#endif /* __KERNEL__ */ +extern kmem_zone_t *xfs_buf_item_zone;#endif /* __XFS_BUF_ITEM_H__ */
fs/xfs/xfs_log_format.h +97 -0
101 lines not on this page · raw message
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 03/49] xfs: split out buf log item format definitions
Quoted 4 lines · Dave Chinner
From: Dave Chinner <[email protected]>
Signed-off-by Dave Chinner <[email protected]>---
Quoted 226 lines
fs/xfs/xfs_buf_item.h | 100 ++---------------------------------------------- fs/xfs/xfs_log_format.h | 97 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+), 97 deletions(-)fs/xfs/xfs_buf_item.h +3
-97@@ -18,101 +18,9 @@#ifndef __XFS_BUF_ITEM_H__#define __XFS_BUF_ITEM_H__ -extern kmem_zone_t *xfs_buf_item_zone; - -/* -* This flag indicates that the buffer contains on disk inodes -* and requires special recovery handling. -*/ -#define XFS_BLF_INODE_BUF (1<<0) -/* -* This flag indicates that the buffer should not be replayed -* during recovery because its blocks are being freed. -*/ -#define XFS_BLF_CANCEL (1<<1) - -/* -* This flag indicates that the buffer contains on disk -* user or group dquots and may require special recovery handling. -*/ -#define XFS_BLF_UDQUOT_BUF (1<<2) -#define XFS_BLF_PDQUOT_BUF (1<<3) -#define XFS_BLF_GDQUOT_BUF (1<<4) - -#define XFS_BLF_CHUNK 128 -#define XFS_BLF_SHIFT 7 -#define BIT_TO_WORD_SHIFT 5 -#define NBWORD (NBBY * sizeof(unsigned int)) - -/* -* This is the structure used to lay out a buf log item in the -* log. The data map describes which 128 byte chunks of the buffer -* have been logged. -*/ -#define XFS_BLF_DATAMAP_SIZE ((XFS_MAX_BLOCKSIZE / XFS_BLF_CHUNK) / NBWORD) +/* kernel only definitions */ -typedef struct xfs_buf_log_format { -unsigned short blf_type;/* buf log item type indicator */ -unsigned short blf_size;/* size of this item */ -ushort blf_flags;/* misc state */ -ushort blf_len;/* number of blocks in this buf */ -__int64_t blf_blkno;/* starting blkno of this buf */ -unsigned int blf_map_size;/* used size of data bitmap in words */ -unsigned int blf_data_map[XFS_BLF_DATAMAP_SIZE ];/* dirty bitmap */ -}xfs_buf_log_format_t ; - -/* -* All buffers now need to tell recovery where the magic number -* is so that it can verify and calculate the CRCs on the buffer correctly -* once the changes have been replayed into the buffer. -* -* The type value is held in the upper 5 bits of the blf_flags field, which is -* an unsigned 16 bit field. Hence we need to shift it 11 bits up and down. -*/ -#define XFS_BLFT_BITS 5 -#define XFS_BLFT_SHIFT 11 -#define XFS_BLFT_MASK (((1 << XFS_BLFT_BITS) - 1) << XFS_BLFT_SHIFT) - -enum xfs_blft { -XFS_BLFT_UNKNOWN_BUF =0 , -XFS_BLFT_UDQUOT_BUF , -XFS_BLFT_PDQUOT_BUF , -XFS_BLFT_GDQUOT_BUF , -XFS_BLFT_BTREE_BUF , -XFS_BLFT_AGF_BUF , -XFS_BLFT_AGFL_BUF , -XFS_BLFT_AGI_BUF , -XFS_BLFT_DINO_BUF , -XFS_BLFT_SYMLINK_BUF , -XFS_BLFT_DIR_BLOCK_BUF , -XFS_BLFT_DIR_DATA_BUF , -XFS_BLFT_DIR_FREE_BUF , -XFS_BLFT_DIR_LEAF1_BUF , -XFS_BLFT_DIR_LEAFN_BUF , -XFS_BLFT_DA_NODE_BUF , -XFS_BLFT_ATTR_LEAF_BUF , -XFS_BLFT_ATTR_RMT_BUF , -XFS_BLFT_SB_BUF , -XFS_BLFT_MAX_BUF = (1 <<XFS_BLFT_BITS ), -}; - -static inline void -xfs_blft_to_flags (struct xfs_buf_log_format *blf,enum xfs_blft type) -{ -ASSERT (type >XFS_BLFT_UNKNOWN_BUF && type <XFS_BLFT_MAX_BUF ); - blf->blf_flags &= ~XFS_BLFT_MASK ; - blf->blf_flags |= ((type <<XFS_BLFT_SHIFT ) &XFS_BLFT_MASK ); -} - -static inline __uint16_t -xfs_blft_from_flags (struct xfs_buf_log_format *blf) -{ -return (blf->blf_flags &XFS_BLFT_MASK ) >>XFS_BLFT_SHIFT ; -} - -/* -* buf log item flags -*/ +/* buf log item flags */ #define XFS_BLI_HOLD 0x01#define XFS_BLI_DIRTY 0x02#define XFS_BLI_STALE 0x04@@ -133,8 +41,6 @@ xfs_blft_from_flags(struct xfs_buf_log_format *blf) { XFS_BLI_ORDERED, "ORDERED" } -#ifdef __KERNEL__ -struct xfs_buf ;struct xfs_mount ;struct xfs_buf_log_item ;@@ -169,6 +75,6 @@ void xfs_trans_buf_set_type(struct xfs_trans *, struct xfs_buf *, enum xfs_blft);void xfs_trans_buf_copy_type (struct xfs_buf *dst_bp,struct xfs_buf *src_bp); -#endif /* __KERNEL__ */ +extern kmem_zone_t *xfs_buf_item_zone;#endif /* __XFS_BUF_ITEM_H__ */ fs/xfs/xfs_log_format.h +88
-0@@ -364,4 +364,101 @@ static inline uint xfs_icdinode_size(int version)return sizeof (struct xfs_icdinode );return offsetof(struct xfs_icdinode , di_next_unlinked); } + +/* +* Buffer Log Format defintions +* +* These are the physical dirty bitmap defintions for the log format structure. +*/ +#define XFS_BLF_CHUNK 128 +#define XFS_BLF_SHIFT 7 +#define BIT_TO_WORD_SHIFT 5 +#define NBWORD (NBBY * sizeof(unsigned int)) + +/* +* This flag indicates that the buffer contains on disk inodes +* and requires special recovery handling. +*/ +#define XFS_BLF_INODE_BUF (1<<0) + +/* +* This flag indicates that the buffer should not be replayed +* during recovery because its blocks are being freed. +*/ +#define XFS_BLF_CANCEL (1<<1) + +/* +* This flag indicates that the buffer contains on disk +* user or group dquots and may require special recovery handling. +*/ +#define XFS_BLF_UDQUOT_BUF (1<<2) +#define XFS_BLF_PDQUOT_BUF (1<<3) +#define XFS_BLF_GDQUOT_BUF (1<<4) + +/* +* This is the structure used to lay out a buf log item in the +* log. The data map describes which 128 byte chunks of the buffer +* have been logged. +*/ +#define XFS_BLF_DATAMAP_SIZE ((XFS_MAX_BLOCKSIZE / XFS_BLF_CHUNK) / NBWORD) + +typedef struct xfs_buf_log_format { +unsigned short blf_type;/* buf log item type indicator */ +unsigned short blf_size;/* size of this item */ +ushort blf_flags;/* misc state */ +ushort blf_len;/* number of blocks in this buf */ +__int64_t blf_blkno;/* starting blkno of this buf */ +unsigned int blf_map_size;/* used size of data bitmap in words */ +unsigned int blf_data_map[XFS_BLF_DATAMAP_SIZE ];/* dirty bitmap */ +}xfs_buf_log_format_t ; + +/* +* All buffers now need to tell recovery where the magic number +* is so that it can verify and calculate the CRCs on the buffer correctly +* once the changes have been replayed into the buffer. +* +* The type value is held in the upper 5 bits of the blf_flags field, which is +* an unsigned 16 bit field. Hence we need to shift it 11 bits up and down. +*/ +#define XFS_BLFT_BITS 5 +#define XFS_BLFT_SHIFT 11 +#define XFS_BLFT_MASK (((1 << XFS_BLFT_BITS) - 1) << XFS_BLFT_SHIFT) + +enum xfs_blft { +XFS_BLFT_UNKNOWN_BUF =0 , +XFS_BLFT_UDQUOT_BUF , +XFS_BLFT_PDQUOT_BUF , +XFS_BLFT_GDQUOT_BUF , +XFS_BLFT_BTREE_BUF , +XFS_BLFT_AGF_BUF , +XFS_BLFT_AGFL_BUF , +XFS_BLFT_AGI_BUF , +XFS_BLFT_DINO_BUF , +XFS_BLFT_SYMLINK_BUF , +XFS_BLFT_DIR_BLOCK_BUF , +XFS_BLFT_DIR_DATA_BUF , +XFS_BLFT_DIR_FREE_BUF , +XFS_BLFT_DIR_LEAF1_BUF , +XFS_BLFT_DIR_LEAFN_BUF , +XFS_BLFT_DA_NODE_BUF , +XFS_BLFT_ATTR_LEAF_BUF , +XFS_BLFT_ATTR_RMT_BUF , +XFS_BLFT_SB_BUF , +XFS_BLFT_MAX_BUF = (1 <<XFS_BLFT_BITS ), +}; + +static inline void +xfs_blft_to_flags (struct xfs_buf_log_format *blf,enum xfs_blft type) +{ +ASSERT (type >XFS_BLFT_UNKNOWN_BUF && type <XFS_BLFT_MAX_BUF ); + blf->blf_flags &= ~XFS_BLFT_MASK ;
fs/xfs/xfs_log_format.h static inline uint xfs_icdinode_size(int version) · line 464
Quoted 10 lines
fs/xfs/xfs_log_format.h +9
-0+ blf->blf_flags |= ((type << XFS_BLFT_SHIFT) & XFS_BLFT_MASK); +} + +static inline __uint16_t +xfs_blft_from_flags (struct xfs_buf_log_format *blf) +{ +return (blf->blf_flags &XFS_BLFT_MASK ) >>XFS_BLFT_SHIFT ; +} +#endif /* __XFS_LOG_FORMAT_H__ */
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 4/49 xfs: split out inode log item format definition
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The EFI/EFD item format definitions are shared with userspace. Split the out of header files that contain kernel only defintions to make it simple to shared them.
--- fs/xfs/xfs_extfree_item.h | 88 ++--------------------------------------------- fs/xfs/xfs_log_format.h | 83 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+), 86 deletions(-)
fs/xfs/xfs_extfree_item.h +2 -86
@@ -18,93 +18,11 @@#ifndef __XFS_EXTFREE_ITEM_H__#define __XFS_EXTFREE_ITEM_H__ +/* kernel only EFI/EFD definitions */ +struct xfs_mount ;struct kmem_zone ; -typedef struct xfs_extent { -xfs_dfsbno_t ext_start; -xfs_extlen_t ext_len; -}xfs_extent_t ; - -/* -* Since an xfs_extent_t has types (start:64, len: 32) -* there are different alignments on 32 bit and 64 bit kernels. -* So we provide the different variants for use by a -* conversion routine. -*/ - -typedef struct xfs_extent_32 { -__uint64_t ext_start; -__uint32_t ext_len; -} __attribute__((packed))xfs_extent_32_t ; - -typedef struct xfs_extent_64 { -__uint64_t ext_start; -__uint32_t ext_len; -__uint32_t ext_pad; -}xfs_extent_64_t ; - -/* -* This is the structure used to lay out an efi log item in the -* log. The efi_extents field is a variable size array whose -* size is given by efi_nextents. -*/ -typedef struct xfs_efi_log_format { -__uint16_t efi_type;/* efi log item type */ -__uint16_t efi_size;/* size of this item */ -__uint32_t efi_nextents;/* # extents to free */ -__uint64_t efi_id;/* efi identifier */ -xfs_extent_t efi_extents[1 ];/* array of extents to free */ -}xfs_efi_log_format_t ; - -typedef struct xfs_efi_log_format_32 { -__uint16_t efi_type;/* efi log item type */ -__uint16_t efi_size;/* size of this item */ -__uint32_t efi_nextents;/* # extents to free */ -__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 ; - -typedef struct xfs_efi_log_format_64 { -__uint16_t efi_type;/* efi log item type */ -__uint16_t efi_size;/* size of this item */ -__uint32_t efi_nextents;/* # extents to free */ -__uint64_t efi_id;/* efi identifier */ -xfs_extent_64_t efi_extents[1 ];/* array of extents to free */ -}xfs_efi_log_format_64_t ; - -/* -* This is the structure used to lay out an efd log item in the -* log. The efd_extents array is a variable size array whose -* size is given by efd_nextents; -*/ -typedef struct xfs_efd_log_format { -__uint16_t efd_type;/* efd log item type */ -__uint16_t efd_size;/* size of this item */ -__uint32_t efd_nextents;/* # of extents freed */ -__uint64_t efd_efi_id;/* id of corresponding efi */ -xfs_extent_t efd_extents[1 ];/* array of extents freed */ -}xfs_efd_log_format_t ; - -typedef struct xfs_efd_log_format_32 { -__uint16_t efd_type;/* efd log item type */ -__uint16_t efd_size;/* size of this item */ -__uint32_t efd_nextents;/* # of extents freed */ -__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 ; - -typedef struct xfs_efd_log_format_64 { -__uint16_t efd_type;/* efd log item type */ -__uint16_t efd_size;/* size of this item */ -__uint32_t efd_nextents;/* # of extents freed */ -__uint64_t efd_efi_id;/* id of corresponding efi */ -xfs_extent_64_t efd_extents[1 ];/* array of extents freed */ -}xfs_efd_log_format_64_t ; - - -#ifdef __KERNEL__ -/* * Max number of extents in fast allocation path. */
@@ -160,6 +78,4 @@ int xfs_efi_copy_format(xfs_log_iovec_t *buf, xfs_efi_log_format_t *dst_efi_fmt);void xfs_efi_item_free (xfs_efi_log_item_t *); -#endif /* __KERNEL__ */ -#endif /* __XFS_EXTFREE_ITEM_H__ */
fs/xfs/xfs_log_format.h +83 -0
87 lines not on this page · raw message
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 04/49] xfs: split out inode log item format definition
Quoted 8 lines · Dave Chinner
From: Dave Chinner <[email protected]>
The EFI/EFD item format definitions are shared with userspace. Split the out of header files that contain kernel only defintions to make it simple to shared them.
Signed-off-by Dave Chinner <[email protected]>---
Quoted 194 lines
fs/xfs/xfs_extfree_item.h | 88 ++--------------------------------------------- fs/xfs/xfs_log_format.h | 83 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+), 86 deletions(-)fs/xfs/xfs_extfree_item.h +2
-86@@ -18,93 +18,11 @@#ifndef __XFS_EXTFREE_ITEM_H__#define __XFS_EXTFREE_ITEM_H__ +/* kernel only EFI/EFD definitions */ +struct xfs_mount ;struct kmem_zone ; -typedef struct xfs_extent { -xfs_dfsbno_t ext_start; -xfs_extlen_t ext_len; -}xfs_extent_t ; - -/* -* Since an xfs_extent_t has types (start:64, len: 32) -* there are different alignments on 32 bit and 64 bit kernels. -* So we provide the different variants for use by a -* conversion routine. -*/ - -typedef struct xfs_extent_32 { -__uint64_t ext_start; -__uint32_t ext_len; -} __attribute__((packed))xfs_extent_32_t ; - -typedef struct xfs_extent_64 { -__uint64_t ext_start; -__uint32_t ext_len; -__uint32_t ext_pad; -}xfs_extent_64_t ; - -/* -* This is the structure used to lay out an efi log item in the -* log. The efi_extents field is a variable size array whose -* size is given by efi_nextents. -*/ -typedef struct xfs_efi_log_format { -__uint16_t efi_type;/* efi log item type */ -__uint16_t efi_size;/* size of this item */ -__uint32_t efi_nextents;/* # extents to free */ -__uint64_t efi_id;/* efi identifier */ -xfs_extent_t efi_extents[1 ];/* array of extents to free */ -}xfs_efi_log_format_t ; - -typedef struct xfs_efi_log_format_32 { -__uint16_t efi_type;/* efi log item type */ -__uint16_t efi_size;/* size of this item */ -__uint32_t efi_nextents;/* # extents to free */ -__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 ; - -typedef struct xfs_efi_log_format_64 { -__uint16_t efi_type;/* efi log item type */ -__uint16_t efi_size;/* size of this item */ -__uint32_t efi_nextents;/* # extents to free */ -__uint64_t efi_id;/* efi identifier */ -xfs_extent_64_t efi_extents[1 ];/* array of extents to free */ -}xfs_efi_log_format_64_t ; - -/* -* This is the structure used to lay out an efd log item in the -* log. The efd_extents array is a variable size array whose -* size is given by efd_nextents; -*/ -typedef struct xfs_efd_log_format { -__uint16_t efd_type;/* efd log item type */ -__uint16_t efd_size;/* size of this item */ -__uint32_t efd_nextents;/* # of extents freed */ -__uint64_t efd_efi_id;/* id of corresponding efi */ -xfs_extent_t efd_extents[1 ];/* array of extents freed */ -}xfs_efd_log_format_t ; - -typedef struct xfs_efd_log_format_32 { -__uint16_t efd_type;/* efd log item type */ -__uint16_t efd_size;/* size of this item */ -__uint32_t efd_nextents;/* # of extents freed */ -__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 ; - -typedef struct xfs_efd_log_format_64 { -__uint16_t efd_type;/* efd log item type */ -__uint16_t efd_size;/* size of this item */ -__uint32_t efd_nextents;/* # of extents freed */ -__uint64_t efd_efi_id;/* id of corresponding efi */ -xfs_extent_64_t efd_extents[1 ];/* array of extents freed */ -}xfs_efd_log_format_64_t ; - - -#ifdef __KERNEL__ -/* * Max number of extents in fast allocation path. */ @@ -160,6 +78,4 @@ int xfs_efi_copy_format(xfs_log_iovec_t *buf, xfs_efi_log_format_t *dst_efi_fmt);void xfs_efi_item_free (xfs_efi_log_item_t *); -#endif /* __KERNEL__ */ -#endif /* __XFS_EXTFREE_ITEM_H__ */ fs/xfs/xfs_log_format.h +74
-0@@ -461,4 +461,87 @@ xfs_blft_from_flags(struct xfs_buf_log_format *blf)return (blf->blf_flags &XFS_BLFT_MASK ) >>XFS_BLFT_SHIFT ; } +/* +* EFI/EFD log format definitions +*/ +typedef struct xfs_extent { +xfs_dfsbno_t ext_start; +xfs_extlen_t ext_len; +}xfs_extent_t ; + +/* +* Since an xfs_extent_t has types (start:64, len: 32) +* there are different alignments on 32 bit and 64 bit kernels. +* So we provide the different variants for use by a +* conversion routine. +*/ +typedef struct xfs_extent_32 { +__uint64_t ext_start; +__uint32_t ext_len; +} __attribute__((packed))xfs_extent_32_t ; + +typedef struct xfs_extent_64 { +__uint64_t ext_start; +__uint32_t ext_len; +__uint32_t ext_pad; +}xfs_extent_64_t ; + +/* +* This is the structure used to lay out an efi log item in the +* log. The efi_extents field is a variable size array whose +* size is given by efi_nextents. +*/ +typedef struct xfs_efi_log_format { +__uint16_t efi_type;/* efi log item type */ +__uint16_t efi_size;/* size of this item */ +__uint32_t efi_nextents;/* # extents to free */ +__uint64_t efi_id;/* efi identifier */ +xfs_extent_t efi_extents[1 ];/* array of extents to free */ +}xfs_efi_log_format_t ; + +typedef struct xfs_efi_log_format_32 { +__uint16_t efi_type;/* efi log item type */ +__uint16_t efi_size;/* size of this item */ +__uint32_t efi_nextents;/* # extents to free */ +__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 ; + +typedef struct xfs_efi_log_format_64 { +__uint16_t efi_type;/* efi log item type */ +__uint16_t efi_size;/* size of this item */ +__uint32_t efi_nextents;/* # extents to free */ +__uint64_t efi_id;/* efi identifier */ +xfs_extent_64_t efi_extents[1 ];/* array of extents to free */ +}xfs_efi_log_format_64_t ; + +/* +* This is the structure used to lay out an efd log item in the +* log. The efd_extents array is a variable size array whose +* size is given by efd_nextents; +*/ +typedef struct xfs_efd_log_format { +__uint16_t efd_type;/* efd log item type */ +__uint16_t efd_size;/* size of this item */ +__uint32_t efd_nextents;/* # of extents freed */ +__uint64_t efd_efi_id;/* id of corresponding efi */ +xfs_extent_t efd_extents[1 ];/* array of extents freed */ +}xfs_efd_log_format_t ; + +typedef struct xfs_efd_log_format_32 { +__uint16_t efd_type;/* efd log item type */ +__uint16_t efd_size;/* size of this item */ +__uint32_t efd_nextents;/* # of extents freed */ +__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 ;
fs/xfs/xfs_log_format.h xfs_blft_from_flags(struct xfs_buf_log_format *blf) · line 547
Quoted 10 lines
fs/xfs/xfs_log_format.h +9
-0+ +typedef struct xfs_efd_log_format_64 { +__uint16_t efd_type;/* efd log item type */ +__uint16_t efd_size;/* size of this item */ +__uint32_t efd_nextents;/* # of extents freed */ +__uint64_t efd_efi_id;/* id of corresponding efi */ +xfs_extent_64_t efd_extents[1 ];/* array of extents freed */ +}xfs_efd_log_format_64_t ; +#endif /* __XFS_LOG_FORMAT_H__ */
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 5/49 xfs: separate dquot on disk format definitions out of xfs_quota.h
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The on disk format definitions of the on-disk dquot, log formats and quota off log formats are all intertwined with other definitions for quotas. Separate them out into their own header file so they can easily be shared with userspace.
--- fs/xfs/xfs_attr.c | 2 +- fs/xfs/xfs_bmap.c | 2 +- fs/xfs/xfs_bmap_btree.c | 2 +- fs/xfs/xfs_discard.c | 1 + fs/xfs/xfs_dquot.c | 1 + fs/xfs/xfs_dquot_item.c | 1 + fs/xfs/xfs_format.h | 86 ++++++++++++++++++++++++++++++++ fs/xfs/xfs_icache.c | 1 + fs/xfs/xfs_inode.c | 2 +- fs/xfs/xfs_ioctl.c | 1 + fs/xfs/xfs_iomap.c | 1 + fs/xfs/xfs_iops.c | 1 + fs/xfs/xfs_log_format.h | 58 ++++++++++++++++++++++ fs/xfs/xfs_log_recover.c | 2 +- fs/xfs/xfs_mount.c | 2 +- fs/xfs/xfs_qm.c | 1 + fs/xfs/xfs_qm_bhv.c | 1 + fs/xfs/xfs_qm_syscalls.c | 1 + fs/xfs/xfs_quota.h | 126 ----------------------------------------------- fs/xfs/xfs_quotaops.c | 1 + fs/xfs/xfs_rename.c | 2 +- fs/xfs/xfs_super.c | 1 + fs/xfs/xfs_symlink.c | 2 +- fs/xfs/xfs_trace.c | 1 + fs/xfs/xfs_trans.c | 2 +- fs/xfs/xfs_trans_dquot.c | 1 + fs/xfs/xfs_types.h | 6 +++ fs/xfs/xfs_utils.c | 2 +- fs/xfs/xfs_vnodeops.c | 2 +- 29 files changed, 175 insertions(+), 137 deletions(-) create mode 100644 fs/xfs/xfs_format.h
fs/xfs/xfs_attr.c +1 -1
@@ -17,7 +17,7 @@*/ #include "xfs.h" #include "xfs_fs.h" -#include "xfs_types.h" +#include "xfs_format.h" #include "xfs_bit.h" #include "xfs_log.h" #include "xfs_trans.h"
fs/xfs/xfs_bmap.c +1 -1
@@ -17,7 +17,7 @@*/ #include "xfs.h" #include "xfs_fs.h" -#include "xfs_types.h" +#include "xfs_format.h" #include "xfs_bit.h" #include "xfs_log.h" #include "xfs_inum.h"
fs/xfs/xfs_bmap_btree.c +1 -1
@@ -17,7 +17,7 @@*/ #include "xfs.h" #include "xfs_fs.h" -#include "xfs_types.h" +#include "xfs_format.h" #include "xfs_bit.h" #include "xfs_log.h" #include "xfs_trans.h"
fs/xfs/xfs_discard.c +1 -0
@@ -16,6 +16,7 @@* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "xfs.h" +#include "xfs_format.h" #include "xfs_sb.h" #include "xfs_log.h" #include "xfs_ag.h"
fs/xfs/xfs_dquot.c +1 -0
@@ -17,6 +17,7 @@*/ #include "xfs.h" #include "xfs_fs.h" +#include "xfs_format.h" #include "xfs_bit.h" #include "xfs_log.h" #include "xfs_trans.h"
fs/xfs/xfs_dquot_item.c +1 -0
@@ -17,6 +17,7 @@*/ #include "xfs.h" #include "xfs_fs.h" +#include "xfs_format.h" #include "xfs_log.h" #include "xfs_trans.h" #include "xfs_sb.h"
fs/xfs/xfs_format.h new file +86 -0
86 lines not on this page · raw message
fs/xfs/xfs_icache.c +1 -0
@@ -17,6 +17,7 @@*/ #include "xfs.h" #include "xfs_fs.h" +#include "xfs_format.h" #include "xfs_types.h" #include "xfs_log.h" #include "xfs_log_priv.h"
fs/xfs/xfs_inode.c +1 -1
@@ -19,7 +19,7 @@#include "xfs.h" #include "xfs_fs.h" -#include "xfs_types.h" +#include "xfs_format.h" #include "xfs_log.h" #include "xfs_inum.h" #include "xfs_trans.h"
fs/xfs/xfs_ioctl.c +1 -0
@@ -17,6 +17,7 @@*/ #include "xfs.h" #include "xfs_fs.h" +#include "xfs_format.h" #include "xfs_log.h" #include "xfs_trans.h" #include "xfs_sb.h"
fs/xfs/xfs_iomap.c +1 -0
@@ -17,6 +17,7 @@*/ #include "xfs.h" #include "xfs_fs.h" +#include "xfs_format.h" #include "xfs_log.h" #include "xfs_trans.h" #include "xfs_sb.h"
fs/xfs/xfs_iops.c +1 -0
@@ -17,6 +17,7 @@*/ #include "xfs.h" #include "xfs_fs.h" +#include "xfs_format.h" #include "xfs_acl.h" #include "xfs_log.h" #include "xfs_trans.h"
fs/xfs/xfs_log_format.h +58 -0
62 lines not on this page · raw message
fs/xfs/xfs_log_recover.c +1 -1
@@ -17,7 +17,7 @@*/ #include "xfs.h" #include "xfs_fs.h" -#include "xfs_types.h" +#include "xfs_format.h" #include "xfs_bit.h" #include "xfs_log.h" #include "xfs_inum.h"
fs/xfs/xfs_mount.c +1 -1
@@ -17,7 +17,7 @@*/ #include "xfs.h" #include "xfs_fs.h" -#include "xfs_types.h" +#include "xfs_format.h" #include "xfs_bit.h" #include "xfs_log.h" #include "xfs_inum.h"
fs/xfs/xfs_qm.c +1 -0
@@ -17,6 +17,7 @@*/ #include "xfs.h" #include "xfs_fs.h" +#include "xfs_format.h" #include "xfs_bit.h" #include "xfs_log.h" #include "xfs_trans.h"
fs/xfs/xfs_qm_bhv.c +1 -0
@@ -17,6 +17,7 @@*/ #include "xfs.h" #include "xfs_fs.h" +#include "xfs_format.h" #include "xfs_log.h" #include "xfs_trans.h" #include "xfs_sb.h"
fs/xfs/xfs_qm_syscalls.c +1 -0
@@ -20,6 +20,7 @@#include "xfs.h" #include "xfs_fs.h" +#include "xfs_format.h" #include "xfs_bit.h" #include "xfs_log.h" #include "xfs_trans.h"
fs/xfs/xfs_quota.h +0 -126
144 lines not on this page · raw message
fs/xfs/xfs_quotaops.c +1 -0
@@ -16,6 +16,7 @@* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "xfs.h" +#include "xfs_format.h" #include "xfs_sb.h" #include "xfs_log.h" #include "xfs_ag.h"
fs/xfs/xfs_rename.c +1 -1
@@ -17,7 +17,7 @@*/ #include "xfs.h" #include "xfs_fs.h" -#include "xfs_types.h" +#include "xfs_format.h" #include "xfs_log.h" #include "xfs_trans.h" #include "xfs_sb.h"
fs/xfs/xfs_super.c +1 -0
@@ -17,6 +17,7 @@*/ #include "xfs.h" +#include "xfs_format.h" #include "xfs_log.h" #include "xfs_inum.h" #include "xfs_trans.h"
fs/xfs/xfs_symlink.c +1 -1
@@ -18,7 +18,7 @@*/ #include "xfs.h" #include "xfs_fs.h" -#include "xfs_types.h" +#include "xfs_format.h" #include "xfs_bit.h" #include "xfs_log.h" #include "xfs_trans.h"
fs/xfs/xfs_trace.c +1 -0
@@ -18,6 +18,7 @@#include "xfs.h" #include "xfs_fs.h" #include "xfs_types.h" +#include "xfs_format.h" #include "xfs_log.h" #include "xfs_trans.h" #include "xfs_sb.h"
fs/xfs/xfs_trans.c +1 -1
@@ -18,7 +18,7 @@*/ #include "xfs.h" #include "xfs_fs.h" -#include "xfs_types.h" +#include "xfs_format.h" #include "xfs_log.h" #include "xfs_trans.h" #include "xfs_sb.h"
fs/xfs/xfs_trans_dquot.c +1 -0
@@ -17,6 +17,7 @@*/ #include "xfs.h" #include "xfs_fs.h" +#include "xfs_format.h" #include "xfs_log.h" #include "xfs_trans.h" #include "xfs_sb.h"
fs/xfs/xfs_types.h +6 -0
@@ -177,4 +177,10 @@ struct xfs_name { int len; }; +/* +* uid_t and gid_t are hard-coded to 32 bits in the inode. +* Hence, an 'id' in a dquot is 32 bits.. +*/ +typedef __uint32_t xfs_dqid_t ; +#endif /* __XFS_TYPES_H__ */
fs/xfs/xfs_utils.c +1 -1
@@ -17,7 +17,7 @@*/ #include "xfs.h" #include "xfs_fs.h" -#include "xfs_types.h" +#include "xfs_format.h" #include "xfs_log.h" #include "xfs_trans.h" #include "xfs_sb.h"
fs/xfs/xfs_vnodeops.c +1 -1
@@ -19,7 +19,7 @@#include "xfs.h" #include "xfs_fs.h" -#include "xfs_types.h" +#include "xfs_format.h" #include "xfs_bit.h" #include "xfs_log.h" #include "xfs_trans.h"
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 05/49] xfs: separate dquot on disk format definitions out of xfs_quota.h
Quoted 9 lines · Dave Chinner
From: Dave Chinner <[email protected]>
The on disk format definitions of the on-disk dquot, log formats and quota off log formats are all intertwined with other definitions for quotas. Separate them out into their own header file so they can easily be shared with userspace.
Signed-off-by Dave Chinner <[email protected]>---
...
Quoted 5 lines
fs/xfs/xfs_quota.h +0
-0@@ -21,18 +21,6 @@
...
fs/xfs/xfs_quota.h typedef struct xfs_dqblk { · line 191
Quoted 13 lines
fs/xfs/xfs_quota.h +0
-13- -/* -* Conversion to and from the combined OQUOTA flag (if necessary) -* is done only in xfs_sb_qflags_to_disk() and xfs_sb_qflags_from_disk() -*/ -#define XFS_GQUOTA_ENFD 0x0080/* group quota limits enforced */ -#define XFS_GQUOTA_CHKD 0x0100/* quotacheck run on group quotas */ -#define XFS_PQUOTA_ENFD 0x0200/* project quota limits enforced */ -#define XFS_PQUOTA_CHKD 0x0400/* quotacheck run on project quotas */ - -/* -* Quota Accounting/Enforcement flags -*/
A few minor whitespace diffs and the above comment was dropped. Looks fine to me:
Quoted 131 lines
fs/xfs/xfs_quota.h +0
-7-#define XFS_ALL_QUOTA_ACCT \ - (XFS_UQUOTA_ACCT | XFS_GQUOTA_ACCT | XFS_PQUOTA_ACCT) -#define XFS_ALL_QUOTA_ENFD \ - (XFS_UQUOTA_ENFD | XFS_GQUOTA_ENFD | XFS_PQUOTA_ENFD) -#define XFS_ALL_QUOTA_CHKD \ - (XFS_UQUOTA_CHKD | XFS_GQUOTA_CHKD | XFS_PQUOTA_CHKD) -#define XFS_IS_QUOTA_RUNNING (mp) ((mp)->m_qflags & XFS_ALL_QUOTA_ACCT)#define XFS_IS_UQUOTA_RUNNING (mp) ((mp)->m_qflags & XFS_UQUOTA_ACCT)#define XFS_IS_PQUOTA_RUNNING (mp) ((mp)->m_qflags & XFS_PQUOTA_ACCT)fs/xfs/xfs_quotaops.c +1
-0@@ -16,6 +16,7 @@* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "xfs.h" +#include "xfs_format.h" #include "xfs_sb.h" #include "xfs_log.h" #include "xfs_ag.h" fs/xfs/xfs_rename.c +1
-1@@ -17,7 +17,7 @@*/ #include "xfs.h" #include "xfs_fs.h" -#include "xfs_types.h" +#include "xfs_format.h" #include "xfs_log.h" #include "xfs_trans.h" #include "xfs_sb.h" fs/xfs/xfs_super.c +1
-0@@ -17,6 +17,7 @@*/ #include "xfs.h" +#include "xfs_format.h" #include "xfs_log.h" #include "xfs_inum.h" #include "xfs_trans.h" fs/xfs/xfs_symlink.c +1
-1@@ -18,7 +18,7 @@*/ #include "xfs.h" #include "xfs_fs.h" -#include "xfs_types.h" +#include "xfs_format.h" #include "xfs_bit.h" #include "xfs_log.h" #include "xfs_trans.h" fs/xfs/xfs_trace.c +1
-0@@ -18,6 +18,7 @@#include "xfs.h" #include "xfs_fs.h" #include "xfs_types.h" +#include "xfs_format.h" #include "xfs_log.h" #include "xfs_trans.h" #include "xfs_sb.h" fs/xfs/xfs_trans.c +1
-1@@ -18,7 +18,7 @@*/ #include "xfs.h" #include "xfs_fs.h" -#include "xfs_types.h" +#include "xfs_format.h" #include "xfs_log.h" #include "xfs_trans.h" #include "xfs_sb.h" fs/xfs/xfs_trans_dquot.c +1
-0@@ -17,6 +17,7 @@*/ #include "xfs.h" #include "xfs_fs.h" +#include "xfs_format.h" #include "xfs_log.h" #include "xfs_trans.h" #include "xfs_sb.h" fs/xfs/xfs_types.h +6
-0@@ -177,4 +177,10 @@ struct xfs_name { int len; }; +/* +* uid_t and gid_t are hard-coded to 32 bits in the inode. +* Hence, an 'id' in a dquot is 32 bits.. +*/ +typedef __uint32_t xfs_dqid_t ; +#endif /* __XFS_TYPES_H__ */ fs/xfs/xfs_utils.c +1
-1@@ -17,7 +17,7 @@*/ #include "xfs.h" #include "xfs_fs.h" -#include "xfs_types.h" +#include "xfs_format.h" #include "xfs_log.h" #include "xfs_trans.h" #include "xfs_sb.h" fs/xfs/xfs_vnodeops.c +0
-0
fs/xfs/xfs_vnodeops.c line 25
Quoted 8 lines
fs/xfs/xfs_vnodeops.c +1
-1@@ -19,7 +19,7 @@#include "xfs.h" #include "xfs_fs.h" -#include "xfs_types.h" +#include "xfs_format.h" #include "xfs_bit.h" #include "xfs_log.h" #include "xfs_trans.h"
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 05/49] xfs: separate dquot on disk format definitions out of xfs_quota.h
In reply to Dave ChinnerQuoted 3 lines
+ * This header file defines all the on-disk format definitions for
+ * general XFS objects. Directory and attribute related objects are defined in
+ *xfs_da_format.h, which log and log item formats are defined in
As of this patch (and the whole series) we still seem to have xfs_dir2_format.h and not xfs_da_format.h
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 05/49] xfs: separate dquot on disk format definitions out of xfs_quota.h
Quoted 6 lines · Christoph Hellwig
Quoted 3 lines
+ * This header file defines all the on-disk format definitions for
+ * general XFS objects. Directory and attribute related objects are defined in
+ *xfs_da_format.h, which log and log item formats are defined inAs of this patch (and the whole series) we still seem to have
xfs_dir2_format.hand notxfs_da_format.h
I haven't got around to combining them as it's not initially necessary to harmonise user/kernel space. So the comment is wrong.
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 6/49 xfs: separate icreate log format definitions from xfs_icreate_item.h
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The on disk log format definitions for the icreate log item are intertwined with the kernel-only in-memory log item definitions. Separate the log format definitions out into their own header file so they can easily be shared with userspace.
--- fs/xfs/xfs_icreate_item.h | 18 ------------------ fs/xfs/xfs_log_format.h | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 18 deletions(-)
fs/xfs/xfs_icreate_item.h +0 -18
@@ -18,24 +18,6 @@ #ifndef XFS_ICREATE_ITEM_H #define XFS_ICREATE_ITEM_H 1 -/* - * on disk log item structure - * - * Log recovery assumes the first two entries are the type and size and they fit - * in 32 bits. Also in host order (ugh) so they have to be 32 bit aligned so - * decoding can be done correctly. - */ -struct xfs_icreate_log { - __uint16_t icl_type; /* type of log format structure */ - __uint16_t icl_size; /* size of log format structure */ - __be32 icl_ag; /* ag being allocated in */ - __be32 icl_agbno; /* start block of inode range */ - __be32 icl_count; /* number of inodes to initialise */ - __be32 icl_isize; /* size of inodes */ - __be32 icl_length; /* length of extent to initialise */ - __be32 icl_gen; /* inode generation number to use */ -}; - /* in memory log item structure */ struct xfs_icreate_item { struct xfs_log_item ic_item;
fs/xfs/xfs_log_format.h +18 -0
@@ -602,4 +602,22 @@ typedef struct xfs_qoff_logformat {#define XFS_ALL_QUOTA_CHKD \ (XFS_UQUOTA_CHKD | XFS_GQUOTA_CHKD | XFS_PQUOTA_CHKD) +/* +* Inode create log item structure +* +* Log recovery assumes the first two entries are the type and size and they fit +* in 32 bits. Also in host order (ugh) so they have to be 32 bit aligned so +* decoding can be done correctly. +*/ +struct xfs_icreate_log { +__uint16_t icl_type;/* type of log format structure */ +__uint16_t icl_size;/* size of log format structure */ +__be32 icl_ag;/* ag being allocated in */ +__be32 icl_agbno;/* start block of inode range */ +__be32 icl_count;/* number of inodes to initialise */ +__be32 icl_isize;/* size of inodes */ +__be32 icl_length;/* length of extent to initialise */ +__be32 icl_gen;/* inode generation number to use */ +}; +#endif /* __XFS_LOG_FORMAT_H__ */
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 06/49] xfs: separate icreate log format definitions from xfs_icreate_item.h
Quoted 9 lines · Dave Chinner
From: Dave Chinner <[email protected]>
The on disk log format definitions for the icreate log item are intertwined with the kernel-only in-memory log item definitions. Separate the log format definitions out into their own header file so they can easily be shared with userspace.
Signed-off-by Dave Chinner <[email protected]>---
Quoted 51 lines
fs/xfs/xfs_icreate_item.h | 18 ------------------ fs/xfs/xfs_log_format.h | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 18 deletions(-)fs/xfs/xfs_icreate_item.h +0
-18@@ -18,24 +18,6 @@ #ifndef XFS_ICREATE_ITEM_H #define XFS_ICREATE_ITEM_H 1 -/* - * on disk log item structure - * - * Log recovery assumes the first two entries are the type and size and they fit - * in 32 bits. Also in host order (ugh) so they have to be 32 bit aligned so - * decoding can be done correctly. - */ -struct xfs_icreate_log { - __uint16_t icl_type; /* type of log format structure */ - __uint16_t icl_size; /* size of log format structure */ - __be32 icl_ag; /* ag being allocated in */ - __be32 icl_agbno; /* start block of inode range */ - __be32 icl_count; /* number of inodes to initialise */ - __be32 icl_isize; /* size of inodes */ - __be32 icl_length; /* length of extent to initialise */ - __be32 icl_gen; /* inode generation number to use */ -}; - /* in memory log item structure */ struct xfs_icreate_item { struct xfs_log_item ic_item;fs/xfs/xfs_log_format.h +9
-0@@ -602,4 +602,22 @@ typedef struct xfs_qoff_logformat {#define XFS_ALL_QUOTA_CHKD \ (XFS_UQUOTA_CHKD | XFS_GQUOTA_CHKD | XFS_PQUOTA_CHKD) +/* +* Inode create log item structure +* +* Log recovery assumes the first two entries are the type and size and they fit +* in 32 bits. Also in host order (ugh) so they have to be 32 bit aligned so +* decoding can be done correctly. +*/ +struct xfs_icreate_log { +__uint16_t icl_type;/* type of log format structure */
fs/xfs/xfs_log_format.h typedef struct xfs_qoff_logformat { · line 623
Quoted 10 lines
fs/xfs/xfs_log_format.h +9
-0+__uint16_t icl_size;/* size of log format structure */ +__be32 icl_ag;/* ag being allocated in */ +__be32 icl_agbno;/* start block of inode range */ +__be32 icl_count;/* number of inodes to initialise */ +__be32 icl_isize;/* size of inodes */ +__be32 icl_length;/* length of extent to initialise */ + __be32 icl_gen; /* inode generation number to use */ +}; +#endif /* __XFS_LOG_FORMAT_H__ */
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 7/49 xfs: split out on-disk transaction definitions
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
There's a bunch of definitions in xfs_trans.h that define on-disk formats - transaction headers taht get written into the log, log item type definitions, etc. Split out everything into a separate file so that all which remains in xfs_trans.h are kernel only definitions.
Also, remove the duplicate magic number definitions for XFS_TRANS_HEADER_MAGIC...
--- fs/xfs/xfs_log_format.h | 206 ++++++++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_trans.c | 4 +- fs/xfs/xfs_trans.h | 205 ----------------------------------------------- 3 files changed, 208 insertions(+), 207 deletions(-)
fs/xfs/xfs_log_format.h +206 -0
@@ -187,6 +187,212 @@ typedef struct xfs_log_iovec {/* +* Transaction Header definitions. +* +* This is the structure written in the log at the head of every transaction. It +* identifies the type and id of the transaction, and contains the number of +* items logged by the transaction so we know how many to expect during +* recovery. +* +* Do not change the below structure without redoing the code in +* xlog_recover_add_to_trans() and xlog_recover_add_to_cont_trans(). +*/ +typedef struct xfs_trans_header { +uint th_magic;/* magic number */ +uint th_type;/* transaction type */ +__int32_t th_tid;/* transaction id (unused) */ +uint th_num_items;/* num items logged by trans */ +}xfs_trans_header_t ; + +#define XFS_TRANS_HEADER_MAGIC 0x5452414e/* TRAN */ + +/* +* Log item types. +*/ +#define XFS_LI_EFI 0x1236 +#define XFS_LI_EFD 0x1237 +#define XFS_LI_IUNLINK 0x1238 +#define XFS_LI_INODE 0x123b/* aligned ino chunks, var-size ibufs */ +#define XFS_LI_BUF 0x123c/* v2 bufs, variable sized inode bufs */ +#define XFS_LI_DQUOT 0x123d +#define XFS_LI_QUOTAOFF 0x123e +#define XFS_LI_ICREATE 0x123f + +#define XFS_LI_TYPE_DESC \ + { XFS_LI_EFI, "XFS_LI_EFI" }, \ + { XFS_LI_EFD, "XFS_LI_EFD" }, \ + { XFS_LI_IUNLINK, "XFS_LI_IUNLINK" }, \ + { XFS_LI_INODE, "XFS_LI_INODE" }, \ + { XFS_LI_BUF, "XFS_LI_BUF" }, \ + { XFS_LI_DQUOT, "XFS_LI_DQUOT" }, \ + { XFS_LI_QUOTAOFF, "XFS_LI_QUOTAOFF" }, \ + { XFS_LI_ICREATE, "XFS_LI_ICREATE" } + +/* +* Transaction types. Used to distinguish types of buffers. +*/ +#define XFS_TRANS_SETATTR_NOT_SIZE 1 +#define XFS_TRANS_SETATTR_SIZE 2 +#define XFS_TRANS_INACTIVE 3 +#define XFS_TRANS_CREATE 4 +#define XFS_TRANS_CREATE_TRUNC 5 +#define XFS_TRANS_TRUNCATE_FILE 6 +#define XFS_TRANS_REMOVE 7 +#define XFS_TRANS_LINK 8 +#define XFS_TRANS_RENAME 9 +#define XFS_TRANS_MKDIR 10 +#define XFS_TRANS_RMDIR 11 +#define XFS_TRANS_SYMLINK 12 +#define XFS_TRANS_SET_DMATTRS 13 +#define XFS_TRANS_GROWFS 14 +#define XFS_TRANS_STRAT_WRITE 15 +#define XFS_TRANS_DIOSTRAT 16 +/* 17 was XFS_TRANS_WRITE_SYNC */ +#define XFS_TRANS_WRITEID 18 +#define XFS_TRANS_ADDAFORK 19 +#define XFS_TRANS_ATTRINVAL 20 +#define XFS_TRANS_ATRUNCATE 21 +#define XFS_TRANS_ATTR_SET 22 +#define XFS_TRANS_ATTR_RM 23 +#define XFS_TRANS_ATTR_FLAG 24 +#define XFS_TRANS_CLEAR_AGI_BUCKET 25 +#define XFS_TRANS_QM_SBCHANGE 26 +/* +* Dummy entries since we use the transaction type to index into the +* trans_type[] in xlog_recover_print_trans_head() +*/ +#define XFS_TRANS_DUMMY1 27 +#define XFS_TRANS_DUMMY2 28 +#define XFS_TRANS_QM_QUOTAOFF 29 +#define XFS_TRANS_QM_DQALLOC 30 +#define XFS_TRANS_QM_SETQLIM 31 +#define XFS_TRANS_QM_DQCLUSTER 32 +#define XFS_TRANS_QM_QINOCREATE 33 +#define XFS_TRANS_QM_QUOTAOFF_END 34 +#define XFS_TRANS_SB_UNIT 35 +#define XFS_TRANS_FSYNC_TS 36 +#define XFS_TRANS_GROWFSRT_ALLOC 37 +#define XFS_TRANS_GROWFSRT_ZERO 38 +#define XFS_TRANS_GROWFSRT_FREE 39 +#define XFS_TRANS_SWAPEXT 40 +#define XFS_TRANS_SB_COUNT 41 +#define XFS_TRANS_CHECKPOINT 42 +#define XFS_TRANS_ICREATE 43 +#define XFS_TRANS_TYPE_MAX 43 +/* new transaction types need to be reflected in xfs_logprint(8) */ + +#define XFS_TRANS_TYPES \ + { XFS_TRANS_SETATTR_NOT_SIZE, "SETATTR_NOT_SIZE" }, \ + { XFS_TRANS_SETATTR_SIZE, "SETATTR_SIZE" }, \ + { XFS_TRANS_INACTIVE, "INACTIVE" }, \ + { XFS_TRANS_CREATE, "CREATE" }, \ + { XFS_TRANS_CREATE_TRUNC, "CREATE_TRUNC" }, \ + { XFS_TRANS_TRUNCATE_FILE, "TRUNCATE_FILE" }, \ + { XFS_TRANS_REMOVE, "REMOVE" }, \ + { XFS_TRANS_LINK, "LINK" }, \ + { XFS_TRANS_RENAME, "RENAME" }, \ + { XFS_TRANS_MKDIR, "MKDIR" }, \ + { XFS_TRANS_RMDIR, "RMDIR" }, \ + { XFS_TRANS_SYMLINK, "SYMLINK" }, \ + { XFS_TRANS_SET_DMATTRS, "SET_DMATTRS" }, \ + { XFS_TRANS_GROWFS, "GROWFS" }, \ + { XFS_TRANS_STRAT_WRITE, "STRAT_WRITE" }, \ + { XFS_TRANS_DIOSTRAT, "DIOSTRAT" }, \ + { XFS_TRANS_WRITEID, "WRITEID" }, \ + { XFS_TRANS_ADDAFORK, "ADDAFORK" }, \ + { XFS_TRANS_ATTRINVAL, "ATTRINVAL" }, \ + { XFS_TRANS_ATRUNCATE, "ATRUNCATE" }, \ + { XFS_TRANS_ATTR_SET, "ATTR_SET" }, \ + { XFS_TRANS_ATTR_RM, "ATTR_RM" }, \ + { XFS_TRANS_ATTR_FLAG, "ATTR_FLAG" }, \ + { XFS_TRANS_CLEAR_AGI_BUCKET, "CLEAR_AGI_BUCKET" }, \ + { XFS_TRANS_QM_SBCHANGE, "QM_SBCHANGE" }, \ + { XFS_TRANS_QM_QUOTAOFF, "QM_QUOTAOFF" }, \ + { XFS_TRANS_QM_DQALLOC, "QM_DQALLOC" }, \ + { XFS_TRANS_QM_SETQLIM, "QM_SETQLIM" }, \ + { XFS_TRANS_QM_DQCLUSTER, "QM_DQCLUSTER" }, \ + { XFS_TRANS_QM_QINOCREATE, "QM_QINOCREATE" }, \ + { XFS_TRANS_QM_QUOTAOFF_END, "QM_QOFF_END" }, \ + { XFS_TRANS_SB_UNIT, "SB_UNIT" }, \ + { XFS_TRANS_FSYNC_TS, "FSYNC_TS" }, \ + { XFS_TRANS_GROWFSRT_ALLOC, "GROWFSRT_ALLOC" }, \ + { XFS_TRANS_GROWFSRT_ZERO, "GROWFSRT_ZERO" }, \ + { XFS_TRANS_GROWFSRT_FREE, "GROWFSRT_FREE" }, \ + { XFS_TRANS_SWAPEXT, "SWAPEXT" }, \ + { XFS_TRANS_SB_COUNT, "SB_COUNT" }, \ + { XFS_TRANS_CHECKPOINT, "CHECKPOINT" }, \ + { XFS_TRANS_DUMMY1, "DUMMY1" }, \ + { XFS_TRANS_DUMMY2, "DUMMY2" }, \ + { XLOG_UNMOUNT_REC_TYPE, "UNMOUNT" } + +/* +* This structure is used to track log items associated with +* a transaction. It points to the log item and keeps some +* flags to track the state of the log item. It also tracks +* the amount of space needed to log the item it describes +* once we get to commit processing (see xfs_trans_commit()). +*/ +struct xfs_log_item_desc { +struct xfs_log_item *lid_item; +struct list_head lid_trans; +unsigned char lid_flags; +}; + +#define XFS_LID_DIRTY 0x1 + +/* +* Values for t_flags. +*/ +#define XFS_TRANS_DIRTY 0x01/* something needs to be logged */ +#define XFS_TRANS_SB_DIRTY 0x02/* superblock is modified */ +#define XFS_TRANS_PERM_LOG_RES 0x04/* xact took a permanent log res */ +#define XFS_TRANS_SYNC 0x08/* make commit synchronous */ +#define XFS_TRANS_DQ_DIRTY 0x10/* at least one dquot in trx dirty */ +#define XFS_TRANS_RESERVE 0x20/* OK to use reserved data blocks */ +#define XFS_TRANS_FREEZE_PROT 0x40/* Transaction has elevated writer +count in superblock */ + +/* +* Values for call flags parameter. +*/ +#define XFS_TRANS_RELEASE_LOG_RES 0x4 +#define XFS_TRANS_ABORT 0x8 + +/* +* Field values for xfs_trans_mod_sb. +*/ +#define XFS_TRANS_SB_ICOUNT 0x00000001 +#define XFS_TRANS_SB_IFREE 0x00000002 +#define XFS_TRANS_SB_FDBLOCKS 0x00000004 +#define XFS_TRANS_SB_RES_FDBLOCKS 0x00000008 +#define XFS_TRANS_SB_FREXTENTS 0x00000010 +#define XFS_TRANS_SB_RES_FREXTENTS 0x00000020 +#define XFS_TRANS_SB_DBLOCKS 0x00000040 +#define XFS_TRANS_SB_AGCOUNT 0x00000080 +#define XFS_TRANS_SB_IMAXPCT 0x00000100 +#define XFS_TRANS_SB_REXTSIZE 0x00000200 +#define XFS_TRANS_SB_RBMBLOCKS 0x00000400 +#define XFS_TRANS_SB_RBLOCKS 0x00000800 +#define XFS_TRANS_SB_REXTENTS 0x00001000 +#define XFS_TRANS_SB_REXTSLOG 0x00002000 + +/* +* Here we centralize the specification of XFS meta-data buffer +* reference count values. This determine how hard the buffer +* cache tries to hold onto the buffer. +*/ +#define XFS_AGF_REF 4 +#define XFS_AGI_REF 4 +#define XFS_AGFL_REF 3 +#define XFS_INO_BTREE_REF 3 +#define XFS_ALLOC_BTREE_REF 2 +#define XFS_BMAP_BTREE_REF 2 +#define XFS_DIR_BTREE_REF 2 +#define XFS_INO_REF 2 +#define XFS_ATTR_BTREE_REF 1 +#define XFS_DQUOT_REF 1 + +/* * Inode Log Item Format definitions. * * This is the structure used to lay out an inode log item in the
fs/xfs/xfs_trans.c +2 -2
@@ -744,7 +744,7 @@ _xfs_trans_alloc(atomic_inc (&mp->m_active_trans); tp =kmem_zone_zalloc (xfs_trans_zone, memflags); - tp->t_magic =XFS_TRANS_MAGIC ; + tp->t_magic =XFS_TRANS_HEADER_MAGIC ; tp->t_type = type; tp->t_mountp = mp;INIT_LIST_HEAD (&tp->t_items);
@@ -789,7 +789,7 @@ xfs_trans_dup(/* * Initialize the new transaction structure. */ - ntp->t_magic =XFS_TRANS_MAGIC ; + ntp->t_magic =XFS_TRANS_HEADER_MAGIC ; ntp->t_type = tp->t_type; ntp->t_mountp = tp->t_mountp;INIT_LIST_HEAD (&ntp->t_items);
fs/xfs/xfs_trans.h +0 -205
217 lines not on this page · raw message
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 07/49] xfs: split out on-disk transaction definitions
Quoted 8 lines · Dave Chinner
From: Dave Chinner <[email protected]>
There's a bunch of definitions in
xfs_trans.hthat define on-disk formats - transaction headers taht get written into the log, log item type definitions, etc. Split out everything into a separate file so that all which remains inxfs_trans.hare kernel only definitions.
Quoted 5 lines
Also, remove the duplicate magic number definitions for
XFS_TRANS_HEADER_MAGIC...Signed-off-by Dave Chinner <[email protected]>---
Removed XFS_TRANS_MAGIC, added missing XFS_LI_ICREATE description string, otherwise code shuffling:
Quoted 458 lines
fs/xfs/xfs_log_format.h | 206 ++++++++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_trans.c | 4 +- fs/xfs/xfs_trans.h | 205 ----------------------------------------------- 3 files changed, 208 insertions(+), 207 deletions(-)fs/xfs/xfs_log_format.h +206
-0@@ -187,6 +187,212 @@ typedef struct xfs_log_iovec {/* +* Transaction Header definitions. +* +* This is the structure written in the log at the head of every transaction. It +* identifies the type and id of the transaction, and contains the number of +* items logged by the transaction so we know how many to expect during +* recovery. +* +* Do not change the below structure without redoing the code in +* xlog_recover_add_to_trans() and xlog_recover_add_to_cont_trans(). +*/ +typedef struct xfs_trans_header { +uint th_magic;/* magic number */ +uint th_type;/* transaction type */ +__int32_t th_tid;/* transaction id (unused) */ +uint th_num_items;/* num items logged by trans */ +}xfs_trans_header_t ; + +#define XFS_TRANS_HEADER_MAGIC 0x5452414e/* TRAN */ + +/* +* Log item types. +*/ +#define XFS_LI_EFI 0x1236 +#define XFS_LI_EFD 0x1237 +#define XFS_LI_IUNLINK 0x1238 +#define XFS_LI_INODE 0x123b/* aligned ino chunks, var-size ibufs */ +#define XFS_LI_BUF 0x123c/* v2 bufs, variable sized inode bufs */ +#define XFS_LI_DQUOT 0x123d +#define XFS_LI_QUOTAOFF 0x123e +#define XFS_LI_ICREATE 0x123f + +#define XFS_LI_TYPE_DESC \ + { XFS_LI_EFI, "XFS_LI_EFI" }, \ + { XFS_LI_EFD, "XFS_LI_EFD" }, \ + { XFS_LI_IUNLINK, "XFS_LI_IUNLINK" }, \ + { XFS_LI_INODE, "XFS_LI_INODE" }, \ + { XFS_LI_BUF, "XFS_LI_BUF" }, \ + { XFS_LI_DQUOT, "XFS_LI_DQUOT" }, \ + { XFS_LI_QUOTAOFF, "XFS_LI_QUOTAOFF" }, \ + { XFS_LI_ICREATE, "XFS_LI_ICREATE" } + +/* +* Transaction types. Used to distinguish types of buffers. +*/ +#define XFS_TRANS_SETATTR_NOT_SIZE 1 +#define XFS_TRANS_SETATTR_SIZE 2 +#define XFS_TRANS_INACTIVE 3 +#define XFS_TRANS_CREATE 4 +#define XFS_TRANS_CREATE_TRUNC 5 +#define XFS_TRANS_TRUNCATE_FILE 6 +#define XFS_TRANS_REMOVE 7 +#define XFS_TRANS_LINK 8 +#define XFS_TRANS_RENAME 9 +#define XFS_TRANS_MKDIR 10 +#define XFS_TRANS_RMDIR 11 +#define XFS_TRANS_SYMLINK 12 +#define XFS_TRANS_SET_DMATTRS 13 +#define XFS_TRANS_GROWFS 14 +#define XFS_TRANS_STRAT_WRITE 15 +#define XFS_TRANS_DIOSTRAT 16 +/* 17 was XFS_TRANS_WRITE_SYNC */ +#define XFS_TRANS_WRITEID 18 +#define XFS_TRANS_ADDAFORK 19 +#define XFS_TRANS_ATTRINVAL 20 +#define XFS_TRANS_ATRUNCATE 21 +#define XFS_TRANS_ATTR_SET 22 +#define XFS_TRANS_ATTR_RM 23 +#define XFS_TRANS_ATTR_FLAG 24 +#define XFS_TRANS_CLEAR_AGI_BUCKET 25 +#define XFS_TRANS_QM_SBCHANGE 26 +/* +* Dummy entries since we use the transaction type to index into the +* trans_type[] in xlog_recover_print_trans_head() +*/ +#define XFS_TRANS_DUMMY1 27 +#define XFS_TRANS_DUMMY2 28 +#define XFS_TRANS_QM_QUOTAOFF 29 +#define XFS_TRANS_QM_DQALLOC 30 +#define XFS_TRANS_QM_SETQLIM 31 +#define XFS_TRANS_QM_DQCLUSTER 32 +#define XFS_TRANS_QM_QINOCREATE 33 +#define XFS_TRANS_QM_QUOTAOFF_END 34 +#define XFS_TRANS_SB_UNIT 35 +#define XFS_TRANS_FSYNC_TS 36 +#define XFS_TRANS_GROWFSRT_ALLOC 37 +#define XFS_TRANS_GROWFSRT_ZERO 38 +#define XFS_TRANS_GROWFSRT_FREE 39 +#define XFS_TRANS_SWAPEXT 40 +#define XFS_TRANS_SB_COUNT 41 +#define XFS_TRANS_CHECKPOINT 42 +#define XFS_TRANS_ICREATE 43 +#define XFS_TRANS_TYPE_MAX 43 +/* new transaction types need to be reflected in xfs_logprint(8) */ + +#define XFS_TRANS_TYPES \ + { XFS_TRANS_SETATTR_NOT_SIZE, "SETATTR_NOT_SIZE" }, \ + { XFS_TRANS_SETATTR_SIZE, "SETATTR_SIZE" }, \ + { XFS_TRANS_INACTIVE, "INACTIVE" }, \ + { XFS_TRANS_CREATE, "CREATE" }, \ + { XFS_TRANS_CREATE_TRUNC, "CREATE_TRUNC" }, \ + { XFS_TRANS_TRUNCATE_FILE, "TRUNCATE_FILE" }, \ + { XFS_TRANS_REMOVE, "REMOVE" }, \ + { XFS_TRANS_LINK, "LINK" }, \ + { XFS_TRANS_RENAME, "RENAME" }, \ + { XFS_TRANS_MKDIR, "MKDIR" }, \ + { XFS_TRANS_RMDIR, "RMDIR" }, \ + { XFS_TRANS_SYMLINK, "SYMLINK" }, \ + { XFS_TRANS_SET_DMATTRS, "SET_DMATTRS" }, \ + { XFS_TRANS_GROWFS, "GROWFS" }, \ + { XFS_TRANS_STRAT_WRITE, "STRAT_WRITE" }, \ + { XFS_TRANS_DIOSTRAT, "DIOSTRAT" }, \ + { XFS_TRANS_WRITEID, "WRITEID" }, \ + { XFS_TRANS_ADDAFORK, "ADDAFORK" }, \ + { XFS_TRANS_ATTRINVAL, "ATTRINVAL" }, \ + { XFS_TRANS_ATRUNCATE, "ATRUNCATE" }, \ + { XFS_TRANS_ATTR_SET, "ATTR_SET" }, \ + { XFS_TRANS_ATTR_RM, "ATTR_RM" }, \ + { XFS_TRANS_ATTR_FLAG, "ATTR_FLAG" }, \ + { XFS_TRANS_CLEAR_AGI_BUCKET, "CLEAR_AGI_BUCKET" }, \ + { XFS_TRANS_QM_SBCHANGE, "QM_SBCHANGE" }, \ + { XFS_TRANS_QM_QUOTAOFF, "QM_QUOTAOFF" }, \ + { XFS_TRANS_QM_DQALLOC, "QM_DQALLOC" }, \ + { XFS_TRANS_QM_SETQLIM, "QM_SETQLIM" }, \ + { XFS_TRANS_QM_DQCLUSTER, "QM_DQCLUSTER" }, \ + { XFS_TRANS_QM_QINOCREATE, "QM_QINOCREATE" }, \ + { XFS_TRANS_QM_QUOTAOFF_END, "QM_QOFF_END" }, \ + { XFS_TRANS_SB_UNIT, "SB_UNIT" }, \ + { XFS_TRANS_FSYNC_TS, "FSYNC_TS" }, \ + { XFS_TRANS_GROWFSRT_ALLOC, "GROWFSRT_ALLOC" }, \ + { XFS_TRANS_GROWFSRT_ZERO, "GROWFSRT_ZERO" }, \ + { XFS_TRANS_GROWFSRT_FREE, "GROWFSRT_FREE" }, \ + { XFS_TRANS_SWAPEXT, "SWAPEXT" }, \ + { XFS_TRANS_SB_COUNT, "SB_COUNT" }, \ + { XFS_TRANS_CHECKPOINT, "CHECKPOINT" }, \ + { XFS_TRANS_DUMMY1, "DUMMY1" }, \ + { XFS_TRANS_DUMMY2, "DUMMY2" }, \ + { XLOG_UNMOUNT_REC_TYPE, "UNMOUNT" } + +/* +* This structure is used to track log items associated with +* a transaction. It points to the log item and keeps some +* flags to track the state of the log item. It also tracks +* the amount of space needed to log the item it describes +* once we get to commit processing (see xfs_trans_commit()). +*/ +struct xfs_log_item_desc { +struct xfs_log_item *lid_item; +struct list_head lid_trans; +unsigned char lid_flags; +}; + +#define XFS_LID_DIRTY 0x1 + +/* +* Values for t_flags. +*/ +#define XFS_TRANS_DIRTY 0x01/* something needs to be logged */ +#define XFS_TRANS_SB_DIRTY 0x02/* superblock is modified */ +#define XFS_TRANS_PERM_LOG_RES 0x04/* xact took a permanent log res */ +#define XFS_TRANS_SYNC 0x08/* make commit synchronous */ +#define XFS_TRANS_DQ_DIRTY 0x10/* at least one dquot in trx dirty */ +#define XFS_TRANS_RESERVE 0x20/* OK to use reserved data blocks */ +#define XFS_TRANS_FREEZE_PROT 0x40/* Transaction has elevated writer +count in superblock */ + +/* +* Values for call flags parameter. +*/ +#define XFS_TRANS_RELEASE_LOG_RES 0x4 +#define XFS_TRANS_ABORT 0x8 + +/* +* Field values for xfs_trans_mod_sb. +*/ +#define XFS_TRANS_SB_ICOUNT 0x00000001 +#define XFS_TRANS_SB_IFREE 0x00000002 +#define XFS_TRANS_SB_FDBLOCKS 0x00000004 +#define XFS_TRANS_SB_RES_FDBLOCKS 0x00000008 +#define XFS_TRANS_SB_FREXTENTS 0x00000010 +#define XFS_TRANS_SB_RES_FREXTENTS 0x00000020 +#define XFS_TRANS_SB_DBLOCKS 0x00000040 +#define XFS_TRANS_SB_AGCOUNT 0x00000080 +#define XFS_TRANS_SB_IMAXPCT 0x00000100 +#define XFS_TRANS_SB_REXTSIZE 0x00000200 +#define XFS_TRANS_SB_RBMBLOCKS 0x00000400 +#define XFS_TRANS_SB_RBLOCKS 0x00000800 +#define XFS_TRANS_SB_REXTENTS 0x00001000 +#define XFS_TRANS_SB_REXTSLOG 0x00002000 + +/* +* Here we centralize the specification of XFS meta-data buffer +* reference count values. This determine how hard the buffer +* cache tries to hold onto the buffer. +*/ +#define XFS_AGF_REF 4 +#define XFS_AGI_REF 4 +#define XFS_AGFL_REF 3 +#define XFS_INO_BTREE_REF 3 +#define XFS_ALLOC_BTREE_REF 2 +#define XFS_BMAP_BTREE_REF 2 +#define XFS_DIR_BTREE_REF 2 +#define XFS_INO_REF 2 +#define XFS_ATTR_BTREE_REF 1 +#define XFS_DQUOT_REF 1 + +/* * Inode Log Item Format definitions. * * This is the structure used to lay out an inode log item in the fs/xfs/xfs_trans.c +2
-2@@ -744,7 +744,7 @@ _xfs_trans_alloc(atomic_inc (&mp->m_active_trans); tp =kmem_zone_zalloc (xfs_trans_zone, memflags); - tp->t_magic =XFS_TRANS_MAGIC ; + tp->t_magic =XFS_TRANS_HEADER_MAGIC ; tp->t_type = type; tp->t_mountp = mp;INIT_LIST_HEAD (&tp->t_items);@@ -789,7 +789,7 @@ xfs_trans_dup(/* * Initialize the new transaction structure. */ - ntp->t_magic =XFS_TRANS_MAGIC ; + ntp->t_magic =XFS_TRANS_HEADER_MAGIC ; ntp->t_type = tp->t_type; ntp->t_mountp = tp->t_mountp;INIT_LIST_HEAD (&ntp->t_items);fs/xfs/xfs_trans.h +0
-198@@ -21,195 +21,6 @@struct xfs_log_item ;/* -* This is the structure written in the log at the head of -* every transaction. It identifies the type and id of the -* transaction, and contains the number of items logged by -* the transaction so we know how many to expect during recovery. -* -* Do not change the below structure without redoing the code in -* xlog_recover_add_to_trans() and xlog_recover_add_to_cont_trans(). -*/ -typedef struct xfs_trans_header { -uint th_magic;/* magic number */ -uint th_type;/* transaction type */ -__int32_t th_tid;/* transaction id (unused) */ -uint th_num_items;/* num items logged by trans */ -}xfs_trans_header_t ; - -#define XFS_TRANS_HEADER_MAGIC 0x5452414e/* TRAN */ - -/* -* Log item types. -*/ -#define XFS_LI_EFI 0x1236 -#define XFS_LI_EFD 0x1237 -#define XFS_LI_IUNLINK 0x1238 -#define XFS_LI_INODE 0x123b/* aligned ino chunks, var-size ibufs */ -#define XFS_LI_BUF 0x123c/* v2 bufs, variable sized inode bufs */ -#define XFS_LI_DQUOT 0x123d -#define XFS_LI_QUOTAOFF 0x123e -#define XFS_LI_ICREATE 0x123f - -#define XFS_LI_TYPE_DESC \ - { XFS_LI_EFI, "XFS_LI_EFI" }, \ - { XFS_LI_EFD, "XFS_LI_EFD" }, \ - { XFS_LI_IUNLINK, "XFS_LI_IUNLINK" }, \ - { XFS_LI_INODE, "XFS_LI_INODE" }, \ - { XFS_LI_BUF, "XFS_LI_BUF" }, \ - { XFS_LI_DQUOT, "XFS_LI_DQUOT" }, \ - { XFS_LI_QUOTAOFF, "XFS_LI_QUOTAOFF" } - -/* -* Transaction types. Used to distinguish types of buffers. -*/ -#define XFS_TRANS_SETATTR_NOT_SIZE 1 -#define XFS_TRANS_SETATTR_SIZE 2 -#define XFS_TRANS_INACTIVE 3 -#define XFS_TRANS_CREATE 4 -#define XFS_TRANS_CREATE_TRUNC 5 -#define XFS_TRANS_TRUNCATE_FILE 6 -#define XFS_TRANS_REMOVE 7 -#define XFS_TRANS_LINK 8 -#define XFS_TRANS_RENAME 9 -#define XFS_TRANS_MKDIR 10 -#define XFS_TRANS_RMDIR 11 -#define XFS_TRANS_SYMLINK 12 -#define XFS_TRANS_SET_DMATTRS 13 -#define XFS_TRANS_GROWFS 14 -#define XFS_TRANS_STRAT_WRITE 15 -#define XFS_TRANS_DIOSTRAT 16 -/* 17 was XFS_TRANS_WRITE_SYNC */ -#define XFS_TRANS_WRITEID 18 -#define XFS_TRANS_ADDAFORK 19 -#define XFS_TRANS_ATTRINVAL 20 -#define XFS_TRANS_ATRUNCATE 21 -#define XFS_TRANS_ATTR_SET 22 -#define XFS_TRANS_ATTR_RM 23 -#define XFS_TRANS_ATTR_FLAG 24 -#define XFS_TRANS_CLEAR_AGI_BUCKET 25 -#define XFS_TRANS_QM_SBCHANGE 26 -/* -* Dummy entries since we use the transaction type to index into the -* trans_type[] in xlog_recover_print_trans_head() -*/ -#define XFS_TRANS_DUMMY1 27 -#define XFS_TRANS_DUMMY2 28 -#define XFS_TRANS_QM_QUOTAOFF 29 -#define XFS_TRANS_QM_DQALLOC 30 -#define XFS_TRANS_QM_SETQLIM 31 -#define XFS_TRANS_QM_DQCLUSTER 32 -#define XFS_TRANS_QM_QINOCREATE 33 -#define XFS_TRANS_QM_QUOTAOFF_END 34 -#define XFS_TRANS_SB_UNIT 35 -#define XFS_TRANS_FSYNC_TS 36 -#define XFS_TRANS_GROWFSRT_ALLOC 37 -#define XFS_TRANS_GROWFSRT_ZERO 38 -#define XFS_TRANS_GROWFSRT_FREE 39 -#define XFS_TRANS_SWAPEXT 40 -#define XFS_TRANS_SB_COUNT 41 -#define XFS_TRANS_CHECKPOINT 42 -#define XFS_TRANS_ICREATE 43 -#define XFS_TRANS_TYPE_MAX 43 -/* new transaction types need to be reflected in xfs_logprint(8) */ - -#define XFS_TRANS_TYPES \ - { XFS_TRANS_SETATTR_NOT_SIZE, "SETATTR_NOT_SIZE" }, \ - { XFS_TRANS_SETATTR_SIZE, "SETATTR_SIZE" }, \ - { XFS_TRANS_INACTIVE, "INACTIVE" }, \ - { XFS_TRANS_CREATE, "CREATE" }, \ - { XFS_TRANS_CREATE_TRUNC, "CREATE_TRUNC" }, \ - { XFS_TRANS_TRUNCATE_FILE, "TRUNCATE_FILE" }, \ - { XFS_TRANS_REMOVE, "REMOVE" }, \ - { XFS_TRANS_LINK, "LINK" }, \ - { XFS_TRANS_RENAME, "RENAME" }, \ - { XFS_TRANS_MKDIR, "MKDIR" }, \ - { XFS_TRANS_RMDIR, "RMDIR" }, \ - { XFS_TRANS_SYMLINK, "SYMLINK" }, \ - { XFS_TRANS_SET_DMATTRS, "SET_DMATTRS" }, \ - { XFS_TRANS_GROWFS, "GROWFS" }, \ - { XFS_TRANS_STRAT_WRITE, "STRAT_WRITE" }, \ - { XFS_TRANS_DIOSTRAT, "DIOSTRAT" }, \ - { XFS_TRANS_WRITEID, "WRITEID" }, \ - { XFS_TRANS_ADDAFORK, "ADDAFORK" }, \ - { XFS_TRANS_ATTRINVAL, "ATTRINVAL" }, \ - { XFS_TRANS_ATRUNCATE, "ATRUNCATE" }, \ - { XFS_TRANS_ATTR_SET, "ATTR_SET" }, \ - { XFS_TRANS_ATTR_RM, "ATTR_RM" }, \ - { XFS_TRANS_ATTR_FLAG, "ATTR_FLAG" }, \ - { XFS_TRANS_CLEAR_AGI_BUCKET, "CLEAR_AGI_BUCKET" }, \ - { XFS_TRANS_QM_SBCHANGE, "QM_SBCHANGE" }, \ - { XFS_TRANS_QM_QUOTAOFF, "QM_QUOTAOFF" }, \ - { XFS_TRANS_QM_DQALLOC, "QM_DQALLOC" }, \ - { XFS_TRANS_QM_SETQLIM, "QM_SETQLIM" }, \ - { XFS_TRANS_QM_DQCLUSTER, "QM_DQCLUSTER" }, \ - { XFS_TRANS_QM_QINOCREATE, "QM_QINOCREATE" }, \ - { XFS_TRANS_QM_QUOTAOFF_END, "QM_QOFF_END" }, \ - { XFS_TRANS_SB_UNIT, "SB_UNIT" }, \ - { XFS_TRANS_FSYNC_TS, "FSYNC_TS" }, \ - { XFS_TRANS_GROWFSRT_ALLOC, "GROWFSRT_ALLOC" }, \ - { XFS_TRANS_GROWFSRT_ZERO, "GROWFSRT_ZERO" }, \ - { XFS_TRANS_GROWFSRT_FREE, "GROWFSRT_FREE" }, \ - { XFS_TRANS_SWAPEXT, "SWAPEXT" }, \ - { XFS_TRANS_SB_COUNT, "SB_COUNT" }, \ - { XFS_TRANS_CHECKPOINT, "CHECKPOINT" }, \ - { XFS_TRANS_DUMMY1, "DUMMY1" }, \ - { XFS_TRANS_DUMMY2, "DUMMY2" }, \ - { XLOG_UNMOUNT_REC_TYPE, "UNMOUNT" } - -/* -* This structure is used to track log items associated with -* a transaction. It points to the log item and keeps some -* flags to track the state of the log item. It also tracks -* the amount of space needed to log the item it describes -* once we get to commit processing (see xfs_trans_commit()). -*/ -struct xfs_log_item_desc { -struct xfs_log_item *lid_item; -struct list_head lid_trans; -unsigned char lid_flags; -}; - -#define XFS_LID_DIRTY 0x1 - -#define XFS_TRANS_MAGIC 0x5452414E/* 'TRAN' */ -/* -* Values for t_flags. -*/ -#define XFS_TRANS_DIRTY 0x01/* something needs to be logged */ -#define XFS_TRANS_SB_DIRTY 0x02/* superblock is modified */ -#define XFS_TRANS_PERM_LOG_RES 0x04/* xact took a permanent log res */ -#define XFS_TRANS_SYNC 0x08/* make commit synchronous */ -#define XFS_TRANS_DQ_DIRTY 0x10/* at least one dquot in trx dirty */ -#define XFS_TRANS_RESERVE 0x20/* OK to use reserved data blocks */ -#define XFS_TRANS_FREEZE_PROT 0x40/* Transaction has elevated writer -count in superblock */ - -/* -* Values for call flags parameter. -*/ -#define XFS_TRANS_RELEASE_LOG_RES 0x4 -#define XFS_TRANS_ABORT 0x8 - -/* -* Field values for xfs_trans_mod_sb. -*/ -#define XFS_TRANS_SB_ICOUNT 0x00000001 -#define XFS_TRANS_SB_IFREE 0x00000002 -#define XFS_TRANS_SB_FDBLOCKS 0x00000004 -#define XFS_TRANS_SB_RES_FDBLOCKS 0x00000008 -#define XFS_TRANS_SB_FREXTENTS 0x00000010 -#define XFS_TRANS_SB_RES_FREXTENTS 0x00000020 -#define XFS_TRANS_SB_DBLOCKS 0x00000040 -#define XFS_TRANS_SB_AGCOUNT 0x00000080 -#define XFS_TRANS_SB_IMAXPCT 0x00000100 -#define XFS_TRANS_SB_REXTSIZE 0x00000200 -#define XFS_TRANS_SB_RBMBLOCKS 0x00000400 -#define XFS_TRANS_SB_RBLOCKS 0x00000800 -#define XFS_TRANS_SB_REXTENTS 0x00001000 -#define XFS_TRANS_SB_REXTSLOG 0x00002000 - - -/* * Per-extent log reservation for the allocation btree changes * involved in freeing or allocating an extent. * 2 trees * (2 blocks/level * max depth - 1) @@ -282,22 +93,6 @@ struct xfs_log_item_desc {#define XFS_ATTRSET_LOG_COUNT 3#define XFS_ATTRRM_LOG_COUNT 3 -/* -* Here we centralize the specification of XFS meta-data buffer -* reference count values. This determine how hard the buffer -* cache tries to hold onto the buffer. -*/ -#define XFS_AGF_REF 4 -#define XFS_AGI_REF 4 -#define XFS_AGFL_REF 3 -#define XFS_INO_BTREE_REF 3
fs/xfs/xfs_trans.h struct xfs_log_item_desc { · line 98
Quoted 10 lines
fs/xfs/xfs_trans.h +0
-7-#define XFS_ALLOC_BTREE_REF 2 -#define XFS_BMAP_BTREE_REF 2 -#define XFS_DIR_BTREE_REF 2 -#define XFS_INO_REF 2 -#define XFS_ATTR_BTREE_REF 1 -#define XFS_DQUOT_REF 1 -#ifdef __KERNEL__struct xfs_buf ;
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 8/49 xfs: introduce xfs_rtalloc_defs.h
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
There are quite a few realtime device definitions shared with userspace. Move them from xfs_rtalloc.h to xfs_rt_alloc_defs.h so we don't need to share xfs_rtalloc.h with userspace anymore.
This removes the final __KERNEL__ region from the XFS kernel codebase. Yay!
--- fs/xfs/xfs_format.h | 41 ++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_rtalloc.c | 2 +- fs/xfs/xfs_rtalloc.h | 53 ++-------------------------------------------------- fs/xfs/xfs_types.h | 10 ++++++++++ 4 files changed, 54 insertions(+), 52 deletions(-)
fs/xfs/xfs_format.h +41 -0
@@ -28,6 +28,47 @@*/ /* +* RealTime Device format definitions +*/ + +/* Min and max rt extent sizes, specified in bytes */ +#define XFS_MAX_RTEXTSIZE (1024 * 1024 * 1024)/* 1GB */ +#define XFS_DFL_RTEXTSIZE (64 * 1024)/* 64kB */ +#define XFS_MIN_RTEXTSIZE (4 * 1024)/* 4kB */ + +#define XFS_BLOCKSIZE (mp) ((mp)->m_sb.sb_blocksize) +#define XFS_BLOCKMASK (mp) ((mp)->m_blockmask) +#define XFS_BLOCKWSIZE (mp) ((mp)->m_blockwsize) +#define XFS_BLOCKWMASK (mp) ((mp)->m_blockwmask) + +/* +* RT Summary and bit manipulation macros. +*/ +#define XFS_SUMOFFS (mp,ls,bb) ((int)((ls) * (mp)->m_sb.sb_rbmblocks + (bb))) +#define XFS_SUMOFFSTOBLOCK (mp,s) \ + (((s) * (uint)sizeof(xfs_suminfo_t)) >> (mp)->m_sb.sb_blocklog) +#define XFS_SUMPTR (mp,bp,so) \ + ((xfs_suminfo_t *)((bp)->b_addr + \ + (((so) * (uint)sizeof(xfs_suminfo_t)) & XFS_BLOCKMASK(mp)))) + +#define XFS_BITTOBLOCK (mp,bi) ((bi) >> (mp)->m_blkbit_log) +#define XFS_BLOCKTOBIT (mp,bb) ((bb) << (mp)->m_blkbit_log) +#define XFS_BITTOWORD (mp,bi) \ + ((int)(((bi) >> XFS_NBWORDLOG) & XFS_BLOCKWMASK(mp))) + +#define XFS_RTMIN (a,b) ((a) < (b) ? (a) : (b)) +#define XFS_RTMAX (a,b) ((a) > (b) ? (a) : (b)) + +#define XFS_RTLOBIT (w) xfs_lowbit32(w) +#define XFS_RTHIBIT (w) xfs_highbit32(w) + +#if XFS_BIG_BLKNOS +#define XFS_RTBLOCKLOG (b) xfs_highbit64(b) +#else +#define XFS_RTBLOCKLOG (b) xfs_highbit32(b) +#endif + +/* * Dquot and dquot block format definitions */ #define XFS_DQUOT_MAGIC 0x4451/* 'DQ' */
fs/xfs/xfs_rtalloc.c +1 -1
@@ -17,7 +17,7 @@*/ #include "xfs.h" #include "xfs_fs.h" -#include "xfs_types.h" +#include "xfs_format.h" #include "xfs_bit.h" #include "xfs_log.h" #include "xfs_trans.h"
fs/xfs/xfs_rtalloc.h +2 -51
66 lines not on this page · raw message
fs/xfs/xfs_types.h +10 -0
@@ -183,4 +183,14 @@ struct xfs_name {*/ typedef __uint32_t xfs_dqid_t ; +/* +* Constants for bit manipulations. +*/ +#define XFS_NBBYLOG 3/* log2(NBBY) */ +#define XFS_WORDLOG 2/* log2(sizeof(xfs_rtword_t)) */ +#define XFS_NBWORDLOG (XFS_NBBYLOG + XFS_WORDLOG) +#define XFS_NBWORD (1 << XFS_NBWORDLOG) +#define XFS_WORDMASK ((1 << XFS_WORDLOG) - 1) + +#endif /* __XFS_TYPES_H__ */
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 08/49] xfs: introduce xfs_rtalloc_defs.h
Quoted 11 lines · Dave Chinner
From: Dave Chinner <[email protected]>
There are quite a few realtime device definitions shared with userspace. Move them from
xfs_rtalloc.htoxfs_rt_alloc_defs.hso we don't need to sharexfs_rtalloc.hwith userspace anymore.This removes the final
__KERNEL__region from the XFS kernel codebase. Yay!Signed-off-by Dave Chinner <[email protected]>---
Quoted 153 lines
fs/xfs/xfs_format.h | 41 ++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_rtalloc.c | 2 +- fs/xfs/xfs_rtalloc.h | 53 ++-------------------------------------------------- fs/xfs/xfs_types.h | 10 ++++++++++ 4 files changed, 54 insertions(+), 52 deletions(-)fs/xfs/xfs_format.h +41
-0@@ -28,6 +28,47 @@*/ /* +* RealTime Device format definitions +*/ + +/* Min and max rt extent sizes, specified in bytes */ +#define XFS_MAX_RTEXTSIZE (1024 * 1024 * 1024)/* 1GB */ +#define XFS_DFL_RTEXTSIZE (64 * 1024)/* 64kB */ +#define XFS_MIN_RTEXTSIZE (4 * 1024)/* 4kB */ + +#define XFS_BLOCKSIZE (mp) ((mp)->m_sb.sb_blocksize) +#define XFS_BLOCKMASK (mp) ((mp)->m_blockmask) +#define XFS_BLOCKWSIZE (mp) ((mp)->m_blockwsize) +#define XFS_BLOCKWMASK (mp) ((mp)->m_blockwmask) + +/* +* RT Summary and bit manipulation macros. +*/ +#define XFS_SUMOFFS (mp,ls,bb) ((int)((ls) * (mp)->m_sb.sb_rbmblocks + (bb))) +#define XFS_SUMOFFSTOBLOCK (mp,s) \ + (((s) * (uint)sizeof(xfs_suminfo_t)) >> (mp)->m_sb.sb_blocklog) +#define XFS_SUMPTR (mp,bp,so) \ + ((xfs_suminfo_t *)((bp)->b_addr + \ + (((so) * (uint)sizeof(xfs_suminfo_t)) & XFS_BLOCKMASK(mp)))) + +#define XFS_BITTOBLOCK (mp,bi) ((bi) >> (mp)->m_blkbit_log) +#define XFS_BLOCKTOBIT (mp,bb) ((bb) << (mp)->m_blkbit_log) +#define XFS_BITTOWORD (mp,bi) \ + ((int)(((bi) >> XFS_NBWORDLOG) & XFS_BLOCKWMASK(mp))) + +#define XFS_RTMIN (a,b) ((a) < (b) ? (a) : (b)) +#define XFS_RTMAX (a,b) ((a) > (b) ? (a) : (b)) + +#define XFS_RTLOBIT (w) xfs_lowbit32(w) +#define XFS_RTHIBIT (w) xfs_highbit32(w) + +#if XFS_BIG_BLKNOS +#define XFS_RTBLOCKLOG (b) xfs_highbit64(b) +#else +#define XFS_RTBLOCKLOG (b) xfs_highbit32(b) +#endif + +/* * Dquot and dquot block format definitions */ #define XFS_DQUOT_MAGIC 0x4451/* 'DQ' */ fs/xfs/xfs_rtalloc.c +1
-1@@ -17,7 +17,7 @@*/ #include "xfs.h" #include "xfs_fs.h" -#include "xfs_types.h" +#include "xfs_format.h" #include "xfs_bit.h" #include "xfs_log.h" #include "xfs_trans.h" fs/xfs/xfs_rtalloc.h +2
-51@@ -18,58 +18,11 @@#ifndef __XFS_RTALLOC_H__#define __XFS_RTALLOC_H__ +/* kernel only definitions and functions */ +struct xfs_mount ;struct xfs_trans ; -/* Min and max rt extent sizes, specified in bytes */ -#define XFS_MAX_RTEXTSIZE (1024 * 1024 * 1024)/* 1GB */ -#define XFS_DFL_RTEXTSIZE (64 * 1024)/* 64kB */ -#define XFS_MIN_RTEXTSIZE (4 * 1024)/* 4kB */ - -/* -* Constants for bit manipulations. -*/ -#define XFS_NBBYLOG 3/* log2(NBBY) */ -#define XFS_WORDLOG 2/* log2(sizeof(xfs_rtword_t)) */ -#define XFS_NBWORDLOG (XFS_NBBYLOG + XFS_WORDLOG) -#define XFS_NBWORD (1 << XFS_NBWORDLOG) -#define XFS_WORDMASK ((1 << XFS_WORDLOG) - 1) - -#define XFS_BLOCKSIZE (mp) ((mp)->m_sb.sb_blocksize) -#define XFS_BLOCKMASK (mp) ((mp)->m_blockmask) -#define XFS_BLOCKWSIZE (mp) ((mp)->m_blockwsize) -#define XFS_BLOCKWMASK (mp) ((mp)->m_blockwmask) - -/* -* Summary and bit manipulation macros. -*/ -#define XFS_SUMOFFS (mp,ls,bb) ((int)((ls) * (mp)->m_sb.sb_rbmblocks + (bb))) -#define XFS_SUMOFFSTOBLOCK (mp,s) \ - (((s) * (uint)sizeof(xfs_suminfo_t)) >> (mp)->m_sb.sb_blocklog) -#define XFS_SUMPTR (mp,bp,so) \ - ((xfs_suminfo_t *)((bp)->b_addr + \ - (((so) * (uint)sizeof(xfs_suminfo_t)) & XFS_BLOCKMASK(mp)))) - -#define XFS_BITTOBLOCK (mp,bi) ((bi) >> (mp)->m_blkbit_log) -#define XFS_BLOCKTOBIT (mp,bb) ((bb) << (mp)->m_blkbit_log) -#define XFS_BITTOWORD (mp,bi) \ - ((int)(((bi) >> XFS_NBWORDLOG) & XFS_BLOCKWMASK(mp))) - -#define XFS_RTMIN (a,b) ((a) < (b) ? (a) : (b)) -#define XFS_RTMAX (a,b) ((a) > (b) ? (a) : (b)) - -#define XFS_RTLOBIT (w) xfs_lowbit32(w) -#define XFS_RTHIBIT (w) xfs_highbit32(w) - -#if XFS_BIG_BLKNOS -#define XFS_RTBLOCKLOG (b) xfs_highbit64(b) -#else -#define XFS_RTBLOCKLOG (b) xfs_highbit32(b) -#endif - - -#ifdef __KERNEL__ -#ifdef CONFIG_XFS_RT /* * Function prototypes for exported functions. @@ -161,6 +114,4 @@ xfs_rtmount_init(# define xfs_rtunmount_inodes (m)#endif /* CONFIG_XFS_RT */ -#endif /* __KERNEL__ */ -#endif /* __XFS_RTALLOC_H__ */ fs/xfs/xfs_types.h +1
-0@@ -183,4 +183,14 @@ struct xfs_name {*/ typedef __uint32_t xfs_dqid_t ; +/*
fs/xfs/xfs_types.h struct xfs_name { · line 196
Quoted 10 lines
fs/xfs/xfs_types.h +9
-0+* Constants for bit manipulations. +*/ +#define XFS_NBBYLOG 3/* log2(NBBY) */ +#define XFS_WORDLOG 2/* log2(sizeof(xfs_rtword_t)) */ +#define XFS_NBWORDLOG (XFS_NBBYLOG + XFS_WORDLOG) +#define XFS_NBWORD (1 << XFS_NBWORDLOG) +#define XFS_WORDMASK ((1 << XFS_WORDLOG) - 1) + +#endif /* __XFS_TYPES_H__ */
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 9/49 xfs: introduce xfs_quota_defs.h
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
There are a lot of quota flag definitions that are shared by user and kernel space. Move them all to xfs_quota_defs.h so we can unshare xfs_quota.h and remove the __KERNEL__ regions from it.
--- fs/xfs/xfs_quota.h | 134 +---------------------------------------- fs/xfs/xfs_quota_defs.h | 157 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 160 insertions(+), 131 deletions(-) create mode 100644 fs/xfs/xfs_quota_defs.h
fs/xfs/xfs_quota.h +3 -131
@@ -18,141 +18,14 @@#ifndef __XFS_QUOTA_H__#define __XFS_QUOTA_H__ -struct xfs_trans ; +#include "xfs_quota_defs.h" /* -* Even though users may not have quota limits occupying all 64-bits, -* they may need 64-bit accounting. Hence, 64-bit quota-counters, -* and quota-limits. This is a waste in the common case, but hey ... +* Kernel only quota definitions and functions */ -typedef __uint64_t xfs_qcnt_t ; -typedef __uint16_t xfs_qwarncnt_t ; - -/* -* flags for q_flags field in the dquot. -*/ -#define XFS_DQ_USER 0x0001/* a user quota */ -#define XFS_DQ_PROJ 0x0002/* project quota */ -#define XFS_DQ_GROUP 0x0004/* a group quota */ -#define XFS_DQ_DIRTY 0x0008/* dquot is dirty */ -#define XFS_DQ_FREEING 0x0010/* dquot is beeing torn down */ - -#define XFS_DQ_ALLTYPES (XFS_DQ_USER|XFS_DQ_PROJ|XFS_DQ_GROUP) -#define XFS_DQ_FLAGS \ - { XFS_DQ_USER, "USER" }, \ - { XFS_DQ_PROJ, "PROJ" }, \ - { XFS_DQ_GROUP, "GROUP" }, \ - { XFS_DQ_DIRTY, "DIRTY" }, \ - { XFS_DQ_FREEING, "FREEING" } - -/* -* We have the possibility of all three quota types being active at once, and -* hence free space modification requires modification of all three current -* dquots in a single transaction. For this case we need to have a reservation -* of at least 3 dquots. -* -* However, a chmod operation can change both UID and GID in a single -* transaction, resulting in requiring {old, new} x {uid, gid} dquots to be -* modified. Hence for this case we need to reserve space for at least 4 dquots. -* -* And in the worst case, there's a rename operation that can be modifying up to -* 4 inodes with dquots attached to them. In reality, the only inodes that can -* have their dquots modified are the source and destination directory inodes -* due to directory name creation and removal. That can require space allocation -* and/or freeing on both directory inodes, and hence all three dquots on each -* inode can be modified. And if the directories are world writeable, all the -* dquots can be unique and so 6 dquots can be modified.... -* -* And, of course, we also need to take into account the dquot log format item -* used to describe each dquot. -*/ -#define XFS_DQUOT_LOGRES (mp) \ - ((sizeof(struct xfs_dq_logformat) + sizeof(struct xfs_disk_dquot)) * 6) - -#define XFS_IS_QUOTA_RUNNING (mp) ((mp)->m_qflags & XFS_ALL_QUOTA_ACCT) -#define XFS_IS_UQUOTA_RUNNING (mp) ((mp)->m_qflags & XFS_UQUOTA_ACCT) -#define XFS_IS_PQUOTA_RUNNING (mp) ((mp)->m_qflags & XFS_PQUOTA_ACCT) -#define XFS_IS_GQUOTA_RUNNING (mp) ((mp)->m_qflags & XFS_GQUOTA_ACCT) -#define XFS_IS_UQUOTA_ENFORCED (mp) ((mp)->m_qflags & XFS_UQUOTA_ENFD) -#define XFS_IS_GQUOTA_ENFORCED (mp) ((mp)->m_qflags & XFS_GQUOTA_ENFD) -#define XFS_IS_PQUOTA_ENFORCED (mp) ((mp)->m_qflags & XFS_PQUOTA_ENFD) - -/* -* Incore only flags for quotaoff - these bits get cleared when quota(s) -* are in the process of getting turned off. These flags are in m_qflags but -* never in sb_qflags. -*/ -#define XFS_UQUOTA_ACTIVE 0x1000/* uquotas are being turned off */ -#define XFS_GQUOTA_ACTIVE 0x2000/* gquotas are being turned off */ -#define XFS_PQUOTA_ACTIVE 0x4000/* pquotas are being turned off */ -#define XFS_ALL_QUOTA_ACTIVE \ - (XFS_UQUOTA_ACTIVE | XFS_GQUOTA_ACTIVE | XFS_PQUOTA_ACTIVE) - -/* -* Checking XFS_IS_*QUOTA_ON() while holding any inode lock guarantees -* quota will be not be switched off as long as that inode lock is held. -*/ -#define XFS_IS_QUOTA_ON (mp) ((mp)->m_qflags & (XFS_UQUOTA_ACTIVE | \ - XFS_GQUOTA_ACTIVE | \ - XFS_PQUOTA_ACTIVE)) -#define XFS_IS_OQUOTA_ON (mp) ((mp)->m_qflags & (XFS_GQUOTA_ACTIVE | \ - XFS_PQUOTA_ACTIVE)) -#define XFS_IS_UQUOTA_ON (mp) ((mp)->m_qflags & XFS_UQUOTA_ACTIVE) -#define XFS_IS_GQUOTA_ON (mp) ((mp)->m_qflags & XFS_GQUOTA_ACTIVE) -#define XFS_IS_PQUOTA_ON (mp) ((mp)->m_qflags & XFS_PQUOTA_ACTIVE) - -/* -* Flags to tell various functions what to do. Not all of these are meaningful -* to a single function. None of these XFS_QMOPT_* flags are meant to have -* persistent values (ie. their values can and will change between versions) -*/ -#define XFS_QMOPT_DQALLOC 0x0000002/* alloc dquot ondisk if needed */ -#define XFS_QMOPT_UQUOTA 0x0000004/* user dquot requested */ -#define XFS_QMOPT_PQUOTA 0x0000008/* project dquot requested */ -#define XFS_QMOPT_FORCE_RES 0x0000010/* ignore quota limits */ -#define XFS_QMOPT_SBVERSION 0x0000040/* change superblock version num */ -#define XFS_QMOPT_DOWARN 0x0000400/* increase warning cnt if needed */ -#define XFS_QMOPT_DQREPAIR 0x0001000/* repair dquot if damaged */ -#define XFS_QMOPT_GQUOTA 0x0002000/* group dquot requested */ -#define XFS_QMOPT_ENOSPC 0x0004000/* enospc instead of edquot (prj) */ - -/* -* flags to xfs_trans_mod_dquot to indicate which field needs to be -* modified. -*/ -#define XFS_QMOPT_RES_REGBLKS 0x0010000 -#define XFS_QMOPT_RES_RTBLKS 0x0020000 -#define XFS_QMOPT_BCOUNT 0x0040000 -#define XFS_QMOPT_ICOUNT 0x0080000 -#define XFS_QMOPT_RTBCOUNT 0x0100000 -#define XFS_QMOPT_DELBCOUNT 0x0200000 -#define XFS_QMOPT_DELRTBCOUNT 0x0400000 -#define XFS_QMOPT_RES_INOS 0x0800000 - -/* -* flags for dqalloc. -*/ -#define XFS_QMOPT_INHERIT 0x1000000 - -/* -* flags to xfs_trans_mod_dquot. -*/ -#define XFS_TRANS_DQ_RES_BLKS XFS_QMOPT_RES_REGBLKS -#define XFS_TRANS_DQ_RES_RTBLKS XFS_QMOPT_RES_RTBLKS -#define XFS_TRANS_DQ_RES_INOS XFS_QMOPT_RES_INOS -#define XFS_TRANS_DQ_BCOUNT XFS_QMOPT_BCOUNT -#define XFS_TRANS_DQ_DELBCOUNT XFS_QMOPT_DELBCOUNT -#define XFS_TRANS_DQ_ICOUNT XFS_QMOPT_ICOUNT -#define XFS_TRANS_DQ_RTBCOUNT XFS_QMOPT_RTBCOUNT -#define XFS_TRANS_DQ_DELRTBCOUNT XFS_QMOPT_DELRTBCOUNT - - -#define XFS_QMOPT_QUOTALL \ - (XFS_QMOPT_UQUOTA | XFS_QMOPT_PQUOTA | XFS_QMOPT_GQUOTA) -#define XFS_QMOPT_RESBLK_MASK (XFS_QMOPT_RES_REGBLKS | XFS_QMOPT_RES_RTBLKS) +struct xfs_trans ; -#ifdef __KERNEL__/* * This check is done typically without holding the inode lock; * that may seem racy, but it is harmless in the context that it is used.
@@ -289,5 +162,4 @@ extern int xfs_mount_reset_sbqflags(struct xfs_mount *);extern const struct xfs_buf_ops xfs_dquot_buf_ops; -#endif /* __KERNEL__ */ #endif /* __XFS_QUOTA_H__ */
fs/xfs/xfs_quota_defs.h new file +157 -0
157 lines not on this page · raw message
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 09/49] xfs: introduce xfs_quota_defs.h
Quoted 8 lines · Dave Chinner
From: Dave Chinner <[email protected]>
There are a lot of quota flag definitions that are shared by user and kernel space. Move them all to
xfs_quota_defs.hso we can unsharexfs_quota.hand remove the__KERNEL__regions from it.Signed-off-by Dave Chinner <[email protected]>---
Quoted 314 lines
fs/xfs/xfs_quota.h | 134 +---------------------------------------- fs/xfs/xfs_quota_defs.h | 157 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 160 insertions(+), 131 deletions(-) create mode 100644 fs/xfs/xfs_quota_defs.hfs/xfs/xfs_quota.h +3
-131@@ -18,141 +18,14 @@#ifndef __XFS_QUOTA_H__#define __XFS_QUOTA_H__ -struct xfs_trans ; +#include "xfs_quota_defs.h" /* -* Even though users may not have quota limits occupying all 64-bits, -* they may need 64-bit accounting. Hence, 64-bit quota-counters, -* and quota-limits. This is a waste in the common case, but hey ... +* Kernel only quota definitions and functions */ -typedef __uint64_t xfs_qcnt_t ; -typedef __uint16_t xfs_qwarncnt_t ; - -/* -* flags for q_flags field in the dquot. -*/ -#define XFS_DQ_USER 0x0001/* a user quota */ -#define XFS_DQ_PROJ 0x0002/* project quota */ -#define XFS_DQ_GROUP 0x0004/* a group quota */ -#define XFS_DQ_DIRTY 0x0008/* dquot is dirty */ -#define XFS_DQ_FREEING 0x0010/* dquot is beeing torn down */ - -#define XFS_DQ_ALLTYPES (XFS_DQ_USER|XFS_DQ_PROJ|XFS_DQ_GROUP) -#define XFS_DQ_FLAGS \ - { XFS_DQ_USER, "USER" }, \ - { XFS_DQ_PROJ, "PROJ" }, \ - { XFS_DQ_GROUP, "GROUP" }, \ - { XFS_DQ_DIRTY, "DIRTY" }, \ - { XFS_DQ_FREEING, "FREEING" } - -/* -* We have the possibility of all three quota types being active at once, and -* hence free space modification requires modification of all three current -* dquots in a single transaction. For this case we need to have a reservation -* of at least 3 dquots. -* -* However, a chmod operation can change both UID and GID in a single -* transaction, resulting in requiring {old, new} x {uid, gid} dquots to be -* modified. Hence for this case we need to reserve space for at least 4 dquots. -* -* And in the worst case, there's a rename operation that can be modifying up to -* 4 inodes with dquots attached to them. In reality, the only inodes that can -* have their dquots modified are the source and destination directory inodes -* due to directory name creation and removal. That can require space allocation -* and/or freeing on both directory inodes, and hence all three dquots on each -* inode can be modified. And if the directories are world writeable, all the -* dquots can be unique and so 6 dquots can be modified.... -* -* And, of course, we also need to take into account the dquot log format item -* used to describe each dquot. -*/ -#define XFS_DQUOT_LOGRES (mp) \ - ((sizeof(struct xfs_dq_logformat) + sizeof(struct xfs_disk_dquot)) * 6) - -#define XFS_IS_QUOTA_RUNNING (mp) ((mp)->m_qflags & XFS_ALL_QUOTA_ACCT) -#define XFS_IS_UQUOTA_RUNNING (mp) ((mp)->m_qflags & XFS_UQUOTA_ACCT) -#define XFS_IS_PQUOTA_RUNNING (mp) ((mp)->m_qflags & XFS_PQUOTA_ACCT) -#define XFS_IS_GQUOTA_RUNNING (mp) ((mp)->m_qflags & XFS_GQUOTA_ACCT) -#define XFS_IS_UQUOTA_ENFORCED (mp) ((mp)->m_qflags & XFS_UQUOTA_ENFD) -#define XFS_IS_GQUOTA_ENFORCED (mp) ((mp)->m_qflags & XFS_GQUOTA_ENFD) -#define XFS_IS_PQUOTA_ENFORCED (mp) ((mp)->m_qflags & XFS_PQUOTA_ENFD) - -/* -* Incore only flags for quotaoff - these bits get cleared when quota(s) -* are in the process of getting turned off. These flags are in m_qflags but -* never in sb_qflags. -*/ -#define XFS_UQUOTA_ACTIVE 0x1000/* uquotas are being turned off */ -#define XFS_GQUOTA_ACTIVE 0x2000/* gquotas are being turned off */ -#define XFS_PQUOTA_ACTIVE 0x4000/* pquotas are being turned off */ -#define XFS_ALL_QUOTA_ACTIVE \ - (XFS_UQUOTA_ACTIVE | XFS_GQUOTA_ACTIVE | XFS_PQUOTA_ACTIVE) - -/* -* Checking XFS_IS_*QUOTA_ON() while holding any inode lock guarantees -* quota will be not be switched off as long as that inode lock is held. -*/ -#define XFS_IS_QUOTA_ON (mp) ((mp)->m_qflags & (XFS_UQUOTA_ACTIVE | \ - XFS_GQUOTA_ACTIVE | \ - XFS_PQUOTA_ACTIVE)) -#define XFS_IS_OQUOTA_ON (mp) ((mp)->m_qflags & (XFS_GQUOTA_ACTIVE | \ - XFS_PQUOTA_ACTIVE)) -#define XFS_IS_UQUOTA_ON (mp) ((mp)->m_qflags & XFS_UQUOTA_ACTIVE) -#define XFS_IS_GQUOTA_ON (mp) ((mp)->m_qflags & XFS_GQUOTA_ACTIVE) -#define XFS_IS_PQUOTA_ON (mp) ((mp)->m_qflags & XFS_PQUOTA_ACTIVE) - -/* -* Flags to tell various functions what to do. Not all of these are meaningful -* to a single function. None of these XFS_QMOPT_* flags are meant to have -* persistent values (ie. their values can and will change between versions) -*/ -#define XFS_QMOPT_DQALLOC 0x0000002/* alloc dquot ondisk if needed */ -#define XFS_QMOPT_UQUOTA 0x0000004/* user dquot requested */ -#define XFS_QMOPT_PQUOTA 0x0000008/* project dquot requested */ -#define XFS_QMOPT_FORCE_RES 0x0000010/* ignore quota limits */ -#define XFS_QMOPT_SBVERSION 0x0000040/* change superblock version num */ -#define XFS_QMOPT_DOWARN 0x0000400/* increase warning cnt if needed */ -#define XFS_QMOPT_DQREPAIR 0x0001000/* repair dquot if damaged */ -#define XFS_QMOPT_GQUOTA 0x0002000/* group dquot requested */ -#define XFS_QMOPT_ENOSPC 0x0004000/* enospc instead of edquot (prj) */ - -/* -* flags to xfs_trans_mod_dquot to indicate which field needs to be -* modified. -*/ -#define XFS_QMOPT_RES_REGBLKS 0x0010000 -#define XFS_QMOPT_RES_RTBLKS 0x0020000 -#define XFS_QMOPT_BCOUNT 0x0040000 -#define XFS_QMOPT_ICOUNT 0x0080000 -#define XFS_QMOPT_RTBCOUNT 0x0100000 -#define XFS_QMOPT_DELBCOUNT 0x0200000 -#define XFS_QMOPT_DELRTBCOUNT 0x0400000 -#define XFS_QMOPT_RES_INOS 0x0800000 - -/* -* flags for dqalloc. -*/ -#define XFS_QMOPT_INHERIT 0x1000000 - -/* -* flags to xfs_trans_mod_dquot. -*/ -#define XFS_TRANS_DQ_RES_BLKS XFS_QMOPT_RES_REGBLKS -#define XFS_TRANS_DQ_RES_RTBLKS XFS_QMOPT_RES_RTBLKS -#define XFS_TRANS_DQ_RES_INOS XFS_QMOPT_RES_INOS -#define XFS_TRANS_DQ_BCOUNT XFS_QMOPT_BCOUNT -#define XFS_TRANS_DQ_DELBCOUNT XFS_QMOPT_DELBCOUNT -#define XFS_TRANS_DQ_ICOUNT XFS_QMOPT_ICOUNT -#define XFS_TRANS_DQ_RTBCOUNT XFS_QMOPT_RTBCOUNT -#define XFS_TRANS_DQ_DELRTBCOUNT XFS_QMOPT_DELRTBCOUNT - - -#define XFS_QMOPT_QUOTALL \ - (XFS_QMOPT_UQUOTA | XFS_QMOPT_PQUOTA | XFS_QMOPT_GQUOTA) -#define XFS_QMOPT_RESBLK_MASK (XFS_QMOPT_RES_REGBLKS | XFS_QMOPT_RES_RTBLKS) +struct xfs_trans ; -#ifdef __KERNEL__/* * This check is done typically without holding the inode lock; * that may seem racy, but it is harmless in the context that it is used. @@ -289,5 +162,4 @@ extern int xfs_mount_reset_sbqflags(struct xfs_mount *);extern const struct xfs_buf_ops xfs_dquot_buf_ops; -#endif /* __KERNEL__ */ #endif /* __XFS_QUOTA_H__ */ fs/xfs/xfs_quota_defs.h new file +147
-0@@ -0,0 +1,157 @@ +/* +* 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_QUOTA_DEFS_H__ +#define __XFS_QUOTA_DEFS_H__ + +/* +* Quota definitions shared between user and kernel source trees. +*/ + +/* +* Even though users may not have quota limits occupying all 64-bits, +* they may need 64-bit accounting. Hence, 64-bit quota-counters, +* and quota-limits. This is a waste in the common case, but hey ... +*/ +typedef __uint64_t xfs_qcnt_t ; +typedef __uint16_t xfs_qwarncnt_t ; + +/* +* flags for q_flags field in the dquot. +*/ +#define XFS_DQ_USER 0x0001/* a user quota */ +#define XFS_DQ_PROJ 0x0002/* project quota */ +#define XFS_DQ_GROUP 0x0004/* a group quota */ +#define XFS_DQ_DIRTY 0x0008/* dquot is dirty */ +#define XFS_DQ_FREEING 0x0010/* dquot is beeing torn down */ + +#define XFS_DQ_ALLTYPES (XFS_DQ_USER|XFS_DQ_PROJ|XFS_DQ_GROUP) + +#define XFS_DQ_FLAGS \ + { XFS_DQ_USER, "USER" }, \ + { XFS_DQ_PROJ, "PROJ" }, \ + { XFS_DQ_GROUP, "GROUP" }, \ + { XFS_DQ_DIRTY, "DIRTY" }, \ + { XFS_DQ_FREEING, "FREEING" } + +/* +* We have the possibility of all three quota types being active at once, and +* hence free space modification requires modification of all three current +* dquots in a single transaction. For this case we need to have a reservation +* of at least 3 dquots. +* +* However, a chmod operation can change both UID and GID in a single +* transaction, resulting in requiring {old, new} x {uid, gid} dquots to be +* modified. Hence for this case we need to reserve space for at least 4 dquots. +* +* And in the worst case, there's a rename operation that can be modifying up to +* 4 inodes with dquots attached to them. In reality, the only inodes that can +* have their dquots modified are the source and destination directory inodes +* due to directory name creation and removal. That can require space allocation +* and/or freeing on both directory inodes, and hence all three dquots on each +* inode can be modified. And if the directories are world writeable, all the +* dquots can be unique and so 6 dquots can be modified.... +* +* And, of course, we also need to take into account the dquot log format item +* used to describe each dquot. +*/ +#define XFS_DQUOT_LOGRES (mp) \ + ((sizeof(struct xfs_dq_logformat) + sizeof(struct xfs_disk_dquot)) * 6) + +#define XFS_IS_QUOTA_RUNNING (mp) ((mp)->m_qflags & XFS_ALL_QUOTA_ACCT) +#define XFS_IS_UQUOTA_RUNNING (mp) ((mp)->m_qflags & XFS_UQUOTA_ACCT) +#define XFS_IS_PQUOTA_RUNNING (mp) ((mp)->m_qflags & XFS_PQUOTA_ACCT) +#define XFS_IS_GQUOTA_RUNNING (mp) ((mp)->m_qflags & XFS_GQUOTA_ACCT) +#define XFS_IS_UQUOTA_ENFORCED (mp) ((mp)->m_qflags & XFS_UQUOTA_ENFD) +#define XFS_IS_GQUOTA_ENFORCED (mp) ((mp)->m_qflags & XFS_GQUOTA_ENFD) +#define XFS_IS_PQUOTA_ENFORCED (mp) ((mp)->m_qflags & XFS_PQUOTA_ENFD) + +/* +* Incore only flags for quotaoff - these bits get cleared when quota(s) +* are in the process of getting turned off. These flags are in m_qflags but +* never in sb_qflags. +*/ +#define XFS_UQUOTA_ACTIVE 0x1000/* uquotas are being turned off */ +#define XFS_GQUOTA_ACTIVE 0x2000/* gquotas are being turned off */ +#define XFS_PQUOTA_ACTIVE 0x4000/* pquotas are being turned off */ +#define XFS_ALL_QUOTA_ACTIVE \ + (XFS_UQUOTA_ACTIVE | XFS_GQUOTA_ACTIVE | XFS_PQUOTA_ACTIVE) + +/* +* Checking XFS_IS_*QUOTA_ON() while holding any inode lock guarantees +* quota will be not be switched off as long as that inode lock is held. +*/ +#define XFS_IS_QUOTA_ON (mp) ((mp)->m_qflags & (XFS_UQUOTA_ACTIVE | \ + XFS_GQUOTA_ACTIVE | \ + XFS_PQUOTA_ACTIVE)) +#define XFS_IS_OQUOTA_ON (mp) ((mp)->m_qflags & (XFS_GQUOTA_ACTIVE | \ + XFS_PQUOTA_ACTIVE)) +#define XFS_IS_UQUOTA_ON (mp) ((mp)->m_qflags & XFS_UQUOTA_ACTIVE) +#define XFS_IS_GQUOTA_ON (mp) ((mp)->m_qflags & XFS_GQUOTA_ACTIVE) +#define XFS_IS_PQUOTA_ON (mp) ((mp)->m_qflags & XFS_PQUOTA_ACTIVE) + +/* +* Flags to tell various functions what to do. Not all of these are meaningful +* to a single function. None of these XFS_QMOPT_* flags are meant to have +* persistent values (ie. their values can and will change between versions) +*/ +#define XFS_QMOPT_DQALLOC 0x0000002/* alloc dquot ondisk if needed */ +#define XFS_QMOPT_UQUOTA 0x0000004/* user dquot requested */ +#define XFS_QMOPT_PQUOTA 0x0000008/* project dquot requested */ +#define XFS_QMOPT_FORCE_RES 0x0000010/* ignore quota limits */ +#define XFS_QMOPT_SBVERSION 0x0000040/* change superblock version num */ +#define XFS_QMOPT_DOWARN 0x0000400/* increase warning cnt if needed */ +#define XFS_QMOPT_DQREPAIR 0x0001000/* repair dquot if damaged */ +#define XFS_QMOPT_GQUOTA 0x0002000/* group dquot requested */ +#define XFS_QMOPT_ENOSPC 0x0004000/* enospc instead of edquot (prj) */ + +/* +* flags to xfs_trans_mod_dquot to indicate which field needs to be +* modified. +*/ +#define XFS_QMOPT_RES_REGBLKS 0x0010000 +#define XFS_QMOPT_RES_RTBLKS 0x0020000 +#define XFS_QMOPT_BCOUNT 0x0040000 +#define XFS_QMOPT_ICOUNT 0x0080000 +#define XFS_QMOPT_RTBCOUNT 0x0100000 +#define XFS_QMOPT_DELBCOUNT 0x0200000 +#define XFS_QMOPT_DELRTBCOUNT 0x0400000 +#define XFS_QMOPT_RES_INOS 0x0800000 + +/* +* flags for dqalloc. +*/ +#define XFS_QMOPT_INHERIT 0x1000000 + +/* +* flags to xfs_trans_mod_dquot. +*/ +#define XFS_TRANS_DQ_RES_BLKS XFS_QMOPT_RES_REGBLKS +#define XFS_TRANS_DQ_RES_RTBLKS XFS_QMOPT_RES_RTBLKS +#define XFS_TRANS_DQ_RES_INOS XFS_QMOPT_RES_INOS +#define XFS_TRANS_DQ_BCOUNT XFS_QMOPT_BCOUNT +#define XFS_TRANS_DQ_DELBCOUNT XFS_QMOPT_DELBCOUNT
fs/xfs/xfs_quota_defs.h line 157
Quoted 10 lines
fs/xfs/xfs_quota_defs.h new file +10
-0+#define XFS_TRANS_DQ_ICOUNT XFS_QMOPT_ICOUNT +#define XFS_TRANS_DQ_RTBCOUNT XFS_QMOPT_RTBCOUNT +#define XFS_TRANS_DQ_DELRTBCOUNT XFS_QMOPT_DELRTBCOUNT + + +#define XFS_QMOPT_QUOTALL \ + (XFS_QMOPT_UQUOTA | XFS_QMOPT_PQUOTA | XFS_QMOPT_GQUOTA) +#define XFS_QMOPT_RESBLK_MASK (XFS_QMOPT_RES_REGBLKS | XFS_QMOPT_RES_RTBLKS) + +#endif /* __XFS_QUOTA_H__ */
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 10/49 xfs: sync minor header differences needed by userspace.
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Little things like exported functions, __KERNEL__ protections, and so on that ensure user and kernel shared headers are identical.
--- fs/xfs/xfs_attr.c | 1 + fs/xfs/xfs_attr_leaf.c | 1 + fs/xfs/xfs_attr_leaf.h | 2 ++ fs/xfs/xfs_attr_remote.c | 1 + fs/xfs/xfs_bmap.h | 2 ++ fs/xfs/xfs_btree.h | 2 -- fs/xfs/xfs_dir2_format.h | 3 +++ fs/xfs/xfs_fs.h | 17 +++++++++++++++++ fs/xfs/xfs_sb.h | 7 +++++++ fs/xfs/xfs_symlink.h | 3 ++- fs/xfs/xfs_trans.h | 5 +---- fs/xfs/xfs_trans_priv.h | 3 +++ fs/xfs/xfs_types.h | 3 ++- 13 files changed, 42 insertions(+), 8 deletions(-)
fs/xfs/xfs_attr.c +1 -0
@@ -21,6 +21,7 @@#include "xfs_bit.h" #include "xfs_log.h" #include "xfs_trans.h" +#include "xfs_trans_priv.h" #include "xfs_sb.h" #include "xfs_ag.h" #include "xfs_mount.h"
fs/xfs/xfs_attr_leaf.c +1 -0
@@ -22,6 +22,7 @@#include "xfs_bit.h" #include "xfs_log.h" #include "xfs_trans.h" +#include "xfs_trans_priv.h" #include "xfs_sb.h" #include "xfs_ag.h" #include "xfs_mount.h"
fs/xfs/xfs_attr_leaf.h +2 -0
@@ -333,6 +333,8 @@ int xfs_attr3_leaf_read(struct xfs_trans *tp, struct xfs_inode *dp, struct xfs_buf **bpp);void xfs_attr3_leaf_hdr_from_disk (struct xfs_attr3_icleaf_hdr *to,struct xfs_attr_leafblock *from); +void xfs_attr3_leaf_hdr_to_disk (struct xfs_attr_leafblock *to, +struct xfs_attr3_icleaf_hdr *from);extern const struct xfs_buf_ops xfs_attr3_leaf_buf_ops;
fs/xfs/xfs_attr_remote.c +1 -0
@@ -22,6 +22,7 @@#include "xfs_bit.h" #include "xfs_log.h" #include "xfs_trans.h" +#include "xfs_trans_priv.h" #include "xfs_sb.h" #include "xfs_ag.h" #include "xfs_mount.h"
fs/xfs/xfs_bmap.h +2 -0
@@ -137,9 +137,11 @@ typedef struct xfs_bmalloca {char conv;/* overwriting unwritten extents */ char stack_switch;int flags; +#ifdef __KERNEL__struct completion *done;struct work_struct work;int result; +#endif /* __KERNEL__ */ } xfs_bmalloca_t;/*
fs/xfs/xfs_btree.h +0 -2
@@ -88,13 +88,11 @@ struct xfs_btree_block {#define XFS_BTREE_SBLOCK_CRC_LEN (XFS_BTREE_SBLOCK_LEN + 40)#define XFS_BTREE_LBLOCK_CRC_LEN (XFS_BTREE_LBLOCK_LEN + 48) -#define XFS_BTREE_SBLOCK_CRC_OFF \ offsetof(struct xfs_btree_block, bb_u.s.bb_crc)#define XFS_BTREE_LBLOCK_CRC_OFF \ offsetof(struct xfs_btree_block, bb_u.l.bb_crc) -/* * Generic key, ptr and record wrapper structures. *
fs/xfs/xfs_dir2_format.h +3 -0
@@ -519,6 +519,9 @@ struct xfs_dir3_leaf {#define XFS_DIR3_LEAF_CRC_OFF offsetof(struct xfs_dir3_leaf_hdr, info.crc) +extern void xfs_dir3_leaf_hdr_from_disk (struct xfs_dir3_icleaf_hdr *to, +struct xfs_dir2_leaf *from); +static inline int xfs_dir3_leaf_hdr_size (struct xfs_dir2_leaf *lp) {
fs/xfs/xfs_fs.h +17 -0
@@ -311,6 +311,17 @@ typedef struct xfs_bstat { } xfs_bstat_t;/* +* Project quota id helpers (previously projid was 16bit only +* and using two 16bit values to hold new 32bit projid was choosen +* to retain compatibility with "old" filesystems). +*/ +static inline __uint32_t +bstat_get_projid (struct xfs_bstat *bs) +{ +return (__uint32_t )bs->bs_projid_hi <<16 | bs->bs_projid_lo; +} + +/* * The user-level BulkStat Request interface structure. */ typedef struct xfs_fsop_bulkreq {
@@ -511,8 +522,14 @@ 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 */ +#ifndef FIFREEZE +#define XFS_IOC_FREEZE _IOWR('X', 119, int) +#define XFS_IOC_THAW _IOWR('X', 120, int) +#endif +#define XFS_IOC_FSSETDM_BY_HANDLE _IOW ('X', 121, struct xfs_fsop_setdm_handlereq)#define XFS_IOC_ATTRLIST_BY_HANDLE _IOW ('X', 122, struct xfs_fsop_attrlist_handlereq)#define XFS_IOC_ATTRMULTI_BY_HANDLE _IOW ('X', 123, struct xfs_fsop_attrmulti_handlereq)
fs/xfs/xfs_sb.h +7 -0
@@ -554,6 +554,13 @@ static inline int xfs_sb_version_hasprojid32bit(xfs_sb_t *sbp) (sbp->sb_features2 & XFS_SB_VERSION2_PROJID32BIT)); } +static inline void xfs_sb_version_addprojid32bit (xfs_sb_t *sbp) +{ + sbp->sb_versionnum |=XFS_SB_VERSION_MOREBITSBIT ; + sbp->sb_features2 |=XFS_SB_VERSION2_PROJID32BIT ; + sbp->sb_bad_features2 |=XFS_SB_VERSION2_PROJID32BIT ; +} +static inline int xfs_sb_version_hascrc (xfs_sb_t *sbp) {return XFS_SB_VERSION_NUM (sbp) ==XFS_SB_VERSION_5 ;
fs/xfs/xfs_symlink.h +2 -1
@@ -49,7 +49,8 @@ struct xfs_dsymlink_hdr { sizeof(struct xfs_dsymlink_hdr) : 0))int xfs_symlink_blocks (struct xfs_mount *mp,int pathlen); - +bool xfs_symlink_hdr_ok (struct xfs_mount *mp,xfs_ino_t ino,uint32_t offset, +uint32_t size,struct xfs_buf *bp);void xfs_symlink_local_to_remote (struct xfs_trans *tp,struct xfs_buf *bp,struct xfs_inode *ip,struct xfs_ifork *ifp);
fs/xfs/xfs_trans.h +1 -4
@@ -64,7 +64,7 @@ struct xfs_log_item;#define XFS_ADDAFORK_LOG_RES (mp) ((mp)->m_reservations.tr_addafork)#define XFS_ATTRINVAL_LOG_RES (mp) ((mp)->m_reservations.tr_attrinval)#define XFS_ATTRSETM_LOG_RES (mp) ((mp)->m_reservations.tr_attrsetm) -#define XFS_ATTRSETRT_LOG_RES (mp) ((mp)->m_reservations.tr_attrsetrt) +#define XFS_ATTRSETRT_LOG_RES (mp) ((mp)->m_reservations.tr_attrsetrt)#define XFS_ATTRRM_LOG_RES (mp) ((mp)->m_reservations.tr_attrrm)#define XFS_CLEAR_AGI_BUCKET_LOG_RES (mp) ((mp)->m_reservations.tr_clearagi)#define XFS_QM_SBCHANGE_LOG_RES (mp) ((mp)->m_reservations.tr_qm_sbchange)
@@ -325,7 +325,4 @@ extern kmem_zone_t *xfs_log_item_desc_zone;#endif /* __KERNEL__ */ -void xfs_trans_init (struct xfs_mount *); -int xfs_trans_roll (struct xfs_trans **,struct xfs_inode *); -#endif /* __XFS_TRANS_H__ */
fs/xfs/xfs_trans_priv.h +3 -0
@@ -25,6 +25,9 @@ struct xfs_trans;struct xfs_ail ;struct xfs_log_vec ; + +void xfs_trans_init (struct xfs_mount *); +int xfs_trans_roll (struct xfs_trans **,struct xfs_inode *);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 *tp, xfs_lsn_t commit_lsn,
fs/xfs/xfs_types.h +2 -1
@@ -32,7 +32,6 @@ typedef unsigned int __uint32_t;typedef signed long long int __int64_t ;typedef unsigned long long int __uint64_t ; -typedef __uint32_t prid_t ;/* project ID */ typedef __uint32_t inst_t ;/* an instruction */ typedef __s64 xfs_off_t ;/* <file offset> type */
@@ -55,6 +54,8 @@ typedef __uint64_t __psunsigned_t;#endif /* __KERNEL__ */ +typedef __uint32_t prid_t ;/* project ID */ +typedef __uint32_t xfs_agblock_t ;/* blockno in alloc. group */ typedef __uint32_t xfs_agino_t ;/* inode # within allocation grp */ typedef __uint32_t xfs_extlen_t ;/* extent length in blocks */
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 10/49] xfs: sync minor header differences needed by userspace.
Quoted 7 lines · Dave Chinner
From: Dave Chinner <[email protected]>
Little things like exported functions,
__KERNEL__protections, and so on that ensure user and kernel shared headers are identical.Signed-off-by Dave Chinner <[email protected]>---
...
fs/xfs/xfs_attr_leaf.h int xfs_attr3_leaf_read(struct xfs_trans *tp, struct xfs_inode *dp, · line 338
Quoted 11 lines
fs/xfs/xfs_attr_leaf.h +2
-0@@ -333,6 +333,8 @@ int xfs_attr3_leaf_read(struct xfs_trans *tp, struct xfs_inode *dp, struct xfs_buf **bpp);void xfs_attr3_leaf_hdr_from_disk (struct xfs_attr3_icleaf_hdr *to,struct xfs_attr_leafblock *from); +void xfs_attr3_leaf_hdr_to_disk (struct xfs_attr_leafblock *to, +struct xfs_attr3_icleaf_hdr *from);
I take it this was just missing.
Quoted 2 lines
fs/xfs/xfs_attr_leaf.h +0
-0extern const struct xfs_buf_ops xfs_attr3_leaf_buf_ops;
...
fs/xfs/xfs_dir2_format.h struct xfs_dir3_leaf { · line 524
Quoted 11 lines
fs/xfs/xfs_dir2_format.h +3
-0@@ -519,6 +519,9 @@ struct xfs_dir3_leaf {#define XFS_DIR3_LEAF_CRC_OFF offsetof(struct xfs_dir3_leaf_hdr, info.crc) +extern void xfs_dir3_leaf_hdr_from_disk (struct xfs_dir3_icleaf_hdr *to, +struct xfs_dir2_leaf *from); +
This appears in xfs_dir2_priv.h as well. It doesn't cause any compilation problems, but were you intending to duplicate it or move it?
Quoted 11 lines
fs/xfs/xfs_dir2_format.h +0
-0static inline int xfs_dir3_leaf_hdr_size (struct xfs_dir2_leaf *lp) {fs/xfs/xfs_fs.h +0
-0@@ -311,6 +311,17 @@ typedef struct xfs_bstat { } xfs_bstat_t;/*
fs/xfs/xfs_fs.h typedef struct xfs_bstat { · line 323
Quoted 10 lines
fs/xfs/xfs_fs.h +10
-0+* Project quota id helpers (previously projid was 16bit only +* and using two 16bit values to hold new 32bit projid was choosen +* to retain compatibility with "old" filesystems). +*/ +static inline __uint32_t +bstat_get_projid (struct xfs_bstat *bs) +{ +return (__uint32_t )bs->bs_projid_hi <<16 | bs->bs_projid_lo; +} +
Matches userspace.
Quoted 24 lines
fs/xfs/xfs_fs.h +7
-0+/* * The user-level BulkStat Request interface structure. */ typedef struct xfs_fsop_bulkreq {@@ -511,8 +522,14 @@ 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 */ +#ifndef FIFREEZE +#define XFS_IOC_FREEZE _IOWR('X', 119, int) +#define XFS_IOC_THAW _IOWR('X', 120, int) +#endif +#define XFS_IOC_FSSETDM_BY_HANDLE _IOW ('X', 121, struct xfs_fsop_setdm_handlereq)#define XFS_IOC_ATTRLIST_BY_HANDLE _IOW ('X', 122, struct xfs_fsop_attrlist_handlereq)#define XFS_IOC_ATTRMULTI_BY_HANDLE _IOW ('X', 123, struct xfs_fsop_attrmulti_handlereq)fs/xfs/xfs_sb.h +0
-0
fs/xfs/xfs_sb.h static inline int xfs_sb_version_hasprojid32bit(xfs_sb_t *sbp) · line 563
Quoted 10 lines
fs/xfs/xfs_sb.h +7
-0@@ -554,6 +554,13 @@ static inline int xfs_sb_version_hasprojid32bit(xfs_sb_t *sbp) (sbp->sb_features2 & XFS_SB_VERSION2_PROJID32BIT)); } +static inline void xfs_sb_version_addprojid32bit (xfs_sb_t *sbp) +{ + sbp->sb_versionnum |=XFS_SB_VERSION_MOREBITSBIT ; + sbp->sb_features2 |=XFS_SB_VERSION2_PROJID32BIT ; + sbp->sb_bad_features2 |=XFS_SB_VERSION2_PROJID32BIT ; +} +
Matches userspace.
Quoted 66 lines
fs/xfs/xfs_sb.h +0
-0static inline int xfs_sb_version_hascrc (xfs_sb_t *sbp) {return XFS_SB_VERSION_NUM (sbp) ==XFS_SB_VERSION_5 ;fs/xfs/xfs_symlink.h +2
-1@@ -49,7 +49,8 @@ struct xfs_dsymlink_hdr { sizeof(struct xfs_dsymlink_hdr) : 0))int xfs_symlink_blocks (struct xfs_mount *mp,int pathlen); - +bool xfs_symlink_hdr_ok (struct xfs_mount *mp,xfs_ino_t ino,uint32_t offset, +uint32_t size,struct xfs_buf *bp);void xfs_symlink_local_to_remote (struct xfs_trans *tp,struct xfs_buf *bp,struct xfs_inode *ip,struct xfs_ifork *ifp);fs/xfs/xfs_trans.h +1
-4@@ -64,7 +64,7 @@ struct xfs_log_item;#define XFS_ADDAFORK_LOG_RES (mp) ((mp)->m_reservations.tr_addafork)#define XFS_ATTRINVAL_LOG_RES (mp) ((mp)->m_reservations.tr_attrinval)#define XFS_ATTRSETM_LOG_RES (mp) ((mp)->m_reservations.tr_attrsetm) -#define XFS_ATTRSETRT_LOG_RES (mp) ((mp)->m_reservations.tr_attrsetrt) +#define XFS_ATTRSETRT_LOG_RES (mp) ((mp)->m_reservations.tr_attrsetrt)#define XFS_ATTRRM_LOG_RES (mp) ((mp)->m_reservations.tr_attrrm)#define XFS_CLEAR_AGI_BUCKET_LOG_RES (mp) ((mp)->m_reservations.tr_clearagi)#define XFS_QM_SBCHANGE_LOG_RES (mp) ((mp)->m_reservations.tr_qm_sbchange)@@ -325,7 +325,4 @@ extern kmem_zone_t *xfs_log_item_desc_zone;#endif /* __KERNEL__ */ -void xfs_trans_init (struct xfs_mount *); -int xfs_trans_roll (struct xfs_trans **,struct xfs_inode *); -#endif /* __XFS_TRANS_H__ */ fs/xfs/xfs_trans_priv.h +3
-0@@ -25,6 +25,9 @@ struct xfs_trans;struct xfs_ail ;struct xfs_log_vec ; + +void xfs_trans_init (struct xfs_mount *); +int xfs_trans_roll (struct xfs_trans **,struct xfs_inode *);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 *tp, xfs_lsn_t commit_lsn,fs/xfs/xfs_types.h +0
-1@@ -32,7 +32,6 @@ typedef unsigned int __uint32_t;typedef signed long long int __int64_t ;typedef unsigned long long int __uint64_t ; -typedef __uint32_t prid_t ;/* project ID */ typedef __uint32_t inst_t ;/* an instruction */ typedef __s64 xfs_off_t ;/* <file offset> type */
fs/xfs/xfs_types.h typedef __uint64_t __psunsigned_t; · line 61
Quoted 8 lines
fs/xfs/xfs_types.h +2
-0@@ -55,6 +54,8 @@ typedef __uint64_t __psunsigned_t;#endif /* __KERNEL__ */ +typedef __uint32_t prid_t ;/* project ID */ +typedef __uint32_t xfs_agblock_t ;/* blockno in alloc. group */ typedef __uint32_t xfs_agino_t ;/* inode # within allocation grp */ typedef __uint32_t xfs_extlen_t ;/* extent length in blocks */
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 11/49 xfs: split out transaction reservation code
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The transaction reservation size calculations is used by both kernel and userspace, but most of the transaction code in xfs_trans.c is kernel specific. Split all the transaction reservation code out into it's own files to make sharing with userspace simpler. This just leaves kernel-only definitions in xfs_trans.h, so it doesn't need to be shared with userspace anymore, either.
--- fs/xfs/Makefile | 3 +- fs/xfs/xfs_acl.c | 1 + fs/xfs/xfs_buf.c | 1 + fs/xfs/xfs_discard.c | 4 +- fs/xfs/xfs_mount.h | 42 +-- fs/xfs/xfs_quotaops.c | 3 +- fs/xfs/xfs_trans.c | 654 +------------------------------------------- fs/xfs/xfs_trans.h | 77 +----- fs/xfs/xfs_trans_resv.c | 701 ++++++++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_trans_resv.h | 137 ++++++++++ 10 files changed, 851 insertions(+), 772 deletions(-) create mode 100644 fs/xfs/xfs_trans_resv.c create mode 100644 fs/xfs/xfs_trans_resv.h
fs/xfs/Makefile +2 -1
@@ -47,6 +47,7 @@ xfs-y += xfs_aops.o \ xfs_mru_cache.o \ xfs_rename.o \ xfs_super.o \ + xfs_trans.o \ xfs_utils.o \ xfs_vnodeops.o \ xfs_xattr.o \
@@ -76,7 +77,7 @@ xfs-y += xfs_alloc.o \ xfs_log_recover.o \ xfs_mount.o \ xfs_symlink.o \ - xfs_trans.o + xfs_trans_resv.o # low-level transaction/log code xfs-y += xfs_log.o \
fs/xfs/xfs_acl.c +1 -0
@@ -17,6 +17,7 @@*/ #include "xfs.h" #include "xfs_log_format.h" +#include "xfs_trans_resv.h" #include "xfs_acl.h" #include "xfs_attr.h" #include "xfs_bmap_btree.h"
fs/xfs/xfs_buf.c +1 -0
@@ -35,6 +35,7 @@#include <linux/freezer.h> #include "xfs_sb.h" +#include "xfs_trans_resv.h" #include "xfs_log.h" #include "xfs_ag.h" #include "xfs_mount.h"
fs/xfs/xfs_discard.c +2 -2
@@ -17,12 +17,12 @@*/ #include "xfs.h" #include "xfs_format.h" -#include "xfs_sb.h" #include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_sb.h" #include "xfs_ag.h" #include "xfs_mount.h" #include "xfs_quota.h" -#include "xfs_trans.h" #include "xfs_alloc_btree.h" #include "xfs_bmap_btree.h" #include "xfs_ialloc_btree.h"
fs/xfs/xfs_mount.h +2 -40
54 lines not on this page · raw message
fs/xfs/xfs_quotaops.c +2 -1
@@ -17,8 +17,9 @@*/ #include "xfs.h" #include "xfs_format.h" -#include "xfs_sb.h" +#include "xfs_trans_resv.h" #include "xfs_log.h" +#include "xfs_sb.h" #include "xfs_ag.h" #include "xfs_mount.h" #include "xfs_quota.h"
fs/xfs/xfs_trans.c +1 -653
666 lines not on this page · raw message
fs/xfs/xfs_trans.h +2 -75
88 lines not on this page · raw message
fs/xfs/xfs_trans_resv.c new file +701 -0
701 lines not on this page · raw message
fs/xfs/xfs_trans_resv.h new file +137 -0
137 lines not on this page · raw message
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 11/49] xfs: split out transaction reservation code
Quoted 25 lines · Dave Chinner
From: Dave Chinner <[email protected]>
The transaction reservation size calculations is used by both kernel and userspace, but most of the transaction code in
xfs_trans.cis kernel specific. Split all the transaction reservation code out into it's own files to make sharing with userspace simpler. This just leaves kernel-only definitions inxfs_trans.h, so it doesn't need to be shared with userspace anymore, either.Signed-off-by Dave Chinner <[email protected]>--- fs/xfs/Makefile | 3 +- fs/xfs/xfs_acl.c | 1 + fs/xfs/xfs_buf.c | 1 + fs/xfs/xfs_discard.c | 4 +- fs/xfs/xfs_mount.h | 42 +-- fs/xfs/xfs_quotaops.c | 3 +- fs/xfs/xfs_trans.c | 654 +------------------------------------------- fs/xfs/xfs_trans.h | 77 +----- fs/xfs/xfs_trans_resv.c | 701 ++++++++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_trans_resv.h | 137 ++++++++++ 10 files changed, 851 insertions(+), 772 deletions(-) create mode 100644 fs/xfs/xfs_trans_resv.c create mode 100644 fs/xfs/xfs_trans_resv.h
...
Quoted 7 lines
fs/xfs/xfs_trans.c +0
-0@@ -49,629 +49,6 @@ kmem_zone_t *xfs_trans_zone;kmem_zone_t *xfs_log_item_desc_zone;
...
Quoted 31 lines
fs/xfs/xfs_trans.c +0
-24-/* * Initialize the precomputed transaction reservation values * in the mount structure. */ @@ -679,36 +56,7 @@ voidxfs_trans_init ( struct xfs_mount *mp) { -struct xfs_trans_reservations *resp = &mp->m_reservations; - - resp->tr_write =xfs_calc_write_reservation (mp); - resp->tr_itruncate =xfs_calc_itruncate_reservation (mp); - resp->tr_rename =xfs_calc_rename_reservation (mp); - resp->tr_link =xfs_calc_link_reservation (mp); - resp->tr_remove =xfs_calc_remove_reservation (mp); - resp->tr_symlink =xfs_calc_symlink_reservation (mp); - resp->tr_create =xfs_calc_create_reservation (mp); - resp->tr_mkdir =xfs_calc_mkdir_reservation (mp); - resp->tr_ifree =xfs_calc_ifree_reservation (mp); - resp->tr_ichange =xfs_calc_ichange_reservation (mp); - resp->tr_growdata =xfs_calc_growdata_reservation (mp); - resp->tr_swrite =xfs_calc_swrite_reservation (mp); - resp->tr_writeid =xfs_calc_writeid_reservation (mp); - resp->tr_addafork =xfs_calc_addafork_reservation (mp); - resp->tr_attrinval =xfs_calc_attrinval_reservation (mp); - resp->tr_attrsetm =xfs_calc_attrsetm_reservation (mp); - resp->tr_attrsetrt =xfs_calc_attrsetrt_reservation (mp); - resp->tr_attrrm =xfs_calc_attrrm_reservation (mp); - resp->tr_clearagi =xfs_calc_clear_agi_bucket_reservation (mp); - resp->tr_growrtalloc =xfs_calc_growrtalloc_reservation (mp); - resp->tr_growrtzero =xfs_calc_growrtzero_reservation (mp);
fs/xfs/xfs_trans.c void · line 61
Quoted 10 lines
fs/xfs/xfs_trans.c +1
-7- resp->tr_growrtfree =xfs_calc_growrtfree_reservation (mp); - resp->tr_qm_sbchange =xfs_calc_qm_sbchange_reservation (mp); - resp->tr_qm_setqlim =xfs_calc_qm_setqlim_reservation (mp); - resp->tr_qm_dqalloc =xfs_calc_qm_dqalloc_reservation (mp); - resp->tr_qm_quotaoff =xfs_calc_qm_quotaoff_reservation (mp); - resp->tr_qm_equotaoff =xfs_calc_qm_quotaoff_end_reservation (mp); - resp->tr_sb =xfs_calc_sb_reservation (mp); +xfs_trans_resv_calc (mp, &mp->m_reservations); }
Reservation calculations pushed off into a helper, otherwise a clean move.
Quoted 2 lines
fs/xfs/xfs_trans.c +0
-0/* fs/xfs/xfs_trans.h +0
-0
...
Quoted 1 line
fs/xfs/xfs_trans_resv.c +0
-0
...
Quoted 52 lines
fs/xfs/xfs_trans_resv.h new file +46
-0@@ -0,0 +1,137 @@ +/* +* Copyright (c) 2000-2002,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_TRANS_RESV_H__ +#define __XFS_TRANS_RESV_H__ + +struct xfs_mount; + +/* + * structure for maintaining pre-calculated transaction reservations. + */ +struct xfs_trans_resv { + uint tr_write; /* extent alloc trans */ + uint tr_itruncate; /* truncate trans */ + uint tr_rename; /* rename trans */ + uint tr_link; /* link trans */ + uint tr_remove; /* unlink trans */ + uint tr_symlink; /* symlink trans */ + uint tr_create; /* create trans */ + uint tr_mkdir; /* mkdir trans */ + uint tr_ifree; /* inode free trans */ + uint tr_ichange; /* inode update trans */ + uint tr_growdata; /* fs data section grow trans */ + uint tr_swrite; /* sync write inode trans */ + uint tr_addafork; /* cvt inode to attributed trans */ + uint tr_writeid; /* write setuid/setgid file */ + uint tr_attrinval; /* attr fork buffer invalidation */ + uint tr_attrsetm; /* set/create an attribute at mount time */ + uint tr_attrsetrt; /* set/create an attribute at runtime */ + uint tr_attrrm; /* remove an attribute */ + uint tr_clearagi; /* clear bad agi unlinked ino bucket */ + uint tr_growrtalloc; /* grow realtime allocations */
fs/xfs/xfs_trans_resv.h line 56
Quoted 10 lines
fs/xfs/xfs_trans_resv.h new file +10
-0+uint tr_growrtzero;/* grow realtime zeroing */ +uint tr_growrtfree;/* grow realtime freeing */ +uint tr_qm_sbchange;/* change quota flags */ +uint tr_qm_setqlim;/* adjust quota limits */ +uint tr_qm_dqalloc;/* allocate quota on disk */ +uint tr_qm_quotaoff;/* turn quota off */ +uint tr_qm_equotaoff;/* end of turn quota off */ +uint tr_sb;/* modify superblock */ +}; +
Structure name change, matches otherwise.
Quoted 15 lines
fs/xfs/xfs_trans_resv.h new file +15
-0+/* +* Per-extent log reservation for the allocation btree changes +* involved in freeing or allocating an extent. +* 2 trees * (2 blocks/level * max depth - 1) * block size +*/ +#define XFS_ALLOCFREE_LOG_RES (mp,nx) \ + ((nx) * (2 * XFS_FSB_TO_B((mp), 2 * XFS_AG_MAXLEVELS(mp) - 1))) +#define XFS_ALLOCFREE_LOG_COUNT (mp,nx) \ + ((nx) * (2 * (2 * XFS_AG_MAXLEVELS(mp) - 1))) + +/* +* Per-directory log reservation for any directory change. +* dir blocks: (1 btree block per level + data block + free block) * dblock size +* bmap btree: (levels + 2) * max depth * block size +* v2 directory blocks can be fragmented below the dirblksize down to the fsb
fs/xfs/xfs_trans_resv.h line 81
Quoted 10 lines
fs/xfs/xfs_trans_resv.h new file +10
-0+* size, so account for that in the DAENTER macros. +*/ +#define XFS_DIROP_LOG_RES (mp) \ + (XFS_FSB_TO_B(mp, XFS_DAENTER_BLOCKS(mp, XFS_DATA_FORK)) + \ + (XFS_FSB_TO_B(mp, XFS_DAENTER_BMAPS(mp, XFS_DATA_FORK) + 1))) +#define XFS_DIROP_LOG_COUNT (mp) \ + (XFS_DAENTER_BLOCKS(mp, XFS_DATA_FORK) + \ + XFS_DAENTER_BMAPS(mp, XFS_DATA_FORK) + 1) + +
The XFS_*_LOG_RES() macros don't appear to be used anywhere..?
And other than some whitespace fixups, everything else seems to match:
Quoted 47 lines
fs/xfs/xfs_trans_resv.h new file +46
-0+#define XFS_WRITE_LOG_RES (mp) ((mp)->m_reservations.tr_write) +#define XFS_ITRUNCATE_LOG_RES (mp) ((mp)->m_reservations.tr_itruncate) +#define XFS_RENAME_LOG_RES (mp) ((mp)->m_reservations.tr_rename) +#define XFS_LINK_LOG_RES (mp) ((mp)->m_reservations.tr_link) +#define XFS_REMOVE_LOG_RES (mp) ((mp)->m_reservations.tr_remove) +#define XFS_SYMLINK_LOG_RES (mp) ((mp)->m_reservations.tr_symlink) +#define XFS_CREATE_LOG_RES (mp) ((mp)->m_reservations.tr_create) +#define XFS_MKDIR_LOG_RES (mp) ((mp)->m_reservations.tr_mkdir) +#define XFS_IFREE_LOG_RES (mp) ((mp)->m_reservations.tr_ifree) +#define XFS_ICHANGE_LOG_RES (mp) ((mp)->m_reservations.tr_ichange) +#define XFS_GROWDATA_LOG_RES (mp) ((mp)->m_reservations.tr_growdata) +#define XFS_GROWRTALLOC_LOG_RES (mp) ((mp)->m_reservations.tr_growrtalloc) +#define XFS_GROWRTZERO_LOG_RES (mp) ((mp)->m_reservations.tr_growrtzero) +#define XFS_GROWRTFREE_LOG_RES (mp) ((mp)->m_reservations.tr_growrtfree) +#define XFS_SWRITE_LOG_RES (mp) ((mp)->m_reservations.tr_swrite) +/* +* Logging the inode timestamps on an fsync -- same as SWRITE +* as long as SWRITE logs the entire inode core +*/ +#define XFS_FSYNC_TS_LOG_RES (mp) ((mp)->m_reservations.tr_swrite) +#define XFS_WRITEID_LOG_RES (mp) ((mp)->m_reservations.tr_swrite) +#define XFS_ADDAFORK_LOG_RES (mp) ((mp)->m_reservations.tr_addafork) +#define XFS_ATTRINVAL_LOG_RES (mp) ((mp)->m_reservations.tr_attrinval) +#define XFS_ATTRSETM_LOG_RES (mp) ((mp)->m_reservations.tr_attrsetm) +#define XFS_ATTRSETRT_LOG_RES (mp) ((mp)->m_reservations.tr_attrsetrt) +#define XFS_ATTRRM_LOG_RES (mp) ((mp)->m_reservations.tr_attrrm) +#define XFS_CLEAR_AGI_BUCKET_LOG_RES (mp) ((mp)->m_reservations.tr_clearagi) +#define XFS_QM_SBCHANGE_LOG_RES (mp) ((mp)->m_reservations.tr_qm_sbchange) +#define XFS_QM_SETQLIM_LOG_RES (mp) ((mp)->m_reservations.tr_qm_setqlim) +#define XFS_QM_DQALLOC_LOG_RES (mp) ((mp)->m_reservations.tr_qm_dqalloc) +#define XFS_QM_QUOTAOFF_LOG_RES (mp) ((mp)->m_reservations.tr_qm_quotaoff) +#define XFS_QM_QUOTAOFF_END_LOG_RES (mp) ((mp)->m_reservations.tr_qm_equotaoff) +#define XFS_SB_LOG_RES (mp) ((mp)->m_reservations.tr_sb) + +/* +* Various log count values. +*/ +#define XFS_DEFAULT_LOG_COUNT 1 +#define XFS_DEFAULT_PERM_LOG_COUNT 2 +#define XFS_ITRUNCATE_LOG_COUNT 2 +#define XFS_INACTIVE_LOG_COUNT 2 +#define XFS_CREATE_LOG_COUNT 2 +#define XFS_MKDIR_LOG_COUNT 3 +#define XFS_SYMLINK_LOG_COUNT 3 +#define XFS_REMOVE_LOG_COUNT 2 +#define XFS_LINK_LOG_COUNT 2
fs/xfs/xfs_trans_resv.h line 137
Quoted 10 lines
fs/xfs/xfs_trans_resv.h new file +10
-0+#define XFS_RENAME_LOG_COUNT 2 +#define XFS_WRITE_LOG_COUNT 2 +#define XFS_ADDAFORK_LOG_COUNT 2 +#define XFS_ATTRINVAL_LOG_COUNT 1 +#define XFS_ATTRSET_LOG_COUNT 3 +#define XFS_ATTRRM_LOG_COUNT 3 + +void xfs_trans_resv_calc (struct xfs_mount *mp,struct xfs_trans_resv *resp); + +#endif /* __XFS_TRANS_RESV_H__ */
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 12/49 xfs: move inode fork definitions to a new header file
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The inode fork definitions are a combination of on-disk format definition and in-memory tracking and manipulation. They are both shared with userspace, so move them all into their own file so sharing is easy to do and track. This removes all inode fork related information from xfs_inode.h.
Do the same for the all the C code that currently resides in xfs_inode.c for the same reason.
--- fs/xfs/Makefile | 1 + fs/xfs/xfs_inode.c | 1940 +---------------------------------------------- fs/xfs/xfs_inode.h | 134 +--- fs/xfs/xfs_inode_fork.c | 1921 ++++++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_inode_fork.h | 171 +++++ 5 files changed, 2128 insertions(+), 2039 deletions(-) create mode 100644 fs/xfs/xfs_inode_fork.c create mode 100644 fs/xfs/xfs_inode_fork.h
fs/xfs/Makefile +1 -0
@@ -74,6 +74,7 @@ xfs-y += xfs_alloc.o \ xfs_ialloc_btree.o \ xfs_icreate_item.o \ xfs_inode.o \ + xfs_inode_fork.o \ xfs_log_recover.o \ xfs_mount.o \ xfs_symlink.o \
fs/xfs/xfs_inode.c +34 -1906
2,007 lines not on this page · raw message
fs/xfs/xfs_inode.h +1 -133
158 lines not on this page · raw message
fs/xfs/xfs_inode_fork.c new file +1921 -0
828 lines not on this page · raw message
fs/xfs/xfs_inode_fork.h new file +171 -0
171 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 6 lines
1.8.3.2 _______________________________________________ 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 12/49] xfs: move inode fork definitions to a new header file
Quoted 8 lines · Dave Chinner
From: Dave Chinner<[email protected]>
The inode fork definitions are a combination of on-disk format definition and in-memory tracking and manipulation. They are both shared with userspace, so move them all into their own file so sharing is easy to do and track. This removes all inode fork related information from
xfs_inode.h.
Quoted 5 lines
Do the same for the all the C code that currently resides in
xfs_inode.cfor the same reason.Signed-off-by Dave Chinner<[email protected]>---
summary:
Mostly a move of routines/structures from xfs_inode.c/h to xfs_inode_fork.c/h.
xfs_validate_extents() is no longer a STATIC, as expected.
xfs_iformat() is renamed xfs_iformat_fork().
function declarations in xfs_inode_fork.h have the typedef converted to structs.
Looks good.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 13/49 xfs: move unrealted definitions out of xfs_inode.h
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
--- fs/xfs/xfs_ialloc.c | 1 + fs/xfs/xfs_icache.h | 7 +++++++ fs/xfs/xfs_inode.h | 38 -------------------------------------- fs/xfs/xfs_log_format.h | 8 ++++++++ 4 files changed, 16 insertions(+), 38 deletions(-)
fs/xfs/xfs_ialloc.c +1 -0
@@ -39,6 +39,7 @@#include "xfs_cksum.h" #include "xfs_buf_item.h" #include "xfs_icreate_item.h" +#include "xfs_icache.h" /*
fs/xfs/xfs_icache.h +7 -0
@@ -24,6 +24,13 @@ struct xfs_perag;#define SYNC_WAIT 0x0001/* wait for i/o to complete */ #define SYNC_TRYLOCK 0x0002/* only try to lock inodes */ +/* +* Flags for xfs_iget() +*/ +#define XFS_IGET_CREATE 0x1 +#define XFS_IGET_UNTRUSTED 0x2 +#define XFS_IGET_DONTCACHE 0x4 +int xfs_iget (struct xfs_mount *mp,struct xfs_trans *tp,xfs_ino_t ino,uint flags,uint lock_flags,xfs_inode_t **ipp);
fs/xfs/xfs_inode.h +0 -38
@@ -34,37 +34,6 @@ struct xfs_imap {ushort im_boffset;/* inode offset in block in bytes */ }; -/* -* This is the xfs in-core inode structure. -* Most of the on-disk inode is embedded in the i_d field. -* -* The extent pointers/inline file space, however, are managed -* separately. The memory for this information is pointed to by -* the if_u1 unions depending on the type of the data. -* This is used to linearize the array of extents for fast in-core -* access. This is used until the file's number of extents -* surpasses XFS_MAX_INCORE_EXTENTS, at which point all extent pointers -* are accessed through the buffer cache. -* -* Other state kept in the in-core inode is used for identification, -* locking, transactional updating, etc of the inode. -* -* Generally, we do not want to hold the i_rlock while holding the -* i_ilock. Hierarchy is i_iolock followed by i_rlock. -* -* xfs_iptr_t contains all the inode fields up to and including the -* i_mnext and i_mprev fields, it is used as a marker in the inode -* chain off the mount structure by xfs_sync calls. -*/ - -/* -* Flags for xfs_ichgtime(). -*/ -#define XFS_ICHGTIME_MOD 0x1/* data fork modification timestamp */ -#define XFS_ICHGTIME_CHG 0x2/* inode field change timestamp */ -#define XFS_ICHGTIME_CREATE 0x4/* inode create timestamp */ - -#ifdef __KERNEL__struct xfs_buf ;
@@ -400,13 +369,6 @@ do { \#endif /* __KERNEL__ */ -/* -* Flags for xfs_iget() -*/ -#define XFS_IGET_CREATE 0x1 -#define XFS_IGET_UNTRUSTED 0x2 -#define XFS_IGET_DONTCACHE 0x4 -int xfs_imap_to_bp (struct xfs_mount *,struct xfs_trans *,struct xfs_imap *,struct xfs_dinode **,struct xfs_buf **,uint ,uint );
fs/xfs/xfs_log_format.h +8 -0
@@ -393,6 +393,14 @@ struct xfs_log_item_desc {#define XFS_DQUOT_REF 1/* +* Flags for xfs_trans_ichgtime(). +*/ +#define XFS_ICHGTIME_MOD 0x1/* data fork modification timestamp */ +#define XFS_ICHGTIME_CHG 0x2/* inode field change timestamp */ +#define XFS_ICHGTIME_CREATE 0x4/* inode create timestamp */ + + +/* * Inode Log Item Format definitions. * * This is the structure used to lay out an inode log item in the
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 13/49] xfs: move unrealted definitions out of xfs_inode.h
Quoted 10 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Signed-off-by Dave Chinner<[email protected]>--- fs/xfs/xfs_ialloc.c | 1 + fs/xfs/xfs_icache.h | 7 +++++++ fs/xfs/xfs_inode.h | 38 -------------------------------------- fs/xfs/xfs_log_format.h | 8 ++++++++ 4 files changed, 16 insertions(+), 38 deletions(-)
Looks good.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 14/49 xfs: introduce xfs_inode_buf.c for inode buffer operations
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The only thing remaining in xfs_inode.[ch] are the operations that read, write or verify physical inodes in their underlying buffers. Move all this code to xfs_inode_buf.[ch] and so we can stop sharing xfs_inode.[ch] with userspace.
--- fs/xfs/Makefile | 1 + fs/xfs/xfs_inode.c | 413 --------------------------------------------- fs/xfs/xfs_inode.h | 41 +---- fs/xfs/xfs_inode_buf.c | 444 +++++++++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_inode_buf.h | 53 ++++++ 5 files changed, 505 insertions(+), 447 deletions(-) create mode 100644 fs/xfs/xfs_inode_buf.c create mode 100644 fs/xfs/xfs_inode_buf.h
fs/xfs/Makefile +1 -0
@@ -75,6 +75,7 @@ xfs-y += xfs_alloc.o \ xfs_icreate_item.o \ xfs_inode.o \ xfs_inode_fork.o \ + xfs_inode_buf.o \ xfs_log_recover.o \ xfs_mount.o \ xfs_symlink.o \
fs/xfs/xfs_inode.c +0 -413
425 lines not on this page · raw message
fs/xfs/xfs_inode.h +7 -34
65 lines not on this page · raw message
fs/xfs/xfs_inode_buf.c new file +444 -0
444 lines not on this page · raw message
fs/xfs/xfs_inode_buf.h new file +53 -0
53 lines not on this page · raw message
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 14/49] xfs: introduce xfs_inode_buf.c for inode buffer operations
Quoted 9 lines · Dave Chinner
From: Dave Chinner<[email protected]>
The only thing remaining in xfs_inode.[ch] are the operations that read, write or verify physical inodes in their underlying buffers. Move all this code to xfs_inode_buf.[ch] and so we can stop sharing xfs_inode.[ch] with userspace.
Signed-off-by Dave Chinner<[email protected]>---
Bug patches committed in the last couple days make this patch no longer current.
--Mark.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 14/49] xfs: introduce xfs_inode_buf.c for inode buffer operations
Quoted 8 lines · Mark Tinguely
Quoted 7 lines · Dave Chinner
From: Dave Chinner<[email protected]>
The only thing remaining in xfs_inode.[ch] are the operations that read, write or verify physical inodes in their underlying buffers. Move all this code to xfs_inode_buf.[ch] and so we can stop sharing xfs_inode.[ch] with userspace.
Quoted 5 lines
Quoted 2 lines
Signed-off-by Dave Chinner<[email protected]>---
Bug patches committed in the last couple days make this patch no longer current.
Right, which is why I've had to rebase it (yet again). The changes are minor, though, and shouldn't prevent review of this version of the patch.
I haven't reposted the new series yet, because I'm waiting on reviews for the current series to be done and I don't want to have to continually rebase and repost the series. There is a risk that every time I do a rebase that I screw something up, so I want to minimise the number of rebases I have to do.
This is yet another reason why I'd like to see this code reviewed quickly and committed because I've already rebased it several times and it's not fun. Repeated rebasing simply because review of slow is a waste of everyone's time...
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 14/49] xfs: introduce xfs_inode_buf.c for inode buffer operations
In reply to Dave ChinnerQuoted 9 lines · Dave Chinner
From: Dave Chinner <[email protected]>
The only thing remaining in xfs_inode.[ch] are the operations that read, write or verify physical inodes in their underlying buffers. Move all this code to xfs_inode_buf.[ch] and so we can stop sharing xfs_inode.[ch] with userspace.
Signed-off-by Dave Chinner <[email protected]>---
I noticed Mark mentioned something about this being stale. That aside, I see some whitespace fixups and a clean move otherwise:
Quoted 1,024 lines
fs/xfs/Makefile | 1 + fs/xfs/xfs_inode.c | 413 --------------------------------------------- fs/xfs/xfs_inode.h | 41 +---- fs/xfs/xfs_inode_buf.c | 444 +++++++++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_inode_buf.h | 53 ++++++ 5 files changed, 505 insertions(+), 447 deletions(-) create mode 100644 fs/xfs/xfs_inode_buf.c create mode 100644 fs/xfs/xfs_inode_buf.hfs/xfs/Makefile +1
-0@@ -75,6 +75,7 @@ xfs-y += xfs_alloc.o \ xfs_icreate_item.o \ xfs_inode.o \ xfs_inode_fork.o \ + xfs_inode_buf.o \ xfs_log_recover.o \ xfs_mount.o \ xfs_symlink.o \fs/xfs/xfs_inode.c +0
-413@@ -322,234 +322,6 @@ __xfs_iflock(finish_wait (wq, &wait.wait); } -/* -* Check that none of the inode's in the buffer have a next -* unlinked field of 0. -*/ -#if defined(DEBUG ) -void -xfs_inobp_check ( -xfs_mount_t *mp, -xfs_buf_t *bp) -{ -int i; -int j; -xfs_dinode_t *dip; - - j = mp->m_inode_cluster_size >> mp->m_sb.sb_inodelog; - -for (i =0 ; i < j; i++) { - dip = (xfs_dinode_t *)xfs_buf_offset (bp, - i * mp->m_sb.sb_inodesize); -if (!dip->di_next_unlinked) { -xfs_alert (mp, -"Detected bogus zero next_unlinked field in incore inode buffer 0x%p." , - bp); -ASSERT (dip->di_next_unlinked); - } - } -} -#endif - -static void -xfs_inode_buf_verify ( -struct xfs_buf *bp) -{ -struct xfs_mount *mp = bp->b_target->bt_mount; -int i; -int ni; - -/* -* Validate the magic number and version of every inode in the buffer -*/ - ni =XFS_BB_TO_FSB (mp, bp->b_length) * mp->m_sb.sb_inopblock; -for (i =0 ; i < ni; i++) { -int di_ok; -xfs_dinode_t *dip; - - dip = (struct xfs_dinode *)xfs_buf_offset (bp, - (i << mp->m_sb.sb_inodelog)); - di_ok = dip->di_magic ==cpu_to_be16 (XFS_DINODE_MAGIC ) && -XFS_DINODE_GOOD_VERSION (dip->di_version); -if (unlikely (XFS_TEST_ERROR (!di_ok, mp, -XFS_ERRTAG_ITOBP_INOTOBP , -XFS_RANDOM_ITOBP_INOTOBP ))) { -xfs_buf_ioerror (bp,EFSCORRUPTED ); -XFS_CORRUPTION_ERROR (__func__,XFS_ERRLEVEL_HIGH , - mp, dip); -#ifdef DEBUG -xfs_emerg (mp, -"bad inode magic/vsn daddr %lld #%d (magic=%x)" , - (unsigned long long )bp->b_bn, i, -be16_to_cpu (dip->di_magic)); -ASSERT (0 ); -#endif - } - } -xfs_inobp_check (mp, bp); -} - - -static void -xfs_inode_buf_read_verify ( -struct xfs_buf *bp) -{ -xfs_inode_buf_verify (bp); -} - -static void -xfs_inode_buf_write_verify ( -struct xfs_buf *bp) -{ -xfs_inode_buf_verify (bp); -} - -const struct xfs_buf_ops xfs_inode_buf_ops = { - .verify_read = xfs_inode_buf_read_verify, - .verify_write = xfs_inode_buf_write_verify, -}; - - -/* -* This routine is called to map an inode to the buffer containing the on-disk -* version of the inode. It returns a pointer to the buffer containing the -* on-disk inode in the bpp parameter, and in the dipp parameter it returns a -* pointer to the on-disk inode within that buffer. -* -* If a non-zero error is returned, then the contents of bpp and dipp are -* undefined. -*/ -int -xfs_imap_to_bp ( -struct xfs_mount *mp, -struct xfs_trans *tp, -struct xfs_imap *imap, -struct xfs_dinode **dipp, -struct xfs_buf **bpp, -uint buf_flags, -uint iget_flags) -{ -struct xfs_buf *bp; -int error; - - buf_flags |=XBF_UNMAPPED ; - error =xfs_trans_read_buf (mp, tp, mp->m_ddev_targp, imap->im_blkno, - (int )imap->im_len, buf_flags, &bp, - &xfs_inode_buf_ops); -if (error) { -if (error ==EAGAIN ) { -ASSERT (buf_flags &XBF_TRYLOCK ); -return error; - } - -if (error ==EFSCORRUPTED && - (iget_flags &XFS_IGET_UNTRUSTED )) -return XFS_ERROR (EINVAL ); - -xfs_warn (mp,"%s: xfs_trans_read_buf() returned error %d." , - __func__, error); -return error; - } - - *bpp = bp; - *dipp = (struct xfs_dinode *)xfs_buf_offset (bp, imap->im_boffset); -return 0 ; -} - -STATIC void -xfs_dinode_from_disk ( -xfs_icdinode_t *to, -xfs_dinode_t *from) -{ - to->di_magic =be16_to_cpu (from->di_magic); - to->di_mode =be16_to_cpu (from->di_mode); - to->di_version = from ->di_version; - to->di_format = from->di_format; - to->di_onlink =be16_to_cpu (from->di_onlink); - to->di_uid =be32_to_cpu (from->di_uid); - to->di_gid =be32_to_cpu (from->di_gid); - to->di_nlink =be32_to_cpu (from->di_nlink); - to->di_projid_lo =be16_to_cpu (from->di_projid_lo); - to->di_projid_hi =be16_to_cpu (from->di_projid_hi); -memcpy (to->di_pad, from->di_pad,sizeof (to->di_pad)); - to->di_flushiter =be16_to_cpu (from->di_flushiter); - to->di_atime.t_sec =be32_to_cpu (from->di_atime.t_sec); - to->di_atime.t_nsec =be32_to_cpu (from->di_atime.t_nsec); - to->di_mtime.t_sec =be32_to_cpu (from->di_mtime.t_sec); - to->di_mtime.t_nsec =be32_to_cpu (from->di_mtime.t_nsec); - to->di_ctime.t_sec =be32_to_cpu (from->di_ctime.t_sec); - to->di_ctime.t_nsec =be32_to_cpu (from->di_ctime.t_nsec); - to->di_size =be64_to_cpu (from->di_size); - to->di_nblocks =be64_to_cpu (from->di_nblocks); - to->di_extsize =be32_to_cpu (from->di_extsize); - to->di_nextents =be32_to_cpu (from->di_nextents); - to->di_anextents =be16_to_cpu (from->di_anextents); - to->di_forkoff = from->di_forkoff; - to->di_aformat = from->di_aformat; - to->di_dmevmask =be32_to_cpu (from->di_dmevmask); - to->di_dmstate =be16_to_cpu (from->di_dmstate); - to->di_flags =be16_to_cpu (from->di_flags); - to->di_gen =be32_to_cpu (from->di_gen); - -if (to->di_version ==3 ) { - to->di_changecount =be64_to_cpu (from->di_changecount); - to->di_crtime.t_sec =be32_to_cpu (from->di_crtime.t_sec); - to->di_crtime.t_nsec =be32_to_cpu (from->di_crtime.t_nsec); - to->di_flags2 =be64_to_cpu (from->di_flags2); - to->di_ino =be64_to_cpu (from->di_ino); - to->di_lsn =be64_to_cpu (from->di_lsn); -memcpy (to->di_pad2, from->di_pad2,sizeof (to->di_pad2)); -uuid_copy (&to->di_uuid, &from->di_uuid); - } -} - -void -xfs_dinode_to_disk ( -xfs_dinode_t *to, -xfs_icdinode_t *from) -{ - to->di_magic =cpu_to_be16 (from->di_magic); - to->di_mode =cpu_to_be16 (from->di_mode); - to->di_version = from ->di_version; - to->di_format = from->di_format; - to->di_onlink =cpu_to_be16 (from->di_onlink); - to->di_uid =cpu_to_be32 (from->di_uid); - to->di_gid =cpu_to_be32 (from->di_gid); - to->di_nlink =cpu_to_be32 (from->di_nlink); - to->di_projid_lo =cpu_to_be16 (from->di_projid_lo); - to->di_projid_hi =cpu_to_be16 (from->di_projid_hi); -memcpy (to->di_pad, from->di_pad,sizeof (to->di_pad)); - to->di_flushiter =cpu_to_be16 (from->di_flushiter); - to->di_atime.t_sec =cpu_to_be32 (from->di_atime.t_sec); - to->di_atime.t_nsec =cpu_to_be32 (from->di_atime.t_nsec); - to->di_mtime.t_sec =cpu_to_be32 (from->di_mtime.t_sec); - to->di_mtime.t_nsec =cpu_to_be32 (from->di_mtime.t_nsec); - to->di_ctime.t_sec =cpu_to_be32 (from->di_ctime.t_sec); - to->di_ctime.t_nsec =cpu_to_be32 (from->di_ctime.t_nsec); - to->di_size =cpu_to_be64 (from->di_size); - to->di_nblocks =cpu_to_be64 (from->di_nblocks); - to->di_extsize =cpu_to_be32 (from->di_extsize); - to->di_nextents =cpu_to_be32 (from->di_nextents); - to->di_anextents =cpu_to_be16 (from->di_anextents); - to->di_forkoff = from->di_forkoff; - to->di_aformat = from->di_aformat; - to->di_dmevmask =cpu_to_be32 (from->di_dmevmask); - to->di_dmstate =cpu_to_be16 (from->di_dmstate); - to->di_flags =cpu_to_be16 (from->di_flags); - to->di_gen =cpu_to_be32 (from->di_gen); - -if (from->di_version ==3 ) { - to->di_changecount =cpu_to_be64 (from->di_changecount); - to->di_crtime.t_sec =cpu_to_be32 (from->di_crtime.t_sec); - to->di_crtime.t_nsec =cpu_to_be32 (from->di_crtime.t_nsec); - to->di_flags2 =cpu_to_be64 (from->di_flags2); - to->di_ino =cpu_to_be64 (from->di_ino); - to->di_lsn =cpu_to_be64 (from->di_lsn); -memcpy (to->di_pad2, from->di_pad2,sizeof (to->di_pad2)); -uuid_copy (&to->di_uuid, &from->di_uuid); - } -} - STATIC uint_xfs_dic2xflags (__uint16_t di_flags)@@ -608,191 +380,6 @@ xfs_dic2xflags( (XFS_DFORK_Q (dip) ?XFS_XFLAG_HASATTR :0 ); } -static bool -xfs_dinode_verify ( -struct xfs_mount *mp, -struct xfs_inode *ip, -struct xfs_dinode *dip) -{ -if (dip->di_magic !=cpu_to_be16 (XFS_DINODE_MAGIC )) -return false; - -/* only version 3 or greater inodes are extensively verified here */ -if (dip->di_version <3 ) -return true; - -if (!xfs_sb_version_hascrc (&mp->m_sb)) -return false; -if (!xfs_verify_cksum ((char *)dip, mp->m_sb.sb_inodesize, - offsetof(struct xfs_dinode , di_crc))) -return false; -if (be64_to_cpu (dip->di_ino) != ip->i_ino) -return false; -if (!uuid_equal (&dip->di_uuid, &mp->m_sb.sb_uuid)) -return false; -return true; -} - -void -xfs_dinode_calc_crc ( -struct xfs_mount *mp, -struct xfs_dinode *dip) -{ -__uint32_t crc; - -if (dip->di_version <3 ) -return ; - -ASSERT (xfs_sb_version_hascrc (&mp->m_sb)); - crc =xfs_start_cksum ((char *)dip, mp->m_sb.sb_inodesize, - offsetof(struct xfs_dinode , di_crc)); - dip->di_crc =xfs_end_cksum (crc); -} - -/* -* Read the disk inode attributes into the in-core inode structure. -* -* If we are initialising a new inode and we are not utilising the -* XFS_MOUNT_IKEEP inode cluster mode, we can simple build the new inode core -* with a random generation number. If we are keeping inodes around, we need to -* read the inode cluster to get the existing generation number off disk. -*/ -int -xfs_iread ( -xfs_mount_t *mp, -xfs_trans_t *tp, -xfs_inode_t *ip, -uint iget_flags) -{ -xfs_buf_t *bp; -xfs_dinode_t *dip; -int error; - -/* -* Fill in the location information in the in-core inode. -*/ - error =xfs_imap (mp, tp, ip->i_ino, &ip->i_imap, iget_flags); -if (error) -return error; - -/* shortcut IO on inode allocation if possible */ -if ((iget_flags &XFS_IGET_CREATE ) && - !(mp->m_flags &XFS_MOUNT_IKEEP )) { -/* initialise the on-disk inode core */ -memset (&ip->i_d,0 ,sizeof (ip->i_d)); - ip->i_d.di_magic =XFS_DINODE_MAGIC ; - ip->i_d.di_gen =prandom_u32 (); -if (xfs_sb_version_hascrc (&mp->m_sb)) { - ip->i_d.di_version =3 ; - ip->i_d.di_ino = ip->i_ino; -uuid_copy (&ip->i_d.di_uuid, &mp->m_sb.sb_uuid); - }else - ip->i_d.di_version =2 ; -return 0 ; - } - -/* -* Get pointers to the on-disk inode and the buffer containing it. -*/ - error =xfs_imap_to_bp (mp, tp, &ip->i_imap, &dip, &bp,0 , iget_flags); -if (error) -return error; - -/* even unallocated inodes are verified */ -if (!xfs_dinode_verify (mp, ip, dip)) { -xfs_alert (mp,"%s: validation failed for inode %lld failed" , - __func__, ip->i_ino); - -XFS_CORRUPTION_ERROR (__func__,XFS_ERRLEVEL_LOW , mp, dip); - error =XFS_ERROR (EFSCORRUPTED ); - goto out_brelse; - } - -/* -* If the on-disk inode is already linked to a directory -* entry, copy all of the inode into the in-core inode. -* xfs_iformat_fork() handles copying in the inode format -* specific information. -* Otherwise, just get the truly permanent information. -*/ -if (dip->di_mode) { -xfs_dinode_from_disk (&ip->i_d, dip); - error =xfs_iformat_fork (ip, dip); -if (error) { -#ifdef DEBUG -xfs_alert (mp,"%s: xfs_iformat() returned error %d" , - __func__, error); -#endif /* DEBUG */ - goto out_brelse; - } - }else { -/* -* Partial initialisation of the in-core inode. Just the bits -* that xfs_ialloc won't overwrite or relies on being correct. -*/ - ip->i_d.di_magic =be16_to_cpu (dip->di_magic); - ip->i_d.di_version = dip->di_version; - ip->i_d.di_gen =be32_to_cpu (dip->di_gen); - ip->i_d.di_flushiter =be16_to_cpu (dip->di_flushiter); - -if (dip->di_version ==3 ) { - ip->i_d.di_ino =be64_to_cpu (dip->di_ino); -uuid_copy (&ip->i_d.di_uuid, &dip->di_uuid); - } - -/* -* Make sure to pull in the mode here as well in -* case the inode is released without being used. -* This ensures that xfs_inactive() will see that -* the inode is already free and not try to mess -* with the uninitialized part of it. -*/ - ip->i_d.di_mode =0 ; - } - -/* -* The inode format changed when we moved the link count and -* made it 32 bits long. If this is an old format inode, -* convert it in memory to look like a new one. If it gets -* flushed to disk we will convert back before flushing or -* logging it. We zero out the new projid field and the old link -* count field. We'll handle clearing the pad field (the remains -* of the old uuid field) when we actually convert the inode to -* the new format. We don't change the version number so that we -* can distinguish this from a real new format inode. -*/ -if (ip->i_d.di_version ==1 ) { - ip->i_d.di_nlink = ip->i_d.di_onlink; - ip->i_d.di_onlink =0 ; -xfs_set_projid (ip,0 ); - } - - ip->i_delayed_blks =0 ; - -/* -* Mark the buffer containing the inode as something to keep -* around for a while. This helps to keep recently accessed -* meta-data in-core longer. -*/ -xfs_buf_set_ref (bp,XFS_INO_REF ); - -/* -* Use xfs_trans_brelse() to release the buffer containing the on-disk -* inode, because it was acquired with xfs_trans_read_buf() in -* xfs_imap_to_bp() above. If tp is NULL, this is just a normal -* brelse(). If we're within a transaction, then xfs_trans_brelse() -* will only release the buffer if it is not dirty within the -* transaction. It will be OK to release the buffer in this case, -* because inodes on disk are never destroyed and we will be locking the -* new in-core inode before putting it in the cache where other -* processes can find it. Thus we don't have to worry about the inode -* being changed just because we released the buffer. -*/ - out_brelse: -xfs_trans_brelse (tp, bp); -return error; -} -/* * Allocate an inode on disk and return a copy of its in-core version. * The in-core inode is locked exclusively. Set mode, nlink, and rdev fs/xfs/xfs_inode.h +7
-34@@ -18,24 +18,15 @@#ifndef __XFS_INODE_H__#define __XFS_INODE_H__ -struct posix_acl ; -struct xfs_dinode ; -struct xfs_inode ; - +#include "xfs_inode_buf.h" #include "xfs_inode_fork.h" /* -* Inode location information. Stored in the inode and passed to -* xfs_imap_to_bp() to get a buffer and dinode for a given inode. +* Kernel only inode definitions */ -struct xfs_imap { -xfs_daddr_t im_blkno;/* starting BB of inode chunk */ -ushort im_len;/* length in BBs of inode chunk */ -ushort im_boffset;/* inode offset in block in bytes */ -}; - -#ifdef __KERNEL__ +struct xfs_dinode ; +struct xfs_inode ;struct xfs_buf ;struct xfs_bmap_free ;struct xfs_bmbt_irec ;@@ -347,7 +338,10 @@ int xfs_itruncate_extents(struct xfs_trans **, struct xfs_inode *,int xfs_iunlink (struct xfs_trans *,xfs_inode_t *);void xfs_iext_realloc (xfs_inode_t *,int ,int ); +void xfs_iunpin_wait (xfs_inode_t *); +#define xfs_ipincount (ip) ((unsigned int) atomic_read(&ip->i_pincount)) +int xfs_iflush (struct xfs_inode *,struct xfs_buf **);void xfs_lock_inodes (xfs_inode_t **,int ,uint );void xfs_lock_two_inodes (xfs_inode_t *,xfs_inode_t *,uint );@@ -367,27 +361,6 @@ do { \iput (VFS_I (ip)); \ } while (0) -#endif /* __KERNEL__ */ - -int xfs_imap_to_bp (struct xfs_mount *,struct xfs_trans *, -struct xfs_imap *,struct xfs_dinode **, -struct xfs_buf **,uint ,uint ); -int xfs_iread (struct xfs_mount *,struct xfs_trans *, -struct xfs_inode *,uint ); -void xfs_dinode_calc_crc (struct xfs_mount *,struct xfs_dinode *); -void xfs_dinode_to_disk (struct xfs_dinode *, -struct xfs_icdinode *); -bool xfs_can_free_eofblocks (struct xfs_inode *,bool ); - -#define xfs_ipincount (ip) ((unsigned int) atomic_read(&ip->i_pincount)) - -#if defined(DEBUG ) -void xfs_inobp_check (struct xfs_mount *,struct xfs_buf *); -#else -#define xfs_inobp_check (mp, bp) -#endif /* DEBUG */ - extern struct kmem_zone *xfs_inode_zone; -extern const struct xfs_buf_ops xfs_inode_buf_ops;#endif /* __XFS_INODE_H__ */ fs/xfs/xfs_inode_buf.c new file +444
-0@@ -0,0 +1,444 @@ +/* +* Copyright (c) 2000-2006 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 +*/ +#include "xfs.h" +#include "xfs_fs.h" +#include "xfs_format.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_ag.h" +#include "xfs_mount.h" +#include "xfs_bmap_btree.h" +#include "xfs_ialloc_btree.h" +#include "xfs_dinode.h" +#include "xfs_inode.h" +#include "xfs_error.h" +#include "xfs_cksum.h" +#include "xfs_icache.h" +#include "xfs_ialloc.h" + +/* +* Check that none of the inode's in the buffer have a next +* unlinked field of 0. +*/ +#if defined(DEBUG ) +void +xfs_inobp_check ( +xfs_mount_t *mp, +xfs_buf_t *bp) +{ +int i; +int j; +xfs_dinode_t *dip; + + j = mp->m_inode_cluster_size >> mp->m_sb.sb_inodelog; + +for (i =0 ; i < j; i++) { + dip = (xfs_dinode_t *)xfs_buf_offset (bp, + i * mp->m_sb.sb_inodesize); +if (!dip->di_next_unlinked) { +xfs_alert (mp, +"Detected bogus zero next_unlinked field in incore inode buffer 0x%p." , + bp); +ASSERT (dip->di_next_unlinked); + } + } +} +#endif + +static void +xfs_inode_buf_verify ( +struct xfs_buf *bp) +{ +struct xfs_mount *mp = bp->b_target->bt_mount; +int i; +int ni; + +/* +* Validate the magic number and version of every inode in the buffer +*/ + ni =XFS_BB_TO_FSB (mp, bp->b_length) * mp->m_sb.sb_inopblock; +for (i =0 ; i < ni; i++) { +int di_ok; +xfs_dinode_t *dip; + + dip = (struct xfs_dinode *)xfs_buf_offset (bp, + (i << mp->m_sb.sb_inodelog)); + di_ok = dip->di_magic ==cpu_to_be16 (XFS_DINODE_MAGIC ) && +XFS_DINODE_GOOD_VERSION (dip->di_version); +if (unlikely (XFS_TEST_ERROR (!di_ok, mp, +XFS_ERRTAG_ITOBP_INOTOBP , +XFS_RANDOM_ITOBP_INOTOBP ))) { +xfs_buf_ioerror (bp,EFSCORRUPTED ); +XFS_CORRUPTION_ERROR (__func__,XFS_ERRLEVEL_HIGH , + mp, dip); +#ifdef DEBUG +xfs_emerg (mp, +"bad inode magic/vsn daddr %lld #%d (magic=%x)" , + (unsigned long long )bp->b_bn, i, +be16_to_cpu (dip->di_magic)); +ASSERT (0 ); +#endif + } + } +xfs_inobp_check (mp, bp); +} + +static void +xfs_inode_buf_read_verify ( +struct xfs_buf *bp) +{ +xfs_inode_buf_verify (bp); +} + +static void +xfs_inode_buf_write_verify ( +struct xfs_buf *bp) +{ +xfs_inode_buf_verify (bp); +} + +const struct xfs_buf_ops xfs_inode_buf_ops = { + .verify_read = xfs_inode_buf_read_verify, + .verify_write = xfs_inode_buf_write_verify, +}; + +/* +* This routine is called to map an inode to the buffer containing the on-disk +* version of the inode. It returns a pointer to the buffer containing the +* on-disk inode in the bpp parameter, and in the dipp parameter it returns a +* pointer to the on-disk inode within that buffer. +* +* If a non-zero error is returned, then the contents of bpp and dipp are +* undefined. +*/ +int +xfs_imap_to_bp ( +struct xfs_mount *mp, +struct xfs_trans *tp, +struct xfs_imap *imap, +struct xfs_dinode **dipp, +struct xfs_buf **bpp, +uint buf_flags, +uint iget_flags) +{ +struct xfs_buf *bp; +int error; + + buf_flags |=XBF_UNMAPPED ; + error =xfs_trans_read_buf (mp, tp, mp->m_ddev_targp, imap->im_blkno, + (int )imap->im_len, buf_flags, &bp, + &xfs_inode_buf_ops); +if (error) { +if (error ==EAGAIN ) { +ASSERT (buf_flags &XBF_TRYLOCK ); +return error; + } + +if (error ==EFSCORRUPTED && + (iget_flags &XFS_IGET_UNTRUSTED )) +return XFS_ERROR (EINVAL ); + +xfs_warn (mp,"%s: xfs_trans_read_buf() returned error %d." , + __func__, error); +return error; + } + + *bpp = bp; + *dipp = (struct xfs_dinode *)xfs_buf_offset (bp, imap->im_boffset); +return 0 ; +} + +STATIC void +xfs_dinode_from_disk ( +xfs_icdinode_t *to, +xfs_dinode_t *from) +{ + to->di_magic =be16_to_cpu (from->di_magic); + to->di_mode =be16_to_cpu (from->di_mode); + to->di_version = from ->di_version; + to->di_format = from->di_format; + to->di_onlink =be16_to_cpu (from->di_onlink); + to->di_uid =be32_to_cpu (from->di_uid); + to->di_gid =be32_to_cpu (from->di_gid); + to->di_nlink =be32_to_cpu (from->di_nlink); + to->di_projid_lo =be16_to_cpu (from->di_projid_lo); + to->di_projid_hi =be16_to_cpu (from->di_projid_hi); +memcpy (to->di_pad, from->di_pad,sizeof (to->di_pad)); + to->di_flushiter =be16_to_cpu (from->di_flushiter); + to->di_atime.t_sec =be32_to_cpu (from->di_atime.t_sec); + to->di_atime.t_nsec =be32_to_cpu (from->di_atime.t_nsec); + to->di_mtime.t_sec =be32_to_cpu (from->di_mtime.t_sec); + to->di_mtime.t_nsec =be32_to_cpu (from->di_mtime.t_nsec); + to->di_ctime.t_sec =be32_to_cpu (from->di_ctime.t_sec); + to->di_ctime.t_nsec =be32_to_cpu (from->di_ctime.t_nsec); + to->di_size =be64_to_cpu (from->di_size); + to->di_nblocks =be64_to_cpu (from->di_nblocks); + to->di_extsize =be32_to_cpu (from->di_extsize); + to->di_nextents =be32_to_cpu (from->di_nextents); + to->di_anextents =be16_to_cpu (from->di_anextents); + to->di_forkoff = from->di_forkoff; + to->di_aformat = from->di_aformat; + to->di_dmevmask =be32_to_cpu (from->di_dmevmask); + to->di_dmstate =be16_to_cpu (from->di_dmstate); + to->di_flags =be16_to_cpu (from->di_flags); + to->di_gen =be32_to_cpu (from->di_gen); + +if (to->di_version ==3 ) { + to->di_changecount =be64_to_cpu (from->di_changecount); + to->di_crtime.t_sec =be32_to_cpu (from->di_crtime.t_sec); + to->di_crtime.t_nsec =be32_to_cpu (from->di_crtime.t_nsec); + to->di_flags2 =be64_to_cpu (from->di_flags2); + to->di_ino =be64_to_cpu (from->di_ino); + to->di_lsn =be64_to_cpu (from->di_lsn); +memcpy (to->di_pad2, from->di_pad2,sizeof (to->di_pad2)); +uuid_copy (&to->di_uuid, &from->di_uuid); + } +} + +void +xfs_dinode_to_disk ( +xfs_dinode_t *to, +xfs_icdinode_t *from) +{ + to->di_magic =cpu_to_be16 (from->di_magic); + to->di_mode =cpu_to_be16 (from->di_mode); + to->di_version = from ->di_version; + to->di_format = from->di_format; + to->di_onlink =cpu_to_be16 (from->di_onlink); + to->di_uid =cpu_to_be32 (from->di_uid); + to->di_gid =cpu_to_be32 (from->di_gid); + to->di_nlink =cpu_to_be32 (from->di_nlink); + to->di_projid_lo =cpu_to_be16 (from->di_projid_lo); + to->di_projid_hi =cpu_to_be16 (from->di_projid_hi); +memcpy (to->di_pad, from->di_pad,sizeof (to->di_pad)); + to->di_flushiter =cpu_to_be16 (from->di_flushiter); + to->di_atime.t_sec =cpu_to_be32 (from->di_atime.t_sec); + to->di_atime.t_nsec =cpu_to_be32 (from->di_atime.t_nsec); + to->di_mtime.t_sec =cpu_to_be32 (from->di_mtime.t_sec); + to->di_mtime.t_nsec =cpu_to_be32 (from->di_mtime.t_nsec); + to->di_ctime.t_sec =cpu_to_be32 (from->di_ctime.t_sec); + to->di_ctime.t_nsec =cpu_to_be32 (from->di_ctime.t_nsec); + to->di_size =cpu_to_be64 (from->di_size); + to->di_nblocks =cpu_to_be64 (from->di_nblocks); + to->di_extsize =cpu_to_be32 (from->di_extsize); + to->di_nextents =cpu_to_be32 (from->di_nextents); + to->di_anextents =cpu_to_be16 (from->di_anextents); + to->di_forkoff = from->di_forkoff; + to->di_aformat = from->di_aformat; + to->di_dmevmask =cpu_to_be32 (from->di_dmevmask); + to->di_dmstate =cpu_to_be16 (from->di_dmstate); + to->di_flags =cpu_to_be16 (from->di_flags); + to->di_gen =cpu_to_be32 (from->di_gen); + +if (from->di_version ==3 ) { + to->di_changecount =cpu_to_be64 (from->di_changecount); + to->di_crtime.t_sec =cpu_to_be32 (from->di_crtime.t_sec); + to->di_crtime.t_nsec =cpu_to_be32 (from->di_crtime.t_nsec); + to->di_flags2 =cpu_to_be64 (from->di_flags2); + to->di_ino =cpu_to_be64 (from->di_ino); + to->di_lsn =cpu_to_be64 (from->di_lsn); +memcpy (to->di_pad2, from->di_pad2,sizeof (to->di_pad2)); +uuid_copy (&to->di_uuid, &from->di_uuid); + } +} + +static bool +xfs_dinode_verify ( +struct xfs_mount *mp, +struct xfs_inode *ip, +struct xfs_dinode *dip) +{ +if (dip->di_magic !=cpu_to_be16 (XFS_DINODE_MAGIC )) +return false; + +/* only version 3 or greater inodes are extensively verified here */ +if (dip->di_version <3 ) +return true; + +if (!xfs_sb_version_hascrc (&mp->m_sb)) +return false; +if (!xfs_verify_cksum ((char *)dip, mp->m_sb.sb_inodesize, + offsetof(struct xfs_dinode , di_crc))) +return false; +if (be64_to_cpu (dip->di_ino) != ip->i_ino) +return false; +if (!uuid_equal (&dip->di_uuid, &mp->m_sb.sb_uuid)) +return false; +return true; +} + +void +xfs_dinode_calc_crc ( +struct xfs_mount *mp, +struct xfs_dinode *dip) +{ +__uint32_t crc; + +if (dip->di_version <3 ) +return ; + +ASSERT (xfs_sb_version_hascrc (&mp->m_sb)); + crc =xfs_start_cksum ((char *)dip, mp->m_sb.sb_inodesize, + offsetof(struct xfs_dinode , di_crc)); + dip->di_crc =xfs_end_cksum (crc); +} + +/* +* Read the disk inode attributes into the in-core inode structure. +* +* If we are initialising a new inode and we are not utilising the +* XFS_MOUNT_IKEEP inode cluster mode, we can simple build the new inode core +* with a random generation number. If we are keeping inodes around, we need to +* read the inode cluster to get the existing generation number off disk. +*/ +int +xfs_iread ( +xfs_mount_t *mp, +xfs_trans_t *tp, +xfs_inode_t *ip, +uint iget_flags) +{ +xfs_buf_t *bp; +xfs_dinode_t *dip; +int error; + +/* +* Fill in the location information in the in-core inode. +*/ + error =xfs_imap (mp, tp, ip->i_ino, &ip->i_imap, iget_flags); +if (error) +return error; + +/* shortcut IO on inode allocation if possible */ +if ((iget_flags &XFS_IGET_CREATE ) && + !(mp->m_flags &XFS_MOUNT_IKEEP )) { +/* initialise the on-disk inode core */ +memset (&ip->i_d,0 ,sizeof (ip->i_d)); + ip->i_d.di_magic =XFS_DINODE_MAGIC ; + ip->i_d.di_gen =prandom_u32 (); +if (xfs_sb_version_hascrc (&mp->m_sb)) { + ip->i_d.di_version =3 ; + ip->i_d.di_ino = ip->i_ino; +uuid_copy (&ip->i_d.di_uuid, &mp->m_sb.sb_uuid); + }else + ip->i_d.di_version =2 ; +return 0 ; + } + +/* +* Get pointers to the on-disk inode and the buffer containing it. +*/ + error =xfs_imap_to_bp (mp, tp, &ip->i_imap, &dip, &bp,0 , iget_flags); +if (error) +return error; + +/* even unallocated inodes are verified */ +if (!xfs_dinode_verify (mp, ip, dip)) { +xfs_alert (mp,"%s: validation failed for inode %lld failed" , + __func__, ip->i_ino); + +XFS_CORRUPTION_ERROR (__func__,XFS_ERRLEVEL_LOW , mp, dip); + error =XFS_ERROR (EFSCORRUPTED ); + goto out_brelse; + } + +/* +* If the on-disk inode is already linked to a directory +* entry, copy all of the inode into the in-core inode. +* xfs_iformat_fork() handles copying in the inode format +* specific information. +* Otherwise, just get the truly permanent information. +*/ +if (dip->di_mode) { +xfs_dinode_from_disk (&ip->i_d, dip); + error =xfs_iformat_fork (ip, dip); +if (error) { +#ifdef DEBUG +xfs_alert (mp,"%s: xfs_iformat() returned error %d" , + __func__, error); +#endif /* DEBUG */ + goto out_brelse; + } + }else { +/* +* Partial initialisation of the in-core inode. Just the bits +* that xfs_ialloc won't overwrite or relies on being correct. +*/ + ip->i_d.di_magic =be16_to_cpu (dip->di_magic); + ip->i_d.di_version = dip->di_version; + ip->i_d.di_gen =be32_to_cpu (dip->di_gen); + ip->i_d.di_flushiter =be16_to_cpu (dip->di_flushiter); + +if (dip->di_version ==3 ) { + ip->i_d.di_ino =be64_to_cpu (dip->di_ino); +uuid_copy (&ip->i_d.di_uuid, &dip->di_uuid); + } + +/* +* Make sure to pull in the mode here as well in +* case the inode is released without being used. +* This ensures that xfs_inactive() will see that +* the inode is already free and not try to mess +* with the uninitialized part of it. +*/ + ip->i_d.di_mode =0 ; + } + +/* +* The inode format changed when we moved the link count and +* made it 32 bits long. If this is an old format inode, +* convert it in memory to look like a new one. If it gets +* flushed to disk we will convert back before flushing or +* logging it. We zero out the new projid field and the old link +* count field. We'll handle clearing the pad field (the remains +* of the old uuid field) when we actually convert the inode to +* the new format. We don't change the version number so that we +* can distinguish this from a real new format inode. +*/ +if (ip->i_d.di_version ==1 ) { + ip->i_d.di_nlink = ip->i_d.di_onlink; + ip->i_d.di_onlink =0 ; +xfs_set_projid (ip,0 ); + } + + ip->i_delayed_blks =0 ; + +/* +* Mark the buffer containing the inode as something to keep +* around for a while. This helps to keep recently accessed +* meta-data in-core longer. +*/ +xfs_buf_set_ref (bp,XFS_INO_REF ); + +/* +* Use xfs_trans_brelse() to release the buffer containing the on-disk +* inode, because it was acquired with xfs_trans_read_buf() in +* xfs_imap_to_bp() above. If tp is NULL, this is just a normal +* brelse(). If we're within a transaction, then xfs_trans_brelse() +* will only release the buffer if it is not dirty within the +* transaction. It will be OK to release the buffer in this case, +* because inodes on disk are never destroyed and we will be locking the +* new in-core inode before putting it in the cache where other +* processes can find it. Thus we don't have to worry about the inode +* being changed just because we released the buffer. +*/ + out_brelse: +xfs_trans_brelse (tp, bp); +return error; +}fs/xfs/xfs_inode_buf.h new file +43
-0@@ -0,0 +1,53 @@ +/* +* Copyright (c) 2000-2003,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_INODE_BUF_H__ +#define __XFS_INODE_BUF_H__ + +struct xfs_inode ; +struct xfs_dinode ; +struct xfs_icdinode ; + +/* +* Inode location information. Stored in the inode and passed to +* xfs_imap_to_bp() to get a buffer and dinode for a given inode. +*/ +struct xfs_imap { +xfs_daddr_t im_blkno;/* starting BB of inode chunk */ +ushort im_len;/* length in BBs of inode chunk */ +ushort im_boffset;/* inode offset in block in bytes */ +}; + +int xfs_imap_to_bp (struct xfs_mount *,struct xfs_trans *, +struct xfs_imap *,struct xfs_dinode **, +struct xfs_buf **,uint ,uint ); +int xfs_iread (struct xfs_mount *,struct xfs_trans *, +struct xfs_inode *,uint ); +void xfs_dinode_calc_crc (struct xfs_mount *,struct xfs_dinode *); +void xfs_dinode_to_disk (struct xfs_dinode *, +struct xfs_icdinode *); +bool xfs_can_free_eofblocks (struct xfs_inode *,bool );
fs/xfs/xfs_inode_buf.h line 53
Quoted 10 lines
fs/xfs/xfs_inode_buf.h new file +10
-0+ +#if defined(DEBUG ) +void xfs_inobp_check (struct xfs_mount *,struct xfs_buf *); +#else +#define xfs_inobp_check (mp, bp) +#endif /* DEBUG */ + +extern const struct xfs_buf_ops xfs_inode_buf_ops; + +#endif /* __XFS_INODE_BUF_H__ */
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 15/49 xfs: move getdents code into it's own file
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The directory readdir code isno used by userspace, but it is intermingled with files that are shared with userspace. This makes it difficult to compare the differences between the userspac eand kernel files are the userspace files don't have the getdents code in them. Move all the kernel getdents code to a separate file to bring the shared content between userspace and kernel files closer together.
--- fs/xfs/Makefile | 1 + fs/xfs/xfs_dir2.c | 31 --- fs/xfs/xfs_dir2_block.c | 97 +------ fs/xfs/xfs_dir2_leaf.c | 390 ---------------------------- fs/xfs/xfs_dir2_priv.h | 7 +- fs/xfs/xfs_dir2_readdir.c | 646 ++++++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_dir2_sf.c | 94 ------- 7 files changed, 650 insertions(+), 616 deletions(-) create mode 100644 fs/xfs/xfs_dir2_readdir.c
fs/xfs/Makefile +1 -0
@@ -30,6 +30,7 @@ xfs-y += xfs_aops.o \ xfs_bit.o \ xfs_buf.o \ xfs_dfrag.o \ + xfs_dir2_readdir.o \ xfs_discard.o \ xfs_error.o \ xfs_export.o \
fs/xfs/xfs_dir2.c +0 -31
@@ -363,37 +363,6 @@ xfs_dir_removename( }/* -* Read a directory. -*/ -int -xfs_readdir ( -xfs_inode_t *dp, -struct dir_context *ctx, -size_t bufsize) -{ -int rval;/* return value */ -int v;/* type-checking value */ - -trace_xfs_readdir (dp); - -if (XFS_FORCED_SHUTDOWN (dp->i_mount)) -return XFS_ERROR (EIO ); - -ASSERT (S_ISDIR (dp->i_d.di_mode)); -XFS_STATS_INC (xs_dir_getdents); - -if (dp->i_d.di_format ==XFS_DINODE_FMT_LOCAL ) - rval =xfs_dir2_sf_getdents (dp, ctx); -else if ((rval =xfs_dir2_isblock (NULL , dp, &v))) - ; -else if (v) - rval =xfs_dir2_block_getdents (dp, ctx); -else - rval =xfs_dir2_leaf_getdents (dp, ctx, bufsize); -return rval; -} - -/* * Replace the inode number of a directory entry. */ int
fs/xfs/xfs_dir2_block.c +1 -96
109 lines not on this page · raw message
fs/xfs/xfs_dir2_leaf.c +0 -390
396 lines not on this page · raw message
fs/xfs/xfs_dir2_priv.h +2 -5
@@ -32,9 +32,9 @@ extern int xfs_dir_cilookup_result(struct xfs_da_args *args,/* xfs_dir2_block.c */ extern const struct xfs_buf_ops xfs_dir3_block_buf_ops; +extern int xfs_dir3_block_read (struct xfs_trans *tp,struct xfs_inode *dp, +struct xfs_buf **bpp);extern int xfs_dir2_block_addname (struct xfs_da_args *args); -extern int xfs_dir2_block_getdents (struct xfs_inode *dp, -struct dir_context *ctx);extern int xfs_dir2_block_lookup (struct xfs_da_args *args);extern int xfs_dir2_block_removename (struct xfs_da_args *args);extern int xfs_dir2_block_replace (struct xfs_da_args *args);
@@ -91,8 +91,6 @@ extern void xfs_dir3_leaf_compact(struct xfs_da_args *args,extern void xfs_dir3_leaf_compact_x1 (struct xfs_dir3_icleaf_hdr *leafhdr,struct xfs_dir2_leaf_entry *ents,int *indexp,int *lowstalep,int *highstalep,int *lowlogp,int *highlogp); -extern int xfs_dir2_leaf_getdents (struct xfs_inode *dp,struct dir_context *ctx, -size_t bufsize);extern int xfs_dir3_leaf_get_buf (struct xfs_da_args *args,xfs_dir2_db_t bno,struct xfs_buf **bpp,__uint16_t magic); extern void xfs_dir3_leaf_log_ents(struct xfs_trans *tp, struct xfs_buf *bp,
@@ -153,7 +151,6 @@ extern int xfs_dir2_block_to_sf(struct xfs_da_args *args, struct xfs_buf *bp, int size, xfs_dir2_sf_hdr_t *sfhp);extern int xfs_dir2_sf_addname (struct xfs_da_args *args);extern int xfs_dir2_sf_create (struct xfs_da_args *args,xfs_ino_t pino); -extern int xfs_dir2_sf_getdents (struct xfs_inode *dp,struct dir_context *ctx);extern int xfs_dir2_sf_lookup (struct xfs_da_args *args);extern int xfs_dir2_sf_removename (struct xfs_da_args *args);extern int xfs_dir2_sf_replace (struct xfs_da_args *args);
fs/xfs/xfs_dir2_readdir.c new file +646 -0
646 lines not on this page · raw message
fs/xfs/xfs_dir2_sf.c +0 -94
100 lines not on this page · raw message
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 15/49] xfs: move getdents code into it's own file
Quoted 10 lines · Dave Chinner
From: Dave Chinner <[email protected]>
The directory readdir code isno used by userspace, but it is intermingled with files that are shared with userspace. This makes it difficult to compare the differences between the userspac eand kernel files are the userspace files don't have the getdents code in them. Move all the kernel getdents code to a separate file to bring the shared content between userspace and kernel files closer together.
Quoted 2 lines
Signed-off-by Dave Chinner <[email protected]>---
xfs_dir3_block_read() becomes non-static, xfs_dir2_leaf_getdents(), xfs_dir2_block_getdents(), xfs_dir2_sf_getdents() all moved and become static. Otherwise a clean move:
Quoted 1,361 lines
fs/xfs/Makefile | 1 + fs/xfs/xfs_dir2.c | 31 --- fs/xfs/xfs_dir2_block.c | 97 +------ fs/xfs/xfs_dir2_leaf.c | 390 ---------------------------- fs/xfs/xfs_dir2_priv.h | 7 +- fs/xfs/xfs_dir2_readdir.c | 646 ++++++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_dir2_sf.c | 94 ------- 7 files changed, 650 insertions(+), 616 deletions(-) create mode 100644 fs/xfs/xfs_dir2_readdir.cfs/xfs/Makefile +1
-0@@ -30,6 +30,7 @@ xfs-y += xfs_aops.o \ xfs_bit.o \ xfs_buf.o \ xfs_dfrag.o \ + xfs_dir2_readdir.o \ xfs_discard.o \ xfs_error.o \ xfs_export.o \fs/xfs/xfs_dir2.c +0
-31@@ -363,37 +363,6 @@ xfs_dir_removename( }/* -* Read a directory. -*/ -int -xfs_readdir ( -xfs_inode_t *dp, -struct dir_context *ctx, -size_t bufsize) -{ -int rval;/* return value */ -int v;/* type-checking value */ - -trace_xfs_readdir (dp); - -if (XFS_FORCED_SHUTDOWN (dp->i_mount)) -return XFS_ERROR (EIO ); - -ASSERT (S_ISDIR (dp->i_d.di_mode)); -XFS_STATS_INC (xs_dir_getdents); - -if (dp->i_d.di_format ==XFS_DINODE_FMT_LOCAL ) - rval =xfs_dir2_sf_getdents (dp, ctx); -else if ((rval =xfs_dir2_isblock (NULL , dp, &v))) - ; -else if (v) - rval =xfs_dir2_block_getdents (dp, ctx); -else - rval =xfs_dir2_leaf_getdents (dp, ctx, bufsize); -return rval; -} - -/* * Replace the inode number of a directory entry. */ int fs/xfs/xfs_dir2_block.c +1
-96@@ -126,7 +126,7 @@ const struct xfs_buf_ops xfs_dir3_block_buf_ops = { .verify_write = xfs_dir3_block_write_verify, }; -static int +int xfs_dir3_block_read( struct xfs_trans *tp, struct xfs_inode *dp,@@ -565,101 +565,6 @@ xfs_dir2_block_addname( }/* -* Readdir for block directories. -*/ -int /* error */ -xfs_dir2_block_getdents ( -xfs_inode_t *dp,/* incore inode */ -struct dir_context *ctx) -{ -xfs_dir2_data_hdr_t *hdr;/* block header */ -struct xfs_buf *bp;/* buffer for block */ -xfs_dir2_block_tail_t *btp;/* block tail */ -xfs_dir2_data_entry_t *dep;/* block data entry */ -xfs_dir2_data_unused_t *dup;/* block unused entry */ -char *endptr;/* end of the data entries */ -int error;/* error return value */ -xfs_mount_t *mp;/* filesystem mount point */ -char *ptr;/* current data entry */ -int wantoff;/* starting block offset */ -xfs_off_t cook; - - mp = dp->i_mount; -/* -* If the block number in the offset is out of range, we're done. -*/ -if (xfs_dir2_dataptr_to_db (mp, ctx->pos) > mp->m_dirdatablk) -return 0 ; - - error =xfs_dir3_block_read (NULL , dp, &bp); -if (error) -return error; - -/* -* Extract the byte offset we start at from the seek pointer. -* We'll skip entries before this. -*/ - wantoff =xfs_dir2_dataptr_to_off (mp, ctx->pos); - hdr = bp->b_addr; -xfs_dir3_data_check (dp, bp); -/* -* Set up values for the loop. -*/ - btp =xfs_dir2_block_tail_p (mp, hdr); - ptr = (char *)xfs_dir3_data_entry_p (hdr); - endptr = (char *)xfs_dir2_block_leaf_p (btp); - -/* -* Loop over the data portion of the block. -* Each object is a real entry (dep) or an unused one (dup). -*/ -while (ptr < endptr) { - dup = (xfs_dir2_data_unused_t *)ptr; -/* -* Unused, skip it. -*/ -if (be16_to_cpu (dup->freetag) ==XFS_DIR2_DATA_FREE_TAG ) { - ptr +=be16_to_cpu (dup->length); -continue ; - } - - dep = (xfs_dir2_data_entry_t *)ptr; - -/* -* Bump pointer for the next iteration. -*/ - ptr +=xfs_dir2_data_entsize (dep->namelen); -/* -* The entry is before the desired starting point, skip it. -*/ -if ((char *)dep - (char *)hdr < wantoff) -continue ; - - cook =xfs_dir2_db_off_to_dataptr (mp, mp->m_dirdatablk, - (char *)dep - (char *)hdr); - - ctx->pos = cook &0x7fffffff ; -/* -* If it didn't fit, set the final offset to here & return. -*/ -if (!dir_emit (ctx, (char *)dep->name, dep->namelen, -be64_to_cpu (dep->inumber),DT_UNKNOWN )) { -xfs_trans_brelse (NULL , bp); -return 0 ; - } - } - -/* -* Reached the end of the block. -* Set the offset to a non-existent block 1 and return. -*/ - ctx->pos =xfs_dir2_db_off_to_dataptr (mp, mp->m_dirdatablk +1 ,0 ) & -0x7fffffff ; -xfs_trans_brelse (NULL , bp); -return 0 ; -} - -/* * Log leaf entries from the block. */ static voidfs/xfs/xfs_dir2_leaf.c +0
-390@@ -1083,396 +1083,6 @@ xfs_dir3_leaf_compact_x1( *highstalep = highstale; } -struct xfs_dir2_leaf_map_info { -xfs_extlen_t map_blocks;/* number of fsbs in map */ -xfs_dablk_t map_off;/* last mapped file offset */ -int map_size;/* total entries in *map */ -int map_valid;/* valid entries in *map */ -int nmap;/* mappings to ask xfs_bmapi */ -xfs_dir2_db_t curdb;/* db for current block */ -int ra_current;/* number of read-ahead blks */ -int ra_index;/* *map index for read-ahead */ -int ra_offset;/* map entry offset for ra */ -int ra_want;/* readahead count wanted */ -struct xfs_bmbt_irec map[];/* map vector for blocks */ -}; - -STATIC int -xfs_dir2_leaf_readbuf ( -struct xfs_inode *dp, -size_t bufsize, -struct xfs_dir2_leaf_map_info *mip, -xfs_dir2_off_t *curoff, -struct xfs_buf **bpp) -{ -struct xfs_mount *mp = dp->i_mount; -struct xfs_buf *bp = *bpp; -struct xfs_bmbt_irec *map = mip->map; -struct blk_plug plug; -int error =0 ; -int length; -int i; -int j; - -/* -* If we have a buffer, we need to release it and -* take it out of the mapping. -*/ - -if (bp) { -xfs_trans_brelse (NULL , bp); - bp =NULL ; - mip->map_blocks -= mp->m_dirblkfsbs; -/* -* Loop to get rid of the extents for the -* directory block. -*/ -for (i = mp->m_dirblkfsbs; i >0 ; ) { - j =min_t (int, map->br_blockcount, i); - map->br_blockcount -= j; - map->br_startblock += j; - map->br_startoff += j; -/* -* If mapping is done, pitch it from -* the table. -*/ -if (!map->br_blockcount && --mip->map_valid) -memmove (&map[0 ], &map[1 ], -sizeof (map[0 ]) * mip->map_valid); - i -= j; - } - } - -/* -* Recalculate the readahead blocks wanted. -*/ - mip->ra_want =howmany (bufsize + mp->m_dirblksize, - mp->m_sb.sb_blocksize) -1 ; -ASSERT (mip->ra_want >=0 ); - -/* -* If we don't have as many as we want, and we haven't -* run out of data blocks, get some more mappings. -*/ -if (1 + mip->ra_want > mip->map_blocks && - mip->map_off <xfs_dir2_byte_to_da (mp,XFS_DIR2_LEAF_OFFSET )) { -/* -* Get more bmaps, fill in after the ones -* we already have in the table. -*/ - mip->nmap = mip->map_size - mip->map_valid; - error =xfs_bmapi_read (dp, mip->map_off, -xfs_dir2_byte_to_da (mp,XFS_DIR2_LEAF_OFFSET ) - - mip->map_off, - &map[mip->map_valid], &mip->nmap,0 ); - -/* -* Don't know if we should ignore this or try to return an -* error. The trouble with returning errors is that readdir -* will just stop without actually passing the error through. -*/ -if (error) - goto out;/* XXX */ - -/* -* If we got all the mappings we asked for, set the final map -* offset based on the last bmap value received. Otherwise, -* we've reached the end. -*/ -if (mip->nmap == mip->map_size - mip->map_valid) { - i = mip->map_valid + mip->nmap -1 ; - mip->map_off = map[i].br_startoff + map[i].br_blockcount; - }else - mip->map_off =xfs_dir2_byte_to_da (mp, -XFS_DIR2_LEAF_OFFSET ); - -/* -* Look for holes in the mapping, and eliminate them. Count up -* the valid blocks. -*/ -for (i = mip->map_valid; i < mip->map_valid + mip->nmap; ) { -if (map[i].br_startblock ==HOLESTARTBLOCK ) { - mip->nmap--; - length = mip->map_valid + mip->nmap - i; -if (length) -memmove (&map[i], &map[i +1 ], -sizeof (map[i]) * length); - }else { - mip->map_blocks += map[i].br_blockcount; - i++; - } - } - mip->map_valid += mip->nmap; - } - -/* -* No valid mappings, so no more data blocks. -*/ -if (!mip->map_valid) { - *curoff =xfs_dir2_da_to_byte (mp, mip->map_off); - goto out; - } - -/* -* Read the directory block starting at the first mapping. -*/ - mip->curdb =xfs_dir2_da_to_db (mp, map->br_startoff); - error =xfs_dir3_data_read (NULL , dp, map->br_startoff, - map->br_blockcount >= mp->m_dirblkfsbs ? -XFS_FSB_TO_DADDR (mp, map->br_startblock) :-1 , &bp); - -/* -* Should just skip over the data block instead of giving up. -*/ -if (error) - goto out;/* XXX */ - -/* -* Adjust the current amount of read-ahead: we just read a block that -* was previously ra. -*/ -if (mip->ra_current) - mip->ra_current -= mp->m_dirblkfsbs; - -/* -* Do we need more readahead? -*/ -blk_start_plug (&plug); -for (mip->ra_index = mip->ra_offset = i =0 ; - mip->ra_want > mip->ra_current && i < mip->map_blocks; - i += mp->m_dirblkfsbs) { -ASSERT (mip->ra_index < mip->map_valid); -/* -* Read-ahead a contiguous directory block. -*/ -if (i > mip->ra_current && - map[mip->ra_index].br_blockcount >= mp->m_dirblkfsbs) { -xfs_dir3_data_readahead (NULL , dp, - map[mip->ra_index].br_startoff + mip->ra_offset, -XFS_FSB_TO_DADDR (mp, - map[mip->ra_index].br_startblock + - mip->ra_offset)); - mip->ra_current = i; - } - -/* -* Read-ahead a non-contiguous directory block. This doesn't -* use our mapping, but this is a very rare case. -*/ -else if (i > mip->ra_current) { -xfs_dir3_data_readahead (NULL , dp, - map[mip->ra_index].br_startoff + - mip->ra_offset,-1 ); - mip->ra_current = i; - } - -/* -* Advance offset through the mapping table. -*/ -for (j =0 ; j < mp->m_dirblkfsbs; j++) { -/* -* The rest of this extent but not more than a dir -* block. -*/ - length =min_t (int, mp->m_dirblkfsbs, - map[mip->ra_index].br_blockcount - - mip->ra_offset); - j += length; - mip->ra_offset += length; - -/* -* Advance to the next mapping if this one is used up. -*/ -if (mip->ra_offset == map[mip->ra_index].br_blockcount) { - mip->ra_offset =0 ; - mip->ra_index++; - } - } - } -blk_finish_plug (&plug); - -out: - *bpp = bp; -return error; -} - -/* -* Getdents (readdir) for leaf and node directories. -* This reads the data blocks only, so is the same for both forms. -*/ -int /* error */ -xfs_dir2_leaf_getdents ( -xfs_inode_t *dp,/* incore directory inode */ -struct dir_context *ctx, -size_t bufsize) -{ -struct xfs_buf *bp =NULL ;/* data block buffer */ -xfs_dir2_data_hdr_t *hdr;/* data block header */ -xfs_dir2_data_entry_t *dep;/* data entry */ -xfs_dir2_data_unused_t *dup;/* unused entry */ -int error =0 ;/* error return value */ -int length;/* temporary length value */ -xfs_mount_t *mp;/* filesystem mount point */ -int byteoff;/* offset in current block */ -xfs_dir2_off_t curoff;/* current overall offset */ -xfs_dir2_off_t newoff;/* new curoff after new blk */ -char *ptr =NULL ;/* pointer to current data */ -struct xfs_dir2_leaf_map_info *map_info; - -/* -* If the offset is at or past the largest allowed value, -* give up right away. -*/ -if (ctx->pos >=XFS_DIR2_MAX_DATAPTR ) -return 0 ; - - mp = dp->i_mount; - -/* -* Set up to bmap a number of blocks based on the caller's -* buffer size, the directory block size, and the filesystem -* block size. -*/ - length =howmany (bufsize + mp->m_dirblksize, - mp->m_sb.sb_blocksize); - map_info =kmem_zalloc (offsetof(struct xfs_dir2_leaf_map_info , map) + - (length *sizeof (struct xfs_bmbt_irec )), -KM_SLEEP |KM_NOFS ); - map_info->map_size = length; - -/* -* Inside the loop we keep the main offset value as a byte offset -* in the directory file. -*/ - curoff =xfs_dir2_dataptr_to_byte (mp, ctx->pos); - -/* -* Force this conversion through db so we truncate the offset -* down to get the start of the data block. -*/ - map_info->map_off =xfs_dir2_db_to_da (mp, -xfs_dir2_byte_to_db (mp, curoff)); - -/* -* Loop over directory entries until we reach the end offset. -* Get more blocks and readahead as necessary. -*/ -while (curoff <XFS_DIR2_LEAF_OFFSET ) { -/* -* If we have no buffer, or we're off the end of the -* current buffer, need to get another one. -*/ -if (!bp || ptr >= (char *)bp->b_addr + mp->m_dirblksize) { - - error =xfs_dir2_leaf_readbuf (dp, bufsize, map_info, - &curoff, &bp); -if (error || !map_info->map_valid) -break ; - -/* -* Having done a read, we need to set a new offset. -*/ - newoff =xfs_dir2_db_off_to_byte (mp, map_info->curdb,0 ); -/* -* Start of the current block. -*/ -if (curoff < newoff) - curoff = newoff; -/* -* Make sure we're in the right block. -*/ -else if (curoff > newoff) -ASSERT (xfs_dir2_byte_to_db (mp, curoff) == - map_info->curdb); - hdr = bp->b_addr; -xfs_dir3_data_check (dp, bp); -/* -* Find our position in the block. -*/ - ptr = (char *)xfs_dir3_data_entry_p (hdr); - byteoff =xfs_dir2_byte_to_off (mp, curoff); -/* -* Skip past the header. -*/ -if (byteoff ==0 ) - curoff +=xfs_dir3_data_entry_offset (hdr); -/* -* Skip past entries until we reach our offset. -*/ -else { -while ((char *)ptr - (char *)hdr < byteoff) { - dup = (xfs_dir2_data_unused_t *)ptr; - -if (be16_to_cpu (dup->freetag) - ==XFS_DIR2_DATA_FREE_TAG ) { - - length =be16_to_cpu (dup->length); - ptr += length; -continue ; - } - dep = (xfs_dir2_data_entry_t *)ptr; - length = -xfs_dir2_data_entsize (dep->namelen); - ptr += length; - } -/* -* Now set our real offset. -*/ - curoff = -xfs_dir2_db_off_to_byte (mp, -xfs_dir2_byte_to_db (mp, curoff), - (char *)ptr - (char *)hdr); -if (ptr >= (char *)hdr + mp->m_dirblksize) { -continue ; - } - } - } -/* -* We have a pointer to an entry. -* Is it a live one? -*/ - dup = (xfs_dir2_data_unused_t *)ptr; -/* -* No, it's unused, skip over it. -*/ -if (be16_to_cpu (dup->freetag) ==XFS_DIR2_DATA_FREE_TAG ) { - length =be16_to_cpu (dup->length); - ptr += length; - curoff += length; -continue ; - } - - dep = (xfs_dir2_data_entry_t *)ptr; - length =xfs_dir2_data_entsize (dep->namelen); - - ctx->pos =xfs_dir2_byte_to_dataptr (mp, curoff) &0x7fffffff ; -if (!dir_emit (ctx, (char *)dep->name, dep->namelen, -be64_to_cpu (dep->inumber),DT_UNKNOWN )) -break ; - -/* -* Advance to next entry in the block. -*/ - ptr += length; - curoff += length; -/* bufsize may have just been a guess; don't go negative */ - bufsize = bufsize > length ? bufsize - length :0 ; - } - -/* -* All done. Set output offset value to current offset. -*/ -if (curoff >xfs_dir2_dataptr_to_byte (mp,XFS_DIR2_MAX_DATAPTR )) - ctx->pos =XFS_DIR2_MAX_DATAPTR &0x7fffffff ; -else - ctx->pos =xfs_dir2_byte_to_dataptr (mp, curoff) &0x7fffffff ; -kmem_free (map_info); -if (bp) -xfs_trans_brelse (NULL , bp); -return error; -} - -/* * Log the bests entries indicated from a leaf1 block. */ fs/xfs/xfs_dir2_priv.h +2
-5@@ -32,9 +32,9 @@ extern int xfs_dir_cilookup_result(struct xfs_da_args *args,/* xfs_dir2_block.c */ extern const struct xfs_buf_ops xfs_dir3_block_buf_ops; +extern int xfs_dir3_block_read (struct xfs_trans *tp,struct xfs_inode *dp, +struct xfs_buf **bpp);extern int xfs_dir2_block_addname (struct xfs_da_args *args); -extern int xfs_dir2_block_getdents (struct xfs_inode *dp, -struct dir_context *ctx);extern int xfs_dir2_block_lookup (struct xfs_da_args *args);extern int xfs_dir2_block_removename (struct xfs_da_args *args);extern int xfs_dir2_block_replace (struct xfs_da_args *args);@@ -91,8 +91,6 @@ extern void xfs_dir3_leaf_compact(struct xfs_da_args *args,extern void xfs_dir3_leaf_compact_x1 (struct xfs_dir3_icleaf_hdr *leafhdr,struct xfs_dir2_leaf_entry *ents,int *indexp,int *lowstalep,int *highstalep,int *lowlogp,int *highlogp); -extern int xfs_dir2_leaf_getdents (struct xfs_inode *dp,struct dir_context *ctx, -size_t bufsize);extern int xfs_dir3_leaf_get_buf (struct xfs_da_args *args,xfs_dir2_db_t bno,struct xfs_buf **bpp,__uint16_t magic); extern void xfs_dir3_leaf_log_ents(struct xfs_trans *tp, struct xfs_buf *bp,@@ -153,7 +151,6 @@ extern int xfs_dir2_block_to_sf(struct xfs_da_args *args, struct xfs_buf *bp, int size, xfs_dir2_sf_hdr_t *sfhp);extern int xfs_dir2_sf_addname (struct xfs_da_args *args);extern int xfs_dir2_sf_create (struct xfs_da_args *args,xfs_ino_t pino); -extern int xfs_dir2_sf_getdents (struct xfs_inode *dp,struct dir_context *ctx);extern int xfs_dir2_sf_lookup (struct xfs_da_args *args);extern int xfs_dir2_sf_removename (struct xfs_da_args *args);extern int xfs_dir2_sf_replace (struct xfs_da_args *args);fs/xfs/xfs_dir2_readdir.c new file +646
-0@@ -0,0 +1,646 @@ +/* +* Copyright (c) 2000-2005 Silicon Graphics, Inc. +* Copyright (c) 2013 Red Hat, 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 +*/ +#include "xfs.h" +#include "xfs_fs.h" +#include "xfs_types.h" +#include "xfs_bit.h" +#include "xfs_log.h" +#include "xfs_trans.h" +#include "xfs_sb.h" +#include "xfs_ag.h" +#include "xfs_mount.h" +#include "xfs_da_btree.h" +#include "xfs_bmap_btree.h" +#include "xfs_dinode.h" +#include "xfs_inode.h" +#include "xfs_dir2_format.h" +#include "xfs_dir2_priv.h" +#include "xfs_error.h" +#include "xfs_trace.h" +#include "xfs_bmap.h" + +STATIC int +xfs_dir2_sf_getdents ( +xfs_inode_t *dp,/* incore directory inode */ +struct dir_context *ctx) +{ +int i;/* shortform entry number */ +xfs_mount_t *mp;/* filesystem mount point */ +xfs_dir2_dataptr_t off;/* current entry's offset */ +xfs_dir2_sf_entry_t *sfep;/* shortform directory entry */ +xfs_dir2_sf_hdr_t *sfp;/* shortform structure */ +xfs_dir2_dataptr_t dot_offset; +xfs_dir2_dataptr_t dotdot_offset; +xfs_ino_t ino; + + mp = dp->i_mount; + +ASSERT (dp->i_df.if_flags &XFS_IFINLINE ); +/* +* Give up if the directory is way too short. +*/ +if (dp->i_d.di_size < offsetof(xfs_dir2_sf_hdr_t , parent)) { +ASSERT (XFS_FORCED_SHUTDOWN (mp)); +return XFS_ERROR (EIO ); + } + +ASSERT (dp->i_df.if_bytes == dp->i_d.di_size); +ASSERT (dp->i_df.if_u1.if_data !=NULL ); + + sfp = (xfs_dir2_sf_hdr_t *)dp->i_df.if_u1.if_data; + +ASSERT (dp->i_d.di_size >=xfs_dir2_sf_hdr_size (sfp->i8count)); + +/* +* If the block number in the offset is out of range, we're done. +*/ +if (xfs_dir2_dataptr_to_db (mp, ctx->pos) > mp->m_dirdatablk) +return 0 ; + +/* +* Precalculate offsets for . and .. as we will always need them. +* +* XXX(hch): the second argument is sometimes 0 and sometimes +* mp->m_dirdatablk. +*/ + dot_offset =xfs_dir2_db_off_to_dataptr (mp, mp->m_dirdatablk, +XFS_DIR3_DATA_DOT_OFFSET (mp)); + dotdot_offset =xfs_dir2_db_off_to_dataptr (mp, mp->m_dirdatablk, +XFS_DIR3_DATA_DOTDOT_OFFSET (mp)); + +/* +* Put . entry unless we're starting past it. +*/ +if (ctx->pos <= dot_offset) { + ctx->pos = dot_offset &0x7fffffff ; +if (!dir_emit (ctx,"." ,1 , dp->i_ino,DT_DIR )) +return 0 ; + } + +/* +* Put .. entry unless we're starting past it. +*/ +if (ctx->pos <= dotdot_offset) { + ino =xfs_dir2_sf_get_parent_ino (sfp); + ctx->pos = dotdot_offset &0x7fffffff ; +if (!dir_emit (ctx,".." ,2 , ino,DT_DIR )) +return 0 ; + } + +/* +* Loop while there are more entries and put'ing works. +*/ + sfep =xfs_dir2_sf_firstentry (sfp); +for (i =0 ; i < sfp->count; i++) { + off =xfs_dir2_db_off_to_dataptr (mp, mp->m_dirdatablk, +xfs_dir2_sf_get_offset (sfep)); + +if (ctx->pos > off) { + sfep =xfs_dir2_sf_nextentry (sfp, sfep); +continue ; + } + + ino =xfs_dir2_sfe_get_ino (sfp, sfep); + ctx->pos = off &0x7fffffff ; +if (!dir_emit (ctx, (char *)sfep->name, sfep->namelen, + ino,DT_UNKNOWN )) +return 0 ; + sfep =xfs_dir2_sf_nextentry (sfp, sfep); + } + + ctx->pos =xfs_dir2_db_off_to_dataptr (mp, mp->m_dirdatablk +1 ,0 ) & +0x7fffffff ; +return 0 ; +} + +/* +* Readdir for block directories. +*/ +STATIC int +xfs_dir2_block_getdents ( +xfs_inode_t *dp,/* incore inode */ +struct dir_context *ctx) +{ +xfs_dir2_data_hdr_t *hdr;/* block header */ +struct xfs_buf *bp;/* buffer for block */ +xfs_dir2_block_tail_t *btp;/* block tail */ +xfs_dir2_data_entry_t *dep;/* block data entry */ +xfs_dir2_data_unused_t *dup;/* block unused entry */ +char *endptr;/* end of the data entries */ +int error;/* error return value */ +xfs_mount_t *mp;/* filesystem mount point */ +char *ptr;/* current data entry */ +int wantoff;/* starting block offset */ +xfs_off_t cook; + + mp = dp->i_mount; +/* +* If the block number in the offset is out of range, we're done. +*/ +if (xfs_dir2_dataptr_to_db (mp, ctx->pos) > mp->m_dirdatablk) +return 0 ; + + error =xfs_dir3_block_read (NULL , dp, &bp); +if (error) +return error; + +/* +* Extract the byte offset we start at from the seek pointer. +* We'll skip entries before this. +*/ + wantoff =xfs_dir2_dataptr_to_off (mp, ctx->pos); + hdr = bp->b_addr; +xfs_dir3_data_check (dp, bp); +/* +* Set up values for the loop. +*/ + btp =xfs_dir2_block_tail_p (mp, hdr); + ptr = (char *)xfs_dir3_data_entry_p (hdr); + endptr = (char *)xfs_dir2_block_leaf_p (btp); + +/* +* Loop over the data portion of the block. +* Each object is a real entry (dep) or an unused one (dup). +*/ +while (ptr < endptr) { + dup = (xfs_dir2_data_unused_t *)ptr; +/* +* Unused, skip it. +*/ +if (be16_to_cpu (dup->freetag) ==XFS_DIR2_DATA_FREE_TAG ) { + ptr +=be16_to_cpu (dup->length); +continue ; + } + + dep = (xfs_dir2_data_entry_t *)ptr; + +/* +* Bump pointer for the next iteration. +*/ + ptr +=xfs_dir2_data_entsize (dep->namelen); +/* +* The entry is before the desired starting point, skip it. +*/ +if ((char *)dep - (char *)hdr < wantoff) +continue ; + + cook =xfs_dir2_db_off_to_dataptr (mp, mp->m_dirdatablk, + (char *)dep - (char *)hdr); + + ctx->pos = cook &0x7fffffff ; +/* +* If it didn't fit, set the final offset to here & return. +*/ +if (!dir_emit (ctx, (char *)dep->name, dep->namelen, +be64_to_cpu (dep->inumber),DT_UNKNOWN )) { +xfs_trans_brelse (NULL , bp); +return 0 ; + } + } + +/* +* Reached the end of the block. +* Set the offset to a non-existent block 1 and return. +*/ + ctx->pos =xfs_dir2_db_off_to_dataptr (mp, mp->m_dirdatablk +1 ,0 ) & +0x7fffffff ; +xfs_trans_brelse (NULL , bp); +return 0 ; +} + +struct xfs_dir2_leaf_map_info { +xfs_extlen_t map_blocks;/* number of fsbs in map */ +xfs_dablk_t map_off;/* last mapped file offset */ +int map_size;/* total entries in *map */ +int map_valid;/* valid entries in *map */ +int nmap;/* mappings to ask xfs_bmapi */ +xfs_dir2_db_t curdb;/* db for current block */ +int ra_current;/* number of read-ahead blks */ +int ra_index;/* *map index for read-ahead */ +int ra_offset;/* map entry offset for ra */ +int ra_want;/* readahead count wanted */ +struct xfs_bmbt_irec map[];/* map vector for blocks */ +}; + +STATIC int +xfs_dir2_leaf_readbuf ( +struct xfs_inode *dp, +size_t bufsize, +struct xfs_dir2_leaf_map_info *mip, +xfs_dir2_off_t *curoff, +struct xfs_buf **bpp) +{ +struct xfs_mount *mp = dp->i_mount; +struct xfs_buf *bp = *bpp; +struct xfs_bmbt_irec *map = mip->map; +struct blk_plug plug; +int error =0 ; +int length; +int i; +int j; + +/* +* If we have a buffer, we need to release it and +* take it out of the mapping. +*/ + +if (bp) { +xfs_trans_brelse (NULL , bp); + bp =NULL ; + mip->map_blocks -= mp->m_dirblkfsbs; +/* +* Loop to get rid of the extents for the +* directory block. +*/ +for (i = mp->m_dirblkfsbs; i >0 ; ) { + j =min_t (int, map->br_blockcount, i); + map->br_blockcount -= j; + map->br_startblock += j; + map->br_startoff += j; +/* +* If mapping is done, pitch it from +* the table. +*/ +if (!map->br_blockcount && --mip->map_valid) +memmove (&map[0 ], &map[1 ], +sizeof (map[0 ]) * mip->map_valid); + i -= j; + } + } + +/* +* Recalculate the readahead blocks wanted. +*/ + mip->ra_want =howmany (bufsize + mp->m_dirblksize, + mp->m_sb.sb_blocksize) -1 ; +ASSERT (mip->ra_want >=0 ); + +/* +* If we don't have as many as we want, and we haven't +* run out of data blocks, get some more mappings. +*/ +if (1 + mip->ra_want > mip->map_blocks && + mip->map_off <xfs_dir2_byte_to_da (mp,XFS_DIR2_LEAF_OFFSET )) { +/* +* Get more bmaps, fill in after the ones +* we already have in the table. +*/ + mip->nmap = mip->map_size - mip->map_valid; + error =xfs_bmapi_read (dp, mip->map_off, +xfs_dir2_byte_to_da (mp,XFS_DIR2_LEAF_OFFSET ) - + mip->map_off, + &map[mip->map_valid], &mip->nmap,0 ); + +/* +* Don't know if we should ignore this or try to return an +* error. The trouble with returning errors is that readdir +* will just stop without actually passing the error through. +*/ +if (error) + goto out;/* XXX */ + +/* +* If we got all the mappings we asked for, set the final map +* offset based on the last bmap value received. Otherwise, +* we've reached the end. +*/ +if (mip->nmap == mip->map_size - mip->map_valid) { + i = mip->map_valid + mip->nmap -1 ; + mip->map_off = map[i].br_startoff + map[i].br_blockcount; + }else + mip->map_off =xfs_dir2_byte_to_da (mp, +XFS_DIR2_LEAF_OFFSET ); + +/* +* Look for holes in the mapping, and eliminate them. Count up +* the valid blocks. +*/ +for (i = mip->map_valid; i < mip->map_valid + mip->nmap; ) { +if (map[i].br_startblock ==HOLESTARTBLOCK ) { + mip->nmap--; + length = mip->map_valid + mip->nmap - i; +if (length) +memmove (&map[i], &map[i +1 ], +sizeof (map[i]) * length); + }else { + mip->map_blocks += map[i].br_blockcount; + i++; + } + } + mip->map_valid += mip->nmap; + } + +/* +* No valid mappings, so no more data blocks. +*/ +if (!mip->map_valid) { + *curoff =xfs_dir2_da_to_byte (mp, mip->map_off); + goto out; + } + +/* +* Read the directory block starting at the first mapping. +*/ + mip->curdb =xfs_dir2_da_to_db (mp, map->br_startoff); + error =xfs_dir3_data_read (NULL , dp, map->br_startoff, + map->br_blockcount >= mp->m_dirblkfsbs ? +XFS_FSB_TO_DADDR (mp, map->br_startblock) :-1 , &bp); + +/* +* Should just skip over the data block instead of giving up. +*/ +if (error) + goto out;/* XXX */ + +/* +* Adjust the current amount of read-ahead: we just read a block that +* was previously ra. +*/ +if (mip->ra_current) + mip->ra_current -= mp->m_dirblkfsbs; + +/* +* Do we need more readahead? +*/ +blk_start_plug (&plug); +for (mip->ra_index = mip->ra_offset = i =0 ; + mip->ra_want > mip->ra_current && i < mip->map_blocks; + i += mp->m_dirblkfsbs) { +ASSERT (mip->ra_index < mip->map_valid); +/* +* Read-ahead a contiguous directory block. +*/ +if (i > mip->ra_current && + map[mip->ra_index].br_blockcount >= mp->m_dirblkfsbs) { +xfs_dir3_data_readahead (NULL , dp, + map[mip->ra_index].br_startoff + mip->ra_offset, +XFS_FSB_TO_DADDR (mp, + map[mip->ra_index].br_startblock + + mip->ra_offset)); + mip->ra_current = i; + } + +/* +* Read-ahead a non-contiguous directory block. This doesn't +* use our mapping, but this is a very rare case. +*/ +else if (i > mip->ra_current) { +xfs_dir3_data_readahead (NULL , dp, + map[mip->ra_index].br_startoff + + mip->ra_offset,-1 ); + mip->ra_current = i; + } + +/* +* Advance offset through the mapping table. +*/ +for (j =0 ; j < mp->m_dirblkfsbs; j++) { +/* +* The rest of this extent but not more than a dir +* block. +*/ + length =min_t (int, mp->m_dirblkfsbs, + map[mip->ra_index].br_blockcount - + mip->ra_offset); + j += length; + mip->ra_offset += length; + +/* +* Advance to the next mapping if this one is used up. +*/ +if (mip->ra_offset == map[mip->ra_index].br_blockcount) { + mip->ra_offset =0 ; + mip->ra_index++; + } + } + } +blk_finish_plug (&plug); + +out: + *bpp = bp; +return error; +} + +/* +* Getdents (readdir) for leaf and node directories. +* This reads the data blocks only, so is the same for both forms. +*/ +STATIC int +xfs_dir2_leaf_getdents ( +xfs_inode_t *dp,/* incore directory inode */ +struct dir_context *ctx, +size_t bufsize) +{ +struct xfs_buf *bp =NULL ;/* data block buffer */ +xfs_dir2_data_hdr_t *hdr;/* data block header */ +xfs_dir2_data_entry_t *dep;/* data entry */ +xfs_dir2_data_unused_t *dup;/* unused entry */ +int error =0 ;/* error return value */ +int length;/* temporary length value */ +xfs_mount_t *mp;/* filesystem mount point */ +int byteoff;/* offset in current block */ +xfs_dir2_off_t curoff;/* current overall offset */ +xfs_dir2_off_t newoff;/* new curoff after new blk */ +char *ptr =NULL ;/* pointer to current data */ +struct xfs_dir2_leaf_map_info *map_info; + +/* +* If the offset is at or past the largest allowed value, +* give up right away. +*/ +if (ctx->pos >=XFS_DIR2_MAX_DATAPTR ) +return 0 ; + + mp = dp->i_mount; + +/* +* Set up to bmap a number of blocks based on the caller's +* buffer size, the directory block size, and the filesystem +* block size. +*/ + length =howmany (bufsize + mp->m_dirblksize, + mp->m_sb.sb_blocksize); + map_info =kmem_zalloc (offsetof(struct xfs_dir2_leaf_map_info , map) + + (length *sizeof (struct xfs_bmbt_irec )), +KM_SLEEP |KM_NOFS ); + map_info->map_size = length; + +/* +* Inside the loop we keep the main offset value as a byte offset +* in the directory file. +*/ + curoff =xfs_dir2_dataptr_to_byte (mp, ctx->pos); + +/* +* Force this conversion through db so we truncate the offset +* down to get the start of the data block. +*/ + map_info->map_off =xfs_dir2_db_to_da (mp, +xfs_dir2_byte_to_db (mp, curoff)); + +/* +* Loop over directory entries until we reach the end offset. +* Get more blocks and readahead as necessary. +*/ +while (curoff <XFS_DIR2_LEAF_OFFSET ) { +/* +* If we have no buffer, or we're off the end of the +* current buffer, need to get another one. +*/ +if (!bp || ptr >= (char *)bp->b_addr + mp->m_dirblksize) { + + error =xfs_dir2_leaf_readbuf (dp, bufsize, map_info, + &curoff, &bp); +if (error || !map_info->map_valid) +break ; + +/* +* Having done a read, we need to set a new offset. +*/ + newoff =xfs_dir2_db_off_to_byte (mp, map_info->curdb,0 ); +/* +* Start of the current block. +*/ +if (curoff < newoff) + curoff = newoff; +/* +* Make sure we're in the right block. +*/ +else if (curoff > newoff) +ASSERT (xfs_dir2_byte_to_db (mp, curoff) == + map_info->curdb); + hdr = bp->b_addr; +xfs_dir3_data_check (dp, bp); +/* +* Find our position in the block. +*/ + ptr = (char *)xfs_dir3_data_entry_p (hdr); + byteoff =xfs_dir2_byte_to_off (mp, curoff); +/* +* Skip past the header. +*/ +if (byteoff ==0 ) + curoff +=xfs_dir3_data_entry_offset (hdr); +/* +* Skip past entries until we reach our offset. +*/ +else { +while ((char *)ptr - (char *)hdr < byteoff) { + dup = (xfs_dir2_data_unused_t *)ptr; + +if (be16_to_cpu (dup->freetag) + ==XFS_DIR2_DATA_FREE_TAG ) { + + length =be16_to_cpu (dup->length); + ptr += length; +continue ; + } + dep = (xfs_dir2_data_entry_t *)ptr; + length = +xfs_dir2_data_entsize (dep->namelen); + ptr += length; + } +/* +* Now set our real offset. +*/ + curoff = +xfs_dir2_db_off_to_byte (mp, +xfs_dir2_byte_to_db (mp, curoff), + (char *)ptr - (char *)hdr); +if (ptr >= (char *)hdr + mp->m_dirblksize) { +continue ; + } + } + } +/* +* We have a pointer to an entry. +* Is it a live one? +*/ + dup = (xfs_dir2_data_unused_t *)ptr; +/* +* No, it's unused, skip over it. +*/ +if (be16_to_cpu (dup->freetag) ==XFS_DIR2_DATA_FREE_TAG ) { + length =be16_to_cpu (dup->length); + ptr += length; + curoff += length; +continue ; + } + + dep = (xfs_dir2_data_entry_t *)ptr; + length =xfs_dir2_data_entsize (dep->namelen); + + ctx->pos =xfs_dir2_byte_to_dataptr (mp, curoff) &0x7fffffff ; +if (!dir_emit (ctx, (char *)dep->name, dep->namelen, +be64_to_cpu (dep->inumber),DT_UNKNOWN )) +break ; + +/* +* Advance to next entry in the block. +*/ + ptr += length; + curoff += length; +/* bufsize may have just been a guess; don't go negative */ + bufsize = bufsize > length ? bufsize - length :0 ; + } + +/* +* All done. Set output offset value to current offset. +*/ +if (curoff >xfs_dir2_dataptr_to_byte (mp,XFS_DIR2_MAX_DATAPTR )) + ctx->pos =XFS_DIR2_MAX_DATAPTR &0x7fffffff ; +else + ctx->pos =xfs_dir2_byte_to_dataptr (mp, curoff) &0x7fffffff ; +kmem_free (map_info); +if (bp) +xfs_trans_brelse (NULL , bp); +return error; +} + +/* +* Read a directory. +*/ +int +xfs_readdir ( +xfs_inode_t *dp, +struct dir_context *ctx, +size_t bufsize) +{ +int rval;/* return value */ +int v;/* type-checking value */ + +trace_xfs_readdir (dp); + +if (XFS_FORCED_SHUTDOWN (dp->i_mount)) +return XFS_ERROR (EIO ); + +ASSERT (S_ISDIR (dp->i_d.di_mode)); +XFS_STATS_INC (xs_dir_getdents); + +if (dp->i_d.di_format ==XFS_DINODE_FMT_LOCAL ) + rval =xfs_dir2_sf_getdents (dp, ctx); +else if ((rval =xfs_dir2_isblock (NULL , dp, &v))) + ; +else if (v) + rval =xfs_dir2_block_getdents (dp, ctx); +else + rval =xfs_dir2_leaf_getdents (dp, ctx, bufsize); +return rval; +} +fs/xfs/xfs_dir2_sf.c +0
-87@@ -765,100 +765,6 @@ xfs_dir2_sf_create(return 0 ; } -int /* error */ -xfs_dir2_sf_getdents ( -xfs_inode_t *dp,/* incore directory inode */ -struct dir_context *ctx) -{ -int i;/* shortform entry number */ -xfs_mount_t *mp;/* filesystem mount point */ -xfs_dir2_dataptr_t off;/* current entry's offset */ -xfs_dir2_sf_entry_t *sfep;/* shortform directory entry */ -xfs_dir2_sf_hdr_t *sfp;/* shortform structure */ -xfs_dir2_dataptr_t dot_offset; -xfs_dir2_dataptr_t dotdot_offset; -xfs_ino_t ino; - - mp = dp->i_mount; - -ASSERT (dp->i_df.if_flags &XFS_IFINLINE ); -/* -* Give up if the directory is way too short. -*/ -if (dp->i_d.di_size < offsetof(xfs_dir2_sf_hdr_t , parent)) { -ASSERT (XFS_FORCED_SHUTDOWN (mp)); -return XFS_ERROR (EIO ); - } - -ASSERT (dp->i_df.if_bytes == dp->i_d.di_size); -ASSERT (dp->i_df.if_u1.if_data !=NULL ); - - sfp = (xfs_dir2_sf_hdr_t *)dp->i_df.if_u1.if_data; - -ASSERT (dp->i_d.di_size >=xfs_dir2_sf_hdr_size (sfp->i8count)); - -/* -* If the block number in the offset is out of range, we're done. -*/ -if (xfs_dir2_dataptr_to_db (mp, ctx->pos) > mp->m_dirdatablk) -return 0 ; - -/* -* Precalculate offsets for . and .. as we will always need them. -* -* XXX(hch): the second argument is sometimes 0 and sometimes -* mp->m_dirdatablk. -*/ - dot_offset =xfs_dir2_db_off_to_dataptr (mp, mp->m_dirdatablk, -XFS_DIR3_DATA_DOT_OFFSET (mp)); - dotdot_offset =xfs_dir2_db_off_to_dataptr (mp, mp->m_dirdatablk, -XFS_DIR3_DATA_DOTDOT_OFFSET (mp)); - -/* -* Put . entry unless we're starting past it. -*/ -if (ctx->pos <= dot_offset) { - ctx->pos = dot_offset &0x7fffffff ; -if (!dir_emit (ctx,"." ,1 , dp->i_ino,DT_DIR )) -return 0 ; - } - -/* -* Put .. entry unless we're starting past it. -*/ -if (ctx->pos <= dotdot_offset) { - ino =xfs_dir2_sf_get_parent_ino (sfp); - ctx->pos = dotdot_offset &0x7fffffff ; -if (!dir_emit (ctx,".." ,2 , ino,DT_DIR )) -return 0 ; - } - -/* -* Loop while there are more entries and put'ing works. -*/ - sfep =xfs_dir2_sf_firstentry (sfp); -for (i =0 ; i < sfp->count; i++) { - off =xfs_dir2_db_off_to_dataptr (mp, mp->m_dirdatablk, -xfs_dir2_sf_get_offset (sfep)); - -if (ctx->pos > off) { - sfep =xfs_dir2_sf_nextentry (sfp, sfep); -continue ; - } - - ino =xfs_dir2_sfe_get_ino (sfp, sfep); - ctx->pos = off &0x7fffffff ; -if (!dir_emit (ctx, (char *)sfep->name, sfep->namelen, - ino,DT_UNKNOWN )) -return 0 ; - sfep =xfs_dir2_sf_nextentry (sfp, sfep);
fs/xfs/xfs_dir2_sf.c xfs_dir2_sf_create( · line 770
Quoted 10 lines
fs/xfs/xfs_dir2_sf.c +0
-7- } - - ctx->pos =xfs_dir2_db_off_to_dataptr (mp, mp->m_dirdatablk +1 ,0 ) & -0x7fffffff ; -return 0 ; -} -/* * Lookup an entry in a shortform directory. * Returns EEXIST if found, ENOENT if not found.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 16/49 xfs: reshuffle dir2 definitions around for userspace
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Many of the definitions within xfs_dir2_priv.h are needed in userspace outside libxfs. Definitions within xfs_dir2_priv.h are wholly contained within libxfs, so we need to shuffle some of the definitions around to keep consistency across files shared between user and kernel space.
--- fs/xfs/xfs_bmap.c | 3 ++- fs/xfs/xfs_da_btree.c | 2 +- fs/xfs/xfs_dir2.c | 2 +- fs/xfs/xfs_dir2.h | 51 +++++++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_dir2_block.c | 2 +- fs/xfs/xfs_dir2_data.c | 6 ++---- fs/xfs/xfs_dir2_leaf.c | 1 + fs/xfs/xfs_dir2_node.c | 1 + fs/xfs/xfs_dir2_priv.h | 31 ---------------------------- fs/xfs/xfs_dir2_readdir.c | 1 + fs/xfs/xfs_dir2_sf.c | 6 +++--- fs/xfs/xfs_export.c | 4 +++- fs/xfs/xfs_file.c | 2 +- fs/xfs/xfs_icreate_item.c | 12 ----------- fs/xfs/xfs_log_recover.c | 2 +- fs/xfs/xfs_mount.c | 4 +++- fs/xfs/xfs_rename.c | 3 ++- fs/xfs/xfs_rtalloc.c | 1 - fs/xfs/xfs_super.c | 3 ++- fs/xfs/xfs_symlink.c | 3 ++- fs/xfs/xfs_utils.c | 4 +++- fs/xfs/xfs_vnodeops.c | 3 ++- 22 files changed, 83 insertions(+), 64 deletions(-)
fs/xfs/xfs_bmap.c +2 -1
@@ -24,9 +24,10 @@#include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h" -#include "xfs_dir2.h" #include "xfs_mount.h" #include "xfs_da_btree.h" +#include "xfs_dir2_format.h" +#include "xfs_dir2.h" #include "xfs_bmap_btree.h" #include "xfs_alloc_btree.h" #include "xfs_ialloc_btree.h"
fs/xfs/xfs_da_btree.c +1 -1
@@ -27,8 +27,8 @@#include "xfs_mount.h" #include "xfs_da_btree.h" #include "xfs_bmap_btree.h" -#include "xfs_dir2.h" #include "xfs_dir2_format.h" +#include "xfs_dir2.h" #include "xfs_dir2_priv.h" #include "xfs_dinode.h" #include "xfs_inode.h"
fs/xfs/xfs_dir2.c +1 -1
@@ -31,8 +31,8 @@#include "xfs_inode.h" #include "xfs_inode_item.h" #include "xfs_bmap.h" -#include "xfs_dir2.h" #include "xfs_dir2_format.h" +#include "xfs_dir2.h" #include "xfs_dir2_priv.h" #include "xfs_error.h" #include "xfs_vnodeops.h"
fs/xfs/xfs_dir2.h +51 -0
61 lines not on this page · raw message
fs/xfs/xfs_dir2_block.c +1 -1
@@ -31,8 +31,8 @@#include "xfs_inode_item.h" #include "xfs_bmap.h" #include "xfs_buf_item.h" -#include "xfs_dir2.h" #include "xfs_dir2_format.h" +#include "xfs_dir2.h" #include "xfs_dir2_priv.h" #include "xfs_error.h" #include "xfs_trace.h"
fs/xfs/xfs_dir2_data.c +2 -4
@@ -29,14 +29,12 @@#include "xfs_dinode.h" #include "xfs_inode.h" #include "xfs_dir2_format.h" +#include "xfs_dir2.h" #include "xfs_dir2_priv.h" #include "xfs_error.h" #include "xfs_buf_item.h" #include "xfs_cksum.h" -STATIC xfs_dir2_data_free_t * -xfs_dir2_data_freefind (xfs_dir2_data_hdr_t *hdr, xfs_dir2_data_unused_t *dup); -/* * Check the consistency of the data block. * The input can also be a block-format directory.
@@ -325,7 +323,7 @@ xfs_dir3_data_readahead(* Given a data block and an unused entry from that block, * return the bestfree entry if any that corresponds to it. */ -STATIC xfs_dir2_data_free_t * +xfs_dir2_data_free_t *xfs_dir2_data_freefind (xfs_dir2_data_hdr_t *hdr,/* data block */ xfs_dir2_data_unused_t *dup)/* data unused entry */
fs/xfs/xfs_dir2_leaf.c +1 -0
@@ -31,6 +31,7 @@#include "xfs_inode.h" #include "xfs_bmap.h" #include "xfs_dir2_format.h" +#include "xfs_dir2.h" #include "xfs_dir2_priv.h" #include "xfs_error.h" #include "xfs_trace.h"
fs/xfs/xfs_dir2_node.c +1 -0
@@ -30,6 +30,7 @@#include "xfs_inode.h" #include "xfs_bmap.h" #include "xfs_dir2_format.h" +#include "xfs_dir2.h" #include "xfs_dir2_priv.h" #include "xfs_error.h" #include "xfs_trace.h"
fs/xfs/xfs_dir2_priv.h +0 -31
@@ -20,18 +20,12 @@/* xfs_dir2.c */ extern int xfs_dir_ino_validate (struct xfs_mount *mp,xfs_ino_t ino); -extern int xfs_dir2_isblock (struct xfs_trans *tp,struct xfs_inode *dp,int *r); -extern int xfs_dir2_isleaf (struct xfs_trans *tp,struct xfs_inode *dp,int *r);extern int xfs_dir2_grow_inode (struct xfs_da_args *args,int space,xfs_dir2_db_t *dbp); -extern int xfs_dir2_shrink_inode (struct xfs_da_args *args,xfs_dir2_db_t db, -struct xfs_buf *bp);extern int xfs_dir_cilookup_result (struct xfs_da_args *args,const unsigned char *name,int len);/* xfs_dir2_block.c */ -extern const struct xfs_buf_ops xfs_dir3_block_buf_ops; -extern int xfs_dir3_block_read (struct xfs_trans *tp,struct xfs_inode *dp,struct xfs_buf **bpp);extern int xfs_dir2_block_addname (struct xfs_da_args *args);
@@ -48,39 +42,17 @@ extern int xfs_dir2_leaf_to_block(struct xfs_da_args *args,#define xfs_dir3_data_check (dp,bp)#endif -extern const struct xfs_buf_ops xfs_dir3_data_buf_ops; -extern const struct xfs_buf_ops xfs_dir3_free_buf_ops; -extern int __xfs_dir3_data_check (struct xfs_inode *dp,struct xfs_buf *bp);extern int xfs_dir3_data_read (struct xfs_trans *tp,struct xfs_inode *dp,xfs_dablk_t bno,xfs_daddr_t mapped_bno,struct xfs_buf **bpp); -extern int xfs_dir3_data_readahead (struct xfs_trans *tp,struct xfs_inode *dp, -xfs_dablk_t bno,xfs_daddr_t mapped_bno);extern struct xfs_dir2_data_free *xfs_dir2_data_freeinsert (struct xfs_dir2_data_hdr *hdr,struct xfs_dir2_data_unused *dup,int *loghead); -extern void xfs_dir2_data_freescan (struct xfs_mount *mp, -struct xfs_dir2_data_hdr *hdr,int *loghead);extern int xfs_dir3_data_init (struct xfs_da_args *args,xfs_dir2_db_t blkno,struct xfs_buf **bpp); -extern void xfs_dir2_data_log_entry (struct xfs_trans *tp,struct xfs_buf *bp, -struct xfs_dir2_data_entry *dep); -extern void xfs_dir2_data_log_header (struct xfs_trans *tp, -struct xfs_buf *bp); -extern void xfs_dir2_data_log_unused (struct xfs_trans *tp,struct xfs_buf *bp, -struct xfs_dir2_data_unused *dup); -extern void xfs_dir2_data_make_free (struct xfs_trans *tp,struct xfs_buf *bp, -xfs_dir2_data_aoff_t offset,xfs_dir2_data_aoff_t len, -int *needlogp,int *needscanp); -extern void xfs_dir2_data_use_free (struct xfs_trans *tp,struct xfs_buf *bp, -struct xfs_dir2_data_unused *dup,xfs_dir2_data_aoff_t offset, -xfs_dir2_data_aoff_t len,int *needlogp,int *needscanp);/* xfs_dir2_leaf.c */ -extern const struct xfs_buf_ops xfs_dir3_leaf1_buf_ops; -extern const struct xfs_buf_ops xfs_dir3_leafn_buf_ops; -extern int xfs_dir3_leafn_read (struct xfs_trans *tp,struct xfs_inode *dp,xfs_dablk_t fbno,xfs_daddr_t mappedbno,struct xfs_buf **bpp); extern int xfs_dir2_block_to_leaf(struct xfs_da_args *args,
@@ -142,9 +114,6 @@ extern int xfs_dir2_free_read(struct xfs_trans *tp, struct xfs_inode *dp, xfs_dablk_t fbno, struct xfs_buf **bpp);/* xfs_dir2_sf.c */ -extern xfs_ino_t xfs_dir2_sf_get_parent_ino (struct xfs_dir2_sf_hdr *sfp); -extern xfs_ino_t xfs_dir2_sfe_get_ino (struct xfs_dir2_sf_hdr *sfp, -struct xfs_dir2_sf_entry *sfep);extern int xfs_dir2_block_sfsize (struct xfs_inode *dp,struct xfs_dir2_data_hdr *block,struct xfs_dir2_sf_hdr *sfhp); extern int xfs_dir2_block_to_sf(struct xfs_da_args *args, struct xfs_buf *bp,
fs/xfs/xfs_dir2_readdir.c +1 -0
@@ -30,6 +30,7 @@#include "xfs_dinode.h" #include "xfs_inode.h" #include "xfs_dir2_format.h" +#include "xfs_dir2.h" #include "xfs_dir2_priv.h" #include "xfs_error.h" #include "xfs_trace.h"
fs/xfs/xfs_dir2_sf.c +3 -3
@@ -29,8 +29,8 @@#include "xfs_inode.h" #include "xfs_inode_item.h" #include "xfs_error.h" -#include "xfs_dir2.h" #include "xfs_dir2_format.h" +#include "xfs_dir2.h" #include "xfs_dir2_priv.h" #include "xfs_trace.h"
@@ -95,7 +95,7 @@ xfs_dir2_sf_get_parent_ino(return xfs_dir2_sf_get_ino (hdr, &hdr->parent); } -static void +void xfs_dir2_sf_put_parent_ino (struct xfs_dir2_sf_hdr *hdr,xfs_ino_t ino)
@@ -123,7 +123,7 @@ xfs_dir2_sfe_get_ino(return xfs_dir2_sf_get_ino (hdr,xfs_dir2_sfe_inop (sfep)); } -static void +void xfs_dir2_sfe_put_ino( struct xfs_dir2_sf_hdr *hdr, struct xfs_dir2_sf_entry *sfep,
fs/xfs/xfs_export.c +3 -1
@@ -21,8 +21,10 @@#include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h" -#include "xfs_dir2.h" #include "xfs_mount.h" +#include "xfs_da_btree.h" +#include "xfs_dir2_format.h" +#include "xfs_dir2.h" #include "xfs_export.h" #include "xfs_vnodeops.h" #include "xfs_bmap_btree.h"
fs/xfs/xfs_file.c +1 -1
@@ -32,7 +32,7 @@#include "xfs_vnodeops.h" #include "xfs_da_btree.h" #include "xfs_dir2_format.h" -#include "xfs_dir2_priv.h" +#include "xfs_dir2.h" #include "xfs_ioctl.h" #include "xfs_trace.h"
fs/xfs/xfs_icreate_item.c +0 -12
@@ -20,23 +20,11 @@#include "xfs_types.h" #include "xfs_bit.h" #include "xfs_log.h" -#include "xfs_inum.h" #include "xfs_trans.h" -#include "xfs_buf_item.h" #include "xfs_sb.h" #include "xfs_ag.h" -#include "xfs_dir2.h" #include "xfs_mount.h" #include "xfs_trans_priv.h" -#include "xfs_bmap_btree.h" -#include "xfs_alloc_btree.h" -#include "xfs_ialloc_btree.h" -#include "xfs_attr_sf.h" -#include "xfs_dinode.h" -#include "xfs_inode.h" -#include "xfs_inode_item.h" -#include "xfs_btree.h" -#include "xfs_ialloc.h" #include "xfs_error.h" #include "xfs_icreate_item.h"
fs/xfs/xfs_log_recover.c +1 -1
@@ -51,7 +51,7 @@#include "xfs_symlink.h" #include "xfs_da_btree.h" #include "xfs_dir2_format.h" -#include "xfs_dir2_priv.h" +#include "xfs_dir2.h" #include "xfs_attr_leaf.h" #include "xfs_attr_remote.h"
fs/xfs/xfs_mount.c +3 -1
@@ -25,8 +25,10 @@#include "xfs_trans_priv.h" #include "xfs_sb.h" #include "xfs_ag.h" -#include "xfs_dir2.h" #include "xfs_mount.h" +#include "xfs_da_btree.h" +#include "xfs_dir2_format.h" +#include "xfs_dir2.h" #include "xfs_bmap_btree.h" #include "xfs_alloc_btree.h" #include "xfs_ialloc_btree.h"
fs/xfs/xfs_rename.c +2 -1
@@ -22,9 +22,10 @@#include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h" -#include "xfs_dir2.h" #include "xfs_mount.h" #include "xfs_da_btree.h" +#include "xfs_dir2_format.h" +#include "xfs_dir2.h" #include "xfs_bmap_btree.h" #include "xfs_dinode.h" #include "xfs_inode.h"
fs/xfs/xfs_rtalloc.c +0 -1
@@ -23,7 +23,6 @@#include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h" -#include "xfs_dir2.h" #include "xfs_mount.h" #include "xfs_bmap_btree.h" #include "xfs_dinode.h"
fs/xfs/xfs_super.c +2 -1
@@ -23,7 +23,6 @@#include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h" -#include "xfs_dir2.h" #include "xfs_alloc.h" #include "xfs_quota.h" #include "xfs_mount.h"
@@ -47,6 +46,8 @@#include "xfs_trans_priv.h" #include "xfs_filestream.h" #include "xfs_da_btree.h" +#include "xfs_dir2_format.h" +#include "xfs_dir2.h" #include "xfs_extfree_item.h" #include "xfs_mru_cache.h" #include "xfs_inode_item.h"
fs/xfs/xfs_symlink.c +2 -1
@@ -24,9 +24,10 @@#include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h" -#include "xfs_dir2.h" #include "xfs_mount.h" #include "xfs_da_btree.h" +#include "xfs_dir2_format.h" +#include "xfs_dir2.h" #include "xfs_bmap_btree.h" #include "xfs_ialloc_btree.h" #include "xfs_dinode.h"
fs/xfs/xfs_utils.c +3 -1
@@ -22,8 +22,10 @@#include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h" -#include "xfs_dir2.h" #include "xfs_mount.h" +#include "xfs_da_btree.h" +#include "xfs_dir2_format.h" +#include "xfs_dir2.h" #include "xfs_bmap_btree.h" #include "xfs_dinode.h" #include "xfs_inode.h"
fs/xfs/xfs_vnodeops.c +2 -1
@@ -25,9 +25,10 @@#include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h" -#include "xfs_dir2.h" #include "xfs_mount.h" #include "xfs_da_btree.h" +#include "xfs_dir2_format.h" +#include "xfs_dir2.h" #include "xfs_bmap_btree.h" #include "xfs_ialloc_btree.h" #include "xfs_dinode.h"
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 16/49] xfs: reshuffle dir2 definitions around for userspace
Quoted 10 lines · Dave Chinner
From: Dave Chinner <[email protected]>
Many of the definitions within
xfs_dir2_priv.hare needed in userspace outside libxfs. Definitions withinxfs_dir2_priv.hare wholly contained within libxfs, so we need to shuffle some of the definitions around to keep consistency across files shared between user and kernel space.Signed-off-by Dave Chinner <[email protected]>---
xfs_dir2_data_freefind(), xfs_dir2_sf_put_parent_ino(), xfs_dir2_sfe_put_ino() all go non-static, and some header fixups (compile tested):
Quoted 493 lines
fs/xfs/xfs_bmap.c | 3 ++- fs/xfs/xfs_da_btree.c | 2 +- fs/xfs/xfs_dir2.c | 2 +- fs/xfs/xfs_dir2.h | 51 +++++++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_dir2_block.c | 2 +- fs/xfs/xfs_dir2_data.c | 6 ++---- fs/xfs/xfs_dir2_leaf.c | 1 + fs/xfs/xfs_dir2_node.c | 1 + fs/xfs/xfs_dir2_priv.h | 31 ---------------------------- fs/xfs/xfs_dir2_readdir.c | 1 + fs/xfs/xfs_dir2_sf.c | 6 +++--- fs/xfs/xfs_export.c | 4 +++- fs/xfs/xfs_file.c | 2 +- fs/xfs/xfs_icreate_item.c | 12 ----------- fs/xfs/xfs_log_recover.c | 2 +- fs/xfs/xfs_mount.c | 4 +++- fs/xfs/xfs_rename.c | 3 ++- fs/xfs/xfs_rtalloc.c | 1 - fs/xfs/xfs_super.c | 3 ++- fs/xfs/xfs_symlink.c | 3 ++- fs/xfs/xfs_utils.c | 4 +++- fs/xfs/xfs_vnodeops.c | 3 ++- 22 files changed, 83 insertions(+), 64 deletions(-)fs/xfs/xfs_bmap.c +2
-1@@ -24,9 +24,10 @@#include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h" -#include "xfs_dir2.h" #include "xfs_mount.h" #include "xfs_da_btree.h" +#include "xfs_dir2_format.h" +#include "xfs_dir2.h" #include "xfs_bmap_btree.h" #include "xfs_alloc_btree.h" #include "xfs_ialloc_btree.h" fs/xfs/xfs_da_btree.c +1
-1@@ -27,8 +27,8 @@#include "xfs_mount.h" #include "xfs_da_btree.h" #include "xfs_bmap_btree.h" -#include "xfs_dir2.h" #include "xfs_dir2_format.h" +#include "xfs_dir2.h" #include "xfs_dir2_priv.h" #include "xfs_dinode.h" #include "xfs_inode.h" fs/xfs/xfs_dir2.c +1
-1@@ -31,8 +31,8 @@#include "xfs_inode.h" #include "xfs_inode_item.h" #include "xfs_bmap.h" -#include "xfs_dir2.h" #include "xfs_dir2_format.h" +#include "xfs_dir2.h" #include "xfs_dir2_priv.h" #include "xfs_error.h" #include "xfs_vnodeops.h" fs/xfs/xfs_dir2.h +51
-0@@ -23,6 +23,11 @@ struct xfs_da_args;struct xfs_inode ;struct xfs_mount ;struct xfs_trans ; +struct xfs_dir2_sf_hdr ; +struct xfs_dir2_sf_entry ; +struct xfs_dir2_data_hdr ; +struct xfs_dir2_data_entry ; +struct xfs_dir2_data_unused ;extern struct xfs_name xfs_name_dotdot;@@ -57,4 +62,50 @@ extern int xfs_dir_canenter(struct xfs_trans *tp, struct xfs_inode *dp,*/ extern int xfs_dir2_sf_to_block (struct xfs_da_args *args); +/* +* Direct call on directory open, before entering the readdir code. +*/ +extern int xfs_dir3_data_readahead (struct xfs_trans *tp,struct xfs_inode *dp, +xfs_dablk_t bno,xfs_daddr_t mapped_bno); + +/* +* Interface routines used by userspace utilities +*/ +extern xfs_ino_t xfs_dir2_sf_get_parent_ino (struct xfs_dir2_sf_hdr *sfp); +extern void xfs_dir2_sf_put_parent_ino (struct xfs_dir2_sf_hdr *sfp, +xfs_ino_t ino); +extern xfs_ino_t xfs_dir2_sfe_get_ino (struct xfs_dir2_sf_hdr *sfp, +struct xfs_dir2_sf_entry *sfep); +extern void xfs_dir2_sfe_put_ino (struct xfs_dir2_sf_hdr *, +struct xfs_dir2_sf_entry *sfep,xfs_ino_t ino); + +extern int xfs_dir2_isblock (struct xfs_trans *tp,struct xfs_inode *dp,int *r); +extern int xfs_dir2_isleaf (struct xfs_trans *tp,struct xfs_inode *dp,int *r); +extern int xfs_dir2_shrink_inode (struct xfs_da_args *args,xfs_dir2_db_t db, +struct xfs_buf *bp); + +extern void xfs_dir2_data_freescan (struct xfs_mount *mp, +struct xfs_dir2_data_hdr *hdr,int *loghead); +extern void xfs_dir2_data_log_entry (struct xfs_trans *tp,struct xfs_buf *bp, +struct xfs_dir2_data_entry *dep); +extern void xfs_dir2_data_log_header (struct xfs_trans *tp, +struct xfs_buf *bp); +extern void xfs_dir2_data_log_unused (struct xfs_trans *tp,struct xfs_buf *bp, +struct xfs_dir2_data_unused *dup); +extern void xfs_dir2_data_make_free (struct xfs_trans *tp,struct xfs_buf *bp, +xfs_dir2_data_aoff_t offset,xfs_dir2_data_aoff_t len, +int *needlogp,int *needscanp); +extern void xfs_dir2_data_use_free (struct xfs_trans *tp,struct xfs_buf *bp, +struct xfs_dir2_data_unused *dup,xfs_dir2_data_aoff_t offset, +xfs_dir2_data_aoff_t len,int *needlogp,int *needscanp); + +extern struct xfs_dir2_data_free *xfs_dir2_data_freefind ( +struct xfs_dir2_data_hdr *hdr,struct xfs_dir2_data_unused *dup); + +extern const struct xfs_buf_ops xfs_dir3_block_buf_ops; +extern const struct xfs_buf_ops xfs_dir3_leafn_buf_ops; +extern const struct xfs_buf_ops xfs_dir3_leaf1_buf_ops; +extern const struct xfs_buf_ops xfs_dir3_free_buf_ops; +extern const struct xfs_buf_ops xfs_dir3_data_buf_ops; +#endif /* __XFS_DIR2_H__ */ fs/xfs/xfs_dir2_block.c +1
-1@@ -31,8 +31,8 @@#include "xfs_inode_item.h" #include "xfs_bmap.h" #include "xfs_buf_item.h" -#include "xfs_dir2.h" #include "xfs_dir2_format.h" +#include "xfs_dir2.h" #include "xfs_dir2_priv.h" #include "xfs_error.h" #include "xfs_trace.h" fs/xfs/xfs_dir2_data.c +2
-4@@ -29,14 +29,12 @@#include "xfs_dinode.h" #include "xfs_inode.h" #include "xfs_dir2_format.h" +#include "xfs_dir2.h" #include "xfs_dir2_priv.h" #include "xfs_error.h" #include "xfs_buf_item.h" #include "xfs_cksum.h" -STATIC xfs_dir2_data_free_t * -xfs_dir2_data_freefind (xfs_dir2_data_hdr_t *hdr, xfs_dir2_data_unused_t *dup); -/* * Check the consistency of the data block. * The input can also be a block-format directory. @@ -325,7 +323,7 @@ xfs_dir3_data_readahead(* Given a data block and an unused entry from that block, * return the bestfree entry if any that corresponds to it. */ -STATIC xfs_dir2_data_free_t * +xfs_dir2_data_free_t *xfs_dir2_data_freefind (xfs_dir2_data_hdr_t *hdr,/* data block */ xfs_dir2_data_unused_t *dup)/* data unused entry */ fs/xfs/xfs_dir2_leaf.c +1
-0@@ -31,6 +31,7 @@#include "xfs_inode.h" #include "xfs_bmap.h" #include "xfs_dir2_format.h" +#include "xfs_dir2.h" #include "xfs_dir2_priv.h" #include "xfs_error.h" #include "xfs_trace.h" fs/xfs/xfs_dir2_node.c +1
-0@@ -30,6 +30,7 @@#include "xfs_inode.h" #include "xfs_bmap.h" #include "xfs_dir2_format.h" +#include "xfs_dir2.h" #include "xfs_dir2_priv.h" #include "xfs_error.h" #include "xfs_trace.h" fs/xfs/xfs_dir2_priv.h +0
-31@@ -20,18 +20,12 @@/* xfs_dir2.c */ extern int xfs_dir_ino_validate (struct xfs_mount *mp,xfs_ino_t ino); -extern int xfs_dir2_isblock (struct xfs_trans *tp,struct xfs_inode *dp,int *r); -extern int xfs_dir2_isleaf (struct xfs_trans *tp,struct xfs_inode *dp,int *r);extern int xfs_dir2_grow_inode (struct xfs_da_args *args,int space,xfs_dir2_db_t *dbp); -extern int xfs_dir2_shrink_inode (struct xfs_da_args *args,xfs_dir2_db_t db, -struct xfs_buf *bp);extern int xfs_dir_cilookup_result (struct xfs_da_args *args,const unsigned char *name,int len);/* xfs_dir2_block.c */ -extern const struct xfs_buf_ops xfs_dir3_block_buf_ops; -extern int xfs_dir3_block_read (struct xfs_trans *tp,struct xfs_inode *dp,struct xfs_buf **bpp);extern int xfs_dir2_block_addname (struct xfs_da_args *args);@@ -48,39 +42,17 @@ extern int xfs_dir2_leaf_to_block(struct xfs_da_args *args,#define xfs_dir3_data_check (dp,bp)#endif -extern const struct xfs_buf_ops xfs_dir3_data_buf_ops; -extern const struct xfs_buf_ops xfs_dir3_free_buf_ops; -extern int __xfs_dir3_data_check (struct xfs_inode *dp,struct xfs_buf *bp);extern int xfs_dir3_data_read (struct xfs_trans *tp,struct xfs_inode *dp,xfs_dablk_t bno,xfs_daddr_t mapped_bno,struct xfs_buf **bpp); -extern int xfs_dir3_data_readahead (struct xfs_trans *tp,struct xfs_inode *dp, -xfs_dablk_t bno,xfs_daddr_t mapped_bno);extern struct xfs_dir2_data_free *xfs_dir2_data_freeinsert (struct xfs_dir2_data_hdr *hdr,struct xfs_dir2_data_unused *dup,int *loghead); -extern void xfs_dir2_data_freescan (struct xfs_mount *mp, -struct xfs_dir2_data_hdr *hdr,int *loghead);extern int xfs_dir3_data_init (struct xfs_da_args *args,xfs_dir2_db_t blkno,struct xfs_buf **bpp); -extern void xfs_dir2_data_log_entry (struct xfs_trans *tp,struct xfs_buf *bp, -struct xfs_dir2_data_entry *dep); -extern void xfs_dir2_data_log_header (struct xfs_trans *tp, -struct xfs_buf *bp); -extern void xfs_dir2_data_log_unused (struct xfs_trans *tp,struct xfs_buf *bp, -struct xfs_dir2_data_unused *dup); -extern void xfs_dir2_data_make_free (struct xfs_trans *tp,struct xfs_buf *bp, -xfs_dir2_data_aoff_t offset,xfs_dir2_data_aoff_t len, -int *needlogp,int *needscanp); -extern void xfs_dir2_data_use_free (struct xfs_trans *tp,struct xfs_buf *bp, -struct xfs_dir2_data_unused *dup,xfs_dir2_data_aoff_t offset, -xfs_dir2_data_aoff_t len,int *needlogp,int *needscanp);/* xfs_dir2_leaf.c */ -extern const struct xfs_buf_ops xfs_dir3_leaf1_buf_ops; -extern const struct xfs_buf_ops xfs_dir3_leafn_buf_ops; -extern int xfs_dir3_leafn_read (struct xfs_trans *tp,struct xfs_inode *dp,xfs_dablk_t fbno,xfs_daddr_t mappedbno,struct xfs_buf **bpp); extern int xfs_dir2_block_to_leaf(struct xfs_da_args *args,@@ -142,9 +114,6 @@ extern int xfs_dir2_free_read(struct xfs_trans *tp, struct xfs_inode *dp, xfs_dablk_t fbno, struct xfs_buf **bpp);/* xfs_dir2_sf.c */ -extern xfs_ino_t xfs_dir2_sf_get_parent_ino (struct xfs_dir2_sf_hdr *sfp); -extern xfs_ino_t xfs_dir2_sfe_get_ino (struct xfs_dir2_sf_hdr *sfp, -struct xfs_dir2_sf_entry *sfep);extern int xfs_dir2_block_sfsize (struct xfs_inode *dp,struct xfs_dir2_data_hdr *block,struct xfs_dir2_sf_hdr *sfhp); extern int xfs_dir2_block_to_sf(struct xfs_da_args *args, struct xfs_buf *bp,fs/xfs/xfs_dir2_readdir.c +1
-0@@ -30,6 +30,7 @@#include "xfs_dinode.h" #include "xfs_inode.h" #include "xfs_dir2_format.h" +#include "xfs_dir2.h" #include "xfs_dir2_priv.h" #include "xfs_error.h" #include "xfs_trace.h" fs/xfs/xfs_dir2_sf.c +3
-3@@ -29,8 +29,8 @@#include "xfs_inode.h" #include "xfs_inode_item.h" #include "xfs_error.h" -#include "xfs_dir2.h" #include "xfs_dir2_format.h" +#include "xfs_dir2.h" #include "xfs_dir2_priv.h" #include "xfs_trace.h" @@ -95,7 +95,7 @@ xfs_dir2_sf_get_parent_ino(return xfs_dir2_sf_get_ino (hdr, &hdr->parent); } -static void +void xfs_dir2_sf_put_parent_ino (struct xfs_dir2_sf_hdr *hdr,xfs_ino_t ino)@@ -123,7 +123,7 @@ xfs_dir2_sfe_get_ino(return xfs_dir2_sf_get_ino (hdr,xfs_dir2_sfe_inop (sfep)); } -static void +void xfs_dir2_sfe_put_ino( struct xfs_dir2_sf_hdr *hdr, struct xfs_dir2_sf_entry *sfep,fs/xfs/xfs_export.c +3
-1@@ -21,8 +21,10 @@#include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h" -#include "xfs_dir2.h" #include "xfs_mount.h" +#include "xfs_da_btree.h" +#include "xfs_dir2_format.h" +#include "xfs_dir2.h" #include "xfs_export.h" #include "xfs_vnodeops.h" #include "xfs_bmap_btree.h" fs/xfs/xfs_file.c +1
-1@@ -32,7 +32,7 @@#include "xfs_vnodeops.h" #include "xfs_da_btree.h" #include "xfs_dir2_format.h" -#include "xfs_dir2_priv.h" +#include "xfs_dir2.h" #include "xfs_ioctl.h" #include "xfs_trace.h" fs/xfs/xfs_icreate_item.c +0
-12@@ -20,23 +20,11 @@#include "xfs_types.h" #include "xfs_bit.h" #include "xfs_log.h" -#include "xfs_inum.h" #include "xfs_trans.h" -#include "xfs_buf_item.h" #include "xfs_sb.h" #include "xfs_ag.h" -#include "xfs_dir2.h" #include "xfs_mount.h" #include "xfs_trans_priv.h" -#include "xfs_bmap_btree.h" -#include "xfs_alloc_btree.h" -#include "xfs_ialloc_btree.h" -#include "xfs_attr_sf.h" -#include "xfs_dinode.h" -#include "xfs_inode.h" -#include "xfs_inode_item.h" -#include "xfs_btree.h" -#include "xfs_ialloc.h" #include "xfs_error.h" #include "xfs_icreate_item.h" fs/xfs/xfs_log_recover.c +1
-1@@ -51,7 +51,7 @@#include "xfs_symlink.h" #include "xfs_da_btree.h" #include "xfs_dir2_format.h" -#include "xfs_dir2_priv.h" +#include "xfs_dir2.h" #include "xfs_attr_leaf.h" #include "xfs_attr_remote.h" fs/xfs/xfs_mount.c +3
-1@@ -25,8 +25,10 @@#include "xfs_trans_priv.h" #include "xfs_sb.h" #include "xfs_ag.h" -#include "xfs_dir2.h" #include "xfs_mount.h" +#include "xfs_da_btree.h" +#include "xfs_dir2_format.h" +#include "xfs_dir2.h" #include "xfs_bmap_btree.h" #include "xfs_alloc_btree.h" #include "xfs_ialloc_btree.h" fs/xfs/xfs_rename.c +2
-1@@ -22,9 +22,10 @@#include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h" -#include "xfs_dir2.h" #include "xfs_mount.h" #include "xfs_da_btree.h" +#include "xfs_dir2_format.h" +#include "xfs_dir2.h" #include "xfs_bmap_btree.h" #include "xfs_dinode.h" #include "xfs_inode.h" fs/xfs/xfs_rtalloc.c +0
-1@@ -23,7 +23,6 @@#include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h" -#include "xfs_dir2.h" #include "xfs_mount.h" #include "xfs_bmap_btree.h" #include "xfs_dinode.h" fs/xfs/xfs_super.c +2
-1@@ -23,7 +23,6 @@#include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h" -#include "xfs_dir2.h" #include "xfs_alloc.h" #include "xfs_quota.h" #include "xfs_mount.h" @@ -47,6 +46,8 @@#include "xfs_trans_priv.h" #include "xfs_filestream.h" #include "xfs_da_btree.h" +#include "xfs_dir2_format.h" +#include "xfs_dir2.h" #include "xfs_extfree_item.h" #include "xfs_mru_cache.h" #include "xfs_inode_item.h" fs/xfs/xfs_symlink.c +2
-1@@ -24,9 +24,10 @@#include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h" -#include "xfs_dir2.h" #include "xfs_mount.h" #include "xfs_da_btree.h" +#include "xfs_dir2_format.h" +#include "xfs_dir2.h" #include "xfs_bmap_btree.h" #include "xfs_ialloc_btree.h" #include "xfs_dinode.h" fs/xfs/xfs_utils.c +3
-1@@ -22,8 +22,10 @@#include "xfs_trans.h" #include "xfs_sb.h" #include "xfs_ag.h" -#include "xfs_dir2.h" #include "xfs_mount.h" +#include "xfs_da_btree.h" +#include "xfs_dir2_format.h" +#include "xfs_dir2.h" #include "xfs_bmap_btree.h" #include "xfs_dinode.h" #include "xfs_inode.h" fs/xfs/xfs_vnodeops.c +0
-0@@ -25,9 +25,10 @@#include "xfs_trans.h"
fs/xfs/xfs_vnodeops.c line 34
Quoted 10 lines
fs/xfs/xfs_vnodeops.c +2
-1#include "xfs_sb.h" #include "xfs_ag.h" -#include "xfs_dir2.h" #include "xfs_mount.h" #include "xfs_da_btree.h" +#include "xfs_dir2_format.h" +#include "xfs_dir2.h" #include "xfs_bmap_btree.h" #include "xfs_ialloc_btree.h" #include "xfs_dinode.h"
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 17/49 xfs: split out attribute listing code into separate file
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The attribute listing code is not used by userspace, so like the directory readdir code, split it out into a separate file to minimise the differences between the filesystem shared with libxfs in userspace.
--- fs/xfs/Makefile | 1 + fs/xfs/xfs_attr.c | 317 +----------------------- fs/xfs/xfs_attr.h | 1 + fs/xfs/xfs_attr_leaf.c | 300 ---------------------- fs/xfs/xfs_attr_list.c | 655 +++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 658 insertions(+), 616 deletions(-) create mode 100644 fs/xfs/xfs_attr_list.c
fs/xfs/Makefile +1 -0
@@ -27,6 +27,7 @@ xfs-y += xfs_trace.o # highlevel code xfs-y += xfs_aops.o \ + xfs_attr_list.o \ xfs_bit.o \ xfs_buf.o \ xfs_dfrag.o \
fs/xfs/xfs_attr.c +1 -316
350 lines not on this page · raw message
fs/xfs/xfs_attr.h +1 -0
@@ -141,5 +141,6 @@ typedef struct xfs_attr_list_context {*/ int xfs_attr_inactive (struct xfs_inode *dp);int xfs_attr_list_int (struct xfs_attr_list_context *); +int xfs_inode_hasattr (struct xfs_inode *ip);#endif /* __XFS_ATTR_H__ */
fs/xfs/xfs_attr_leaf.c +0 -300
312 lines not on this page · raw message
fs/xfs/xfs_attr_list.c new file +655 -0
655 lines not on this page · raw message
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 17/49] xfs: split out attribute listing code into separate file
Quoted 9 lines · Dave Chinner
From: Dave Chinner<[email protected]>
The attribute listing code is not used by userspace, so like the directory readdir code, split it out into a separate file to minimise the differences between the filesystem shared with libxfs in userspace.
Signed-off-by Dave Chinner<[email protected]>---
Looks good.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 18/49 xfs: split out attribute fork truncation code into separate file
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The attribute inactivation code is not used by userspace, so like the attribute listing, split it out into a separate file to minimise the differences between the filesystem shared with libxfs in userspace.
--- fs/xfs/Makefile | 1 + fs/xfs/xfs_attr.c | 71 ------- fs/xfs/xfs_attr_inactive.c | 454 +++++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_attr_leaf.c | 352 ----------------------------------- 4 files changed, 455 insertions(+), 423 deletions(-) create mode 100644 fs/xfs/xfs_attr_inactive.c
fs/xfs/Makefile +1 -0
@@ -27,6 +27,7 @@ xfs-y += xfs_trace.o # highlevel code xfs-y += xfs_aops.o \ + xfs_attr_inactive.o \ xfs_attr_list.o \ xfs_bit.o \ xfs_buf.o \
fs/xfs/xfs_attr.c +0 -71
77 lines not on this page · raw message
fs/xfs/xfs_attr_inactive.c new file +454 -0
454 lines not on this page · raw message
fs/xfs/xfs_attr_leaf.c +0 -352
361 lines not on this page · raw message
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 18/49] xfs: split out attribute fork truncation code into separate file
Quoted 9 lines · Dave Chinner
From: Dave Chinner<[email protected]>
The attribute inactivation code is not used by userspace, so like the attribute listing, split it out into a separate file to minimise the differences between the filesystem shared with libxfs in userspace.
Signed-off-by Dave Chinner<[email protected]>---
Looks good.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 19/49 xfs: split out the remote symlink handling
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The remote symlink format definition and manipulation needs to be shared with userspace, but the in-kernel interfaces do not. Split the remote symlink format handling out into xfs_symlink_remote.[ch] fo it can easily be shared with userspace.
--- fs/xfs/Makefile | 3 +- fs/xfs/xfs_format.h | 42 ++++++++++ fs/xfs/xfs_symlink.c | 172 -------------------------------------- fs/xfs/xfs_symlink.h | 42 +--------- fs/xfs/xfs_symlink_remote.c | 199 ++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 244 insertions(+), 214 deletions(-) create mode 100644 fs/xfs/xfs_symlink_remote.c
fs/xfs/Makefile +2 -1
@@ -50,6 +50,7 @@ xfs-y += xfs_aops.o \ xfs_mru_cache.o \ xfs_rename.o \ xfs_super.o \ + xfs_symlink.o \ xfs_trans.o \ xfs_utils.o \ xfs_vnodeops.o \
@@ -81,7 +82,7 @@ xfs-y += xfs_alloc.o \ xfs_inode_buf.o \ xfs_log_recover.o \ xfs_mount.o \ - xfs_symlink.o \ + xfs_symlink_remote.o \ xfs_trans_resv.o # low-level transaction/log code
fs/xfs/xfs_format.h +42 -0
53 lines not on this page · raw message
fs/xfs/xfs_symlink.c +0 -172
186 lines not on this page · raw message
fs/xfs/xfs_symlink.h +1 -41
52 lines not on this page · raw message
fs/xfs/xfs_symlink_remote.c new file +199 -0
199 lines not on this page · raw message
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 19/49] xfs: split out the remote symlink handling
Quoted 9 lines · Dave Chinner
From: Dave Chinner<[email protected]>
The remote symlink format definition and manipulation needs to be shared with userspace, but the in-kernel interfaces do not. Split the remote symlink format handling out into xfs_symlink_remote.[ch] fo it can easily be shared with userspace.
Signed-off-by Dave Chinner<[email protected]>---
Does exactly as commit message says. Looks good.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 20/49 xfs: introduce xfs_sb.c for sharing with libxfs
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
xfs_mount.c is shared with userspace, but the only functions that are shared are to do with physical superblock manipulations. This means that less than 25% of the xfs_mount.c code is actually shared with userspace. Move all the superblock functions to xfs_sb.c and share that instead with libxfs.
Note that this will leave all the in-core transaction related superblock counter modifications in xfs_mount.c as none of that is shared with userspace. With a few more small changes, xfs_mount.h won't need to be shared with userspace anymore, either.
--- fs/xfs/Makefile | 3 +- fs/xfs/xfs_mount.c | 817 ++++------------------------------------------------- fs/xfs/xfs_mount.h | 19 +- fs/xfs/xfs_sb.c | 771 ++++++++++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_sb.h | 20 ++ 5 files changed, 848 insertions(+), 782 deletions(-) create mode 100644 fs/xfs/xfs_sb.c
fs/xfs/Makefile +2 -1
@@ -47,6 +47,7 @@ xfs-y += xfs_aops.o \ xfs_iops.o \ xfs_itable.o \ xfs_message.o \ + xfs_mount.o \ xfs_mru_cache.o \ xfs_rename.o \ xfs_super.o \
@@ -81,7 +82,7 @@ xfs-y += xfs_alloc.o \ xfs_inode_fork.o \ xfs_inode_buf.o \ xfs_log_recover.o \ - xfs_mount.o \ + xfs_sb.o \ xfs_symlink_remote.o \ xfs_trans_resv.o
fs/xfs/xfs_mount.c +53 -764
885 lines not on this page · raw message
fs/xfs/xfs_mount.h +2 -17
@@ -292,14 +292,6 @@ xfs_daddr_to_agbno(struct xfs_mount *mp, xfs_daddr_t d) }/* -* perag get/put wrappers for ref counting -*/ -struct xfs_perag *xfs_perag_get (struct xfs_mount *mp,xfs_agnumber_t agno); -struct xfs_perag *xfs_perag_get_tag (struct xfs_mount *mp,xfs_agnumber_t agno, -int tag); -void xfs_perag_put (struct xfs_perag *pag); - -/* * Per-cpu superblock locking functions */ #ifdef HAVE_PERCPU_SB
@@ -331,6 +323,8 @@ typedef struct xfs_mod_sb {extern int xfs_log_sbcount (xfs_mount_t *);extern __uint64_t xfs_default_resblks (xfs_mount_t *mp);extern int xfs_mountfs (xfs_mount_t *mp); +extern int xfs_initialize_perag (xfs_mount_t *mp,xfs_agnumber_t agcount, +xfs_agnumber_t *maxagi);extern void xfs_unmountfs (xfs_mount_t *);extern int xfs_mod_incore_sb (xfs_mount_t *,xfs_sb_field_t ,int64_t ,int );
@@ -349,13 +343,4 @@ extern void xfs_set_low_space_thresholds(struct xfs_mount *);#endif /* __KERNEL__ */ -extern void xfs_sb_calc_crc (struct xfs_buf *); -extern void xfs_mod_sb (struct xfs_trans *,__int64_t ); -extern int xfs_initialize_perag (struct xfs_mount *,xfs_agnumber_t , -xfs_agnumber_t *); -extern void xfs_sb_from_disk (struct xfs_sb *,struct xfs_dsb *); -extern void xfs_sb_to_disk (struct xfs_dsb *,struct xfs_sb *,__int64_t ); - -extern const struct xfs_buf_ops xfs_sb_buf_ops; -#endif /* __XFS_MOUNT_H__ */
fs/xfs/xfs_sb.c new file +771 -0
771 lines not on this page · raw message
fs/xfs/xfs_sb.h +20 -0
@@ -26,6 +26,7 @@struct xfs_buf ;struct xfs_mount ; +struct xfs_trans ;#define XFS_SB_MAGIC 0x58465342/* 'XFSB' */ #define XFS_SB_VERSION_1 1/* 5.3, 6.0.1, 6.1 */
@@ -667,4 +668,23 @@ xfs_is_quota_inode(struct xfs_sb *sbp, xfs_ino_t ino)#define XFS_B_TO_FSBT (mp,b) (((__uint64_t)(b)) >> (mp)->m_sb.sb_blocklog)#define XFS_B_FSB_OFFSET (mp,b) ((b) & (mp)->m_blockmask) +/* +* perag get/put wrappers for ref counting +*/ +extern struct xfs_perag *xfs_perag_get (struct xfs_mount *,xfs_agnumber_t ); +extern struct xfs_perag *xfs_perag_get_tag (struct xfs_mount *,xfs_agnumber_t , +int tag); +extern void xfs_perag_put (struct xfs_perag *pag); +extern int xfs_initialize_perag_data (struct xfs_mount *,xfs_agnumber_t ); + +extern void xfs_sb_calc_crc (struct xfs_buf *); +extern void xfs_mod_sb (struct xfs_trans *,__int64_t ); +extern void xfs_sb_mount_common (struct xfs_mount *,struct xfs_sb *); +extern void xfs_sb_from_disk (struct xfs_sb *,struct xfs_dsb *); +extern void xfs_sb_to_disk (struct xfs_dsb *,struct xfs_sb *,__int64_t ); +extern void xfs_sb_quota_from_disk (struct xfs_sb *sbp); + +extern const struct xfs_buf_ops xfs_sb_buf_ops; +extern const struct xfs_buf_ops xfs_sb_quiet_buf_ops; +#endif /* __XFS_SB_H__ */
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 20/49] xfs: introduce xfs_sb.c for sharing with libxfs
Quoted 8 lines · Dave Chinner
From: Dave Chinner<[email protected]>
xfs_mount.cis shared with userspace, but the only functions that are shared are to do with physical superblock manipulations. This means that less than 25% of thexfs_mount.ccode is actually shared with userspace. Move all the superblock functions toxfs_sb.cand share that instead with libxfs.
Quoted 7 lines
Note that this will leave all the in-core transaction related superblock counter modifications in
xfs_mount.cas none of that is shared with userspace. With a few more small changes,xfs_mount.hwon't need to be shared with userspace anymore, either.Signed-off-by Dave Chinner<[email protected]>---
okay, moves the user sharable functions/headers from xfs_mount.c/h to
xfs_sb.c/h
couple comments:
a struct xfs_mount got converted to a xfs_mount_t typedef in xfs_initialize_perag() def in xfs_mount.h
brackets were added to a single line if statements in xfs_sb_quota_from_disk()
beyond these two comments consider it:
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 20/49] xfs: introduce xfs_sb.c for sharing with libxfs
Quoted 20 lines · Mark Tinguely
Quoted 8 lines · Dave Chinner
From: Dave Chinner<[email protected]>
xfs_mount.cis shared with userspace, but the only functions that are shared are to do with physical superblock manipulations. This means that less than 25% of thexfs_mount.ccode is actually shared with userspace. Move all the superblock functions toxfs_sb.cand share that instead with libxfs.Quoted 7 lines
Note that this will leave all the in-core transaction related superblock counter modifications in
xfs_mount.cas none of that is shared with userspace. With a few more small changes,xfs_mount.hwon't need to be shared with userspace anymore, either.Signed-off-by Dave Chinner<[email protected]>---
okay, moves the user sharable functions/headers from xfs_mount.c/h to
xfs_sb.c/h
Quoted 7 lines
couple comments:
a struct
xfs_mountgot converted to axfs_mount_ttypedef inxfs_initialize_perag()def inxfs_mount.hbrackets were added to a single line if statements in
xfs_sb_quota_from_disk()
I'll fix those - I missed them when doing an update.
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 21/49 xfs: create xfs_bmap_util.[ch]
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
There is a bunch of code in xfs_bmap.c that is kernel specific and not shared with userspace. to minimise the difference between the kernel and userspace code, shift this unshared code to xfs_bmap_util.c, and the declarations to xfs_bmap_util.h.
The biggest issue here is xfs_bmap_finish() - userspce has it's own definition of this function, and so we need to move it out of xfs_bmap.[ch]. This means several other files need to include xfs_bmap_util.c as well.
It also introduces and interesting dance for the stack switching code in xfs_bmapi_allocate(). The stack switching/workqueue code is actually moved to xfs_bmap_util.c, so that userspace can simply use a #define in a header file to connect the dots without needing to know about the stack switch code at all.
--- fs/xfs/Makefile | 1 + fs/xfs/xfs_aops.c | 1 + fs/xfs/xfs_attr.c | 1 + fs/xfs/xfs_attr_remote.c | 1 + fs/xfs/xfs_bmap.c | 804 +-------------------------------------------- fs/xfs/xfs_bmap.h | 56 ---- fs/xfs/xfs_bmap_util.c | 834 +++++++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_bmap_util.h | 96 ++++++ fs/xfs/xfs_dfrag.c | 1 + fs/xfs/xfs_dquot.c | 1 + fs/xfs/xfs_filestream.c | 5 +- fs/xfs/xfs_inode.c | 1 + fs/xfs/xfs_ioctl.c | 1 + fs/xfs/xfs_iomap.c | 1 + fs/xfs/xfs_iops.c | 1 + fs/xfs/xfs_rename.c | 1 + fs/xfs/xfs_rtalloc.c | 1 + fs/xfs/xfs_symlink.c | 1 + fs/xfs/xfs_trans_resv.c | 1 + fs/xfs/xfs_vnodeops.c | 1 + 20 files changed, 957 insertions(+), 853 deletions(-) create mode 100644 fs/xfs/xfs_bmap_util.c create mode 100644 fs/xfs/xfs_bmap_util.h
fs/xfs/Makefile +1 -0
@@ -30,6 +30,7 @@ xfs-y += xfs_aops.o \ xfs_attr_inactive.o \ xfs_attr_list.o \ xfs_bit.o \ + xfs_bmap_util.o \ xfs_buf.o \ xfs_dfrag.o \ xfs_dir2_readdir.o \
fs/xfs/xfs_aops.c +1 -0
@@ -31,6 +31,7 @@#include "xfs_vnodeops.h" #include "xfs_trace.h" #include "xfs_bmap.h" +#include "xfs_bmap_util.h" #include <linux/aio.h> #include <linux/gfp.h> #include <linux/mpage.h>
fs/xfs/xfs_attr.c +1 -0
@@ -33,6 +33,7 @@#include "xfs_alloc.h" #include "xfs_inode_item.h" #include "xfs_bmap.h" +#include "xfs_bmap_util.h" #include "xfs_attr.h" #include "xfs_attr_leaf.h" #include "xfs_attr_remote.h"
fs/xfs/xfs_attr_remote.c +1 -0
@@ -34,6 +34,7 @@#include "xfs_alloc.h" #include "xfs_inode_item.h" #include "xfs_bmap.h" +#include "xfs_bmap_util.h" #include "xfs_attr.h" #include "xfs_attr_leaf.h" #include "xfs_attr_remote.h"
fs/xfs/xfs_bmap.c +9 -795
892 lines not on this page · raw message
fs/xfs/xfs_bmap.h +0 -56
66 lines not on this page · raw message
fs/xfs/xfs_bmap_util.c new file +834 -0
834 lines not on this page · raw message
fs/xfs/xfs_bmap_util.h new file +96 -0
96 lines not on this page · raw message
fs/xfs/xfs_dfrag.c +1 -0
@@ -31,6 +31,7 @@#include "xfs_inode.h" #include "xfs_inode_item.h" #include "xfs_bmap.h" +#include "xfs_bmap_util.h" #include "xfs_itable.h" #include "xfs_dfrag.h" #include "xfs_error.h"
fs/xfs/xfs_dquot.c +1 -0
@@ -29,6 +29,7 @@#include "xfs_bmap_btree.h" #include "xfs_inode.h" #include "xfs_bmap.h" +#include "xfs_bmap_util.h" #include "xfs_rtalloc.h" #include "xfs_error.h" #include "xfs_itable.h"
fs/xfs/xfs_filestream.c +3 -2
@@ -26,6 +26,7 @@#include "xfs_sb.h" #include "xfs_mount.h" #include "xfs_bmap.h" +#include "xfs_bmap_util.h" #include "xfs_alloc.h" #include "xfs_utils.h" #include "xfs_mru_cache.h"
@@ -668,8 +669,8 @@ exit:*/ int xfs_filestream_new_ag ( -xfs_bmalloca_t *ap, -xfs_agnumber_t *agp) +struct xfs_bmalloca *ap, +xfs_agnumber_t *agp) {int flags, err;xfs_inode_t *ip, *pip =NULL ;
fs/xfs/xfs_inode.c +1 -0
@@ -39,6 +39,7 @@#include "xfs_alloc.h" #include "xfs_ialloc.h" #include "xfs_bmap.h" +#include "xfs_bmap_util.h" #include "xfs_error.h" #include "xfs_utils.h" #include "xfs_quota.h"
fs/xfs/xfs_ioctl.c +1 -0
@@ -33,6 +33,7 @@#include "xfs_error.h" #include "xfs_attr.h" #include "xfs_bmap.h" +#include "xfs_bmap_util.h" #include "xfs_buf_item.h" #include "xfs_utils.h" #include "xfs_dfrag.h"
fs/xfs/xfs_iomap.c +1 -0
@@ -33,6 +33,7 @@#include "xfs_inode_item.h" #include "xfs_btree.h" #include "xfs_bmap.h" +#include "xfs_bmap_util.h" #include "xfs_rtalloc.h" #include "xfs_error.h" #include "xfs_itable.h"
fs/xfs/xfs_iops.c +1 -0
@@ -30,6 +30,7 @@#include "xfs_dinode.h" #include "xfs_inode.h" #include "xfs_bmap.h" +#include "xfs_bmap_util.h" #include "xfs_rtalloc.h" #include "xfs_error.h" #include "xfs_itable.h"
fs/xfs/xfs_rename.c +1 -0
@@ -31,6 +31,7 @@#include "xfs_inode.h" #include "xfs_inode_item.h" #include "xfs_bmap.h" +#include "xfs_bmap_util.h" #include "xfs_error.h" #include "xfs_quota.h" #include "xfs_utils.h"
fs/xfs/xfs_rtalloc.c +1 -0
@@ -29,6 +29,7 @@#include "xfs_inode.h" #include "xfs_alloc.h" #include "xfs_bmap.h" +#include "xfs_bmap_util.h" #include "xfs_rtalloc.h" #include "xfs_fsops.h" #include "xfs_error.h"
fs/xfs/xfs_symlink.c +1 -0
@@ -35,6 +35,7 @@#include "xfs_ialloc.h" #include "xfs_alloc.h" #include "xfs_bmap.h" +#include "xfs_bmap_util.h" #include "xfs_error.h" #include "xfs_quota.h" #include "xfs_utils.h"
fs/xfs/xfs_trans_resv.c +1 -0
@@ -37,6 +37,7 @@#include "xfs_alloc.h" #include "xfs_extent_busy.h" #include "xfs_bmap.h" +#include "xfs_bmap_util.h" #include "xfs_quota.h" #include "xfs_qm.h" #include "xfs_trans_space.h"
fs/xfs/xfs_vnodeops.c +1 -0
@@ -38,6 +38,7 @@#include "xfs_ialloc.h" #include "xfs_alloc.h" #include "xfs_bmap.h" +#include "xfs_bmap_util.h" #include "xfs_acl.h" #include "xfs_attr.h" #include "xfs_error.h"
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 21/49] xfs: create xfs_bmap_util.[ch]
Quoted 12 lines · Dave Chinner
From: Dave Chinner<[email protected]>
There is a bunch of code in
xfs_bmap.cthat is kernel specific and not shared with userspace. to minimise the difference between the kernel and userspace code, shift this unshared code toxfs_bmap_util.c, and the declarations toxfs_bmap_util.h.The biggest issue here is
xfs_bmap_finish()- userspce has it's own definition of this function, and so we need to move it out of xfs_bmap.[ch]. This means several other files need to includexfs_bmap_util.cas well.
Quoted 8 lines
It also introduces and interesting dance for the stack switching code in
xfs_bmapi_allocate(). The stack switching/workqueue code is actually moved toxfs_bmap_util.c, so that userspace can simply use a #define in a header file to connect the dots without needing to know about the stack switch code at all.Signed-off-by Dave Chinner<[email protected]>---
okay, function structure moved with some white space and typedef to struct changes and some functions in xfs_bmap.c are needed in xfs_bmap_util.c so they are no longer static. Looks good.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 22/49 xfs: minor cleanups
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
These come from syncing the shared userspace and kernel code. Small whitespace and trivial cleanups.
--- fs/xfs/xfs_attr_leaf.c | 2 -- fs/xfs/xfs_attr_remote.c | 8 +------- fs/xfs/xfs_bmap_btree.c | 4 +--- fs/xfs/xfs_inode_fork.c | 4 ++-- 4 files changed, 4 insertions(+), 14 deletions(-)
fs/xfs/xfs_attr_leaf.c +0 -2
@@ -936,7 +936,6 @@ out:return error; } -/*======================================================================== * Routines used for growing the Btree. *========================================================================*/
@@ -1297,7 +1296,6 @@ xfs_attr3_leaf_compact( ichdr_dst->freemap[0 ].size = ichdr_dst->firstused - ichdr_dst->freemap[0 ].base; -/* write the header back to initialise the underlying buffer */ xfs_attr3_leaf_hdr_to_disk (leaf_dst, ichdr_dst);
fs/xfs/xfs_attr_remote.c +1 -7
@@ -251,7 +251,7 @@ xfs_attr_rmtval_copyout(int hdr_size =0 ;int byte_cnt =XFS_ATTR3_RMT_BUF_SPACE (mp,XFS_LBSIZE (mp)); - byte_cnt =min_t (int, *valuelen, byte_cnt); + byte_cnt =min (*valuelen, byte_cnt); if (xfs_sb_version_hascrc(&mp->m_sb)) { if (!xfs_attr3_rmt_hdr_ok(mp, src, ino, *offset,
@@ -545,11 +545,6 @@ xfs_attr_rmtval_remove(/* * Roll through the "value", invalidating the attribute value's blocks. -* Note that args->rmtblkcnt is the minimum number of data blocks we'll -* see for a CRC enabled remote attribute. Each extent will have a -* header, and so we may have more blocks than we realise here. If we -* fail to map the blocks correctly, we'll have problems with the buffer -* lookups. */ lblkno = args->rmtblkno; blkcnt = args->rmtblkcnt;
@@ -630,4 +625,3 @@ xfs_attr_rmtval_remove( }return (0 ); } -
fs/xfs/xfs_bmap_btree.c +1 -3
@@ -722,7 +722,7 @@ xfs_bmbt_key_diff( cur->bc_rec.b.br_startoff; } -static int +static bool xfs_bmbt_verify (struct xfs_buf *bp) {
@@ -775,7 +775,6 @@ xfs_bmbt_verify(return false;return true; - } static void
@@ -789,7 +788,6 @@ xfs_bmbt_read_verify( bp->b_target->bt_mount, bp->b_addr);xfs_buf_ioerror (bp,EFSCORRUPTED ); } - } static void
fs/xfs/xfs_inode_fork.c +2 -2
@@ -780,8 +780,8 @@ xfs_iextents_copy( }/* Translate to on disk format */ -put_unaligned (cpu_to_be64 (ep->l0), &dp->l0); -put_unaligned (cpu_to_be64 (ep->l1), &dp->l1); +put_unaligned_be64 (ep->l0, &dp->l0); +put_unaligned_be64 (ep->l1, &dp->l1); dp++; copied++; }
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 22/49] xfs: minor cleanups
Quoted 7 lines · Dave Chinner
From: Dave Chinner<[email protected]>
These come from syncing the shared userspace and kernel code. Small whitespace and trivial cleanups.
Signed-off-by Dave Chinner<[email protected]>---
okay, minor clean-ups
Don't understand the change from min_t to min:
fs/xfs/xfs_attr_remote.c xfs_attr_rmtval_copyout( · line 257
Quoted 13 lines
fs/xfs/xfs_attr_remote.c +1
-1@@ -251,7 +251,7 @@ xfs_attr_rmtval_copyout(int hdr_size =0 ;int byte_cnt =XFS_ATTR3_RMT_BUF_SPACE (mp,XFS_LBSIZE (mp)); - byte_cnt =min_t (int, *valuelen, byte_cnt); + byte_cnt =min (*valuelen, byte_cnt); if (xfs_sb_version_hascrc(&mp->m_sb)) { if (!xfs_attr3_rmt_hdr_ok(mp, src, ino, *offset,
but looks good:
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 22/49] xfs: minor cleanups
Quoted 21 lines · Mark Tinguely
Quoted 7 lines · Dave Chinner
From: Dave Chinner<[email protected]>
These come from syncing the shared userspace and kernel code. Small whitespace and trivial cleanups.
Signed-off-by Dave Chinner<[email protected]>---
okay, minor clean-ups
Don't understand the change from
min_tto min:Quoted 8 lines
fs/xfs/xfs_attr_remote.c +0
-0@@ -251,7 +251,7 @@ xfs_attr_rmtval_copyout(int hdr_size =0 ;int byte_cnt =XFS_ATTR3_RMT_BUF_SPACE (mp,XFS_LBSIZE (mp));
Quoted 2 lines
fs/xfs/xfs_attr_remote.c xfs_attr_rmtval_copyout( · line 254
Quoted 2 lines
fs/xfs/xfs_attr_remote.c +1
-1- byte_cnt =min_t (int, *valuelen, byte_cnt); + byte_cnt =min (*valuelen, byte_cnt);
min_t is only needed when the types being compared are different. I.e. it ensures the comparison is done with the appropriate casts on the items being compared. However, both variables being compared here are of the same type (int) and so the type casting of min_t is not necessary.
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 23/49 xfs: fix issues that cause userspace warnings
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Some of the code shared with userspace causes compilation warnings from things turned off in the kernel code, such as differences in variable signedness. Fix those issues.
--- fs/xfs/xfs_attr_remote.c | 8 ++++---- fs/xfs/xfs_bmap.c | 3 --- fs/xfs/xfs_da_btree.c | 6 +++--- fs/xfs/xfs_dir2_node.c | 2 ++ fs/xfs/xfs_ialloc.c | 2 +- fs/xfs/xfs_rtalloc.c | 4 ++-- 6 files changed, 12 insertions(+), 13 deletions(-)
fs/xfs/xfs_attr_remote.c +4 -4
@@ -239,7 +239,7 @@ xfs_attr_rmtval_copyout(xfs_ino_t ino, int *offset, int *valuelen, - char **dst) + __uint8_t **dst) { char *src = bp->b_addr;xfs_daddr_t bno = bp->b_bn;
@@ -286,7 +286,7 @@ xfs_attr_rmtval_copyin(xfs_ino_t ino, int *offset, int *valuelen, - char **src) + __uint8_t **src) { char *dst = bp->b_addr;xfs_daddr_t bno = bp->b_bn;
@@ -339,7 +339,7 @@ xfs_attr_rmtval_get(struct xfs_mount *mp = args->dp->i_mount;struct xfs_buf *bp;xfs_dablk_t lblkno = args->rmtblkno; -char *dst = args->value; +__uint8_t *dst = args->value;int valuelen = args->valuelen;int nmap;int error;
@@ -403,7 +403,7 @@ xfs_attr_rmtval_set(struct xfs_bmbt_irec map;xfs_dablk_t lblkno;xfs_fileoff_t lfileoff =0 ; -char *src = args->value; +__uint8_t *src = args->value;int blkcnt;int valuelen;int nmap;
fs/xfs/xfs_bmap.c +0 -3
@@ -4258,12 +4258,9 @@ __xfs_bmapi_allocate(struct xfs_ifork *ifp =XFS_IFORK_PTR (bma->ip, whichfork);int tmp_logflags =0 ;int error; -int rt;ASSERT (bma->length >0 ); - rt = (whichfork ==XFS_DATA_FORK ) &&XFS_IS_REALTIME_INODE (bma->ip); -/* * For the wasdelay case, we could also just allocate the stuff asked * for in this bmap call but that wouldn't be as good.
fs/xfs/xfs_da_btree.c +3 -3
@@ -399,7 +399,7 @@ xfs_da3_split(struct xfs_da_intnode *node;struct xfs_buf *bp;int max; -int action; +int action =0 ;int error;int i;
@@ -2454,9 +2454,9 @@ static intxfs_buf_map_from_irec ( struct xfs_mount *mp, struct xfs_buf_map **mapp, - unsigned int *nmaps, + int *nmaps, struct xfs_bmbt_irec *irecs, - unsigned int nirecs) + int nirecs) { struct xfs_buf_map *map;int i;
fs/xfs/xfs_dir2_node.c +2 -0
@@ -313,11 +313,13 @@ xfs_dir2_free_log_header(struct xfs_trans *tp, struct xfs_buf *bp) { +#ifdef DEBUG xfs_dir2_free_t *free; /* freespace structure */ free = bp->b_addr;ASSERT (free->hdr.magic ==cpu_to_be32 (XFS_DIR2_FREE_MAGIC ) || free->hdr.magic ==cpu_to_be32 (XFS_DIR3_FREE_MAGIC )); +#endif xfs_trans_log_buf (tp, bp,0 ,xfs_dir3_free_hdr_size (tp->t_mountp) -1 ); }
fs/xfs/xfs_ialloc.c +1 -1
@@ -1342,7 +1342,7 @@ xfs_imap(xfs_agblock_t cluster_agbno;/* first block in inode cluster */ int error;/* error code */ 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 */ ASSERT (ino !=NULLFSINO );
fs/xfs/xfs_rtalloc.c +2 -2
@@ -736,8 +736,8 @@ xfs_rtallocate_range( {xfs_rtblock_t end;/* end of the allocated extent */ int error;/* error value */ -xfs_rtblock_t postblock;/* first block allocated > end */ -xfs_rtblock_t preblock;/* first block allocated < start */ +xfs_rtblock_t postblock =0 ;/* first block allocated > end */ +xfs_rtblock_t preblock =0 ;/* first block allocated < start */ end = start + len -1 ;/*
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 23/49] xfs: fix issues that cause userspace warnings
Quoted 8 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Some of the code shared with userspace causes compilation warnings from things turned off in the kernel code, such as differences in variable signedness. Fix those issues.
Signed-off-by Dave Chinner<[email protected]>---
Fix compiler signed/unsigned and unused variable issues. Looks good.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 24/49 xfs: kill xfs_vnodeops.[ch]
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Now we have xfs_inode.c for holding kernel-only XFS inode operations, move all the inode operations from xfs_vnodeops.c to this new file as it holds another set of kernel-only inode operations. The name of this file traces back to the days of Irix and it's vnodes which we don't have anymore.
Essentially this move consolidates the inode locking functions and a bunch of XFS inode operations into the one file. Eventually the high level functions will be merged into the VFS interface functions in xfs_iops.c.
This leaves only internal preallocation, EOF block manipulation and hole punching functions in vnodeops.c. Move these to xfs_bmap_util.c where we are already consolidating various in-kernel physical extent manipulation and querying functions.
--- fs/xfs/Makefile | 1 - fs/xfs/xfs_acl.c | 1 - fs/xfs/xfs_aops.c | 1 - fs/xfs/xfs_attr.c | 1 - fs/xfs/xfs_attr.h | 8 + fs/xfs/xfs_bmap.c | 1 - fs/xfs/xfs_bmap_util.c | 861 ++++++++++++++++++++++ fs/xfs/xfs_bmap_util.h | 11 + fs/xfs/xfs_dfrag.c | 1 - fs/xfs/xfs_dir2.c | 1 - fs/xfs/xfs_dir2.h | 6 - fs/xfs/xfs_dir2_priv.h | 6 + fs/xfs/xfs_export.c | 1 - fs/xfs/xfs_file.c | 3 +- fs/xfs/xfs_icache.c | 2 +- fs/xfs/xfs_inode.c | 1003 +++++++++++++++++++++++++- fs/xfs/xfs_inode.h | 23 +- fs/xfs/xfs_inode_buf.h | 1 - fs/xfs/xfs_ioctl.c | 36 +- fs/xfs/xfs_ioctl.h | 6 + fs/xfs/xfs_ioctl32.c | 1 - fs/xfs/xfs_iops.c | 2 +- fs/xfs/xfs_iops.h | 13 + fs/xfs/xfs_rename.c | 1 - fs/xfs/xfs_super.c | 1 - fs/xfs/xfs_vnodeops.c | 1872 ------------------------------------------------ fs/xfs/xfs_vnodeops.h | 55 -- fs/xfs/xfs_xattr.c | 1 - 28 files changed, 1930 insertions(+), 1990 deletions(-) delete mode 100644 fs/xfs/xfs_vnodeops.c delete mode 100644 fs/xfs/xfs_vnodeops.h
fs/xfs/Makefile +0 -1
@@ -55,7 +55,6 @@ xfs-y += xfs_aops.o \ xfs_symlink.o \ xfs_trans.o \ xfs_utils.o \ - xfs_vnodeops.o \ xfs_xattr.o \ kmem.o \ uuid.o
fs/xfs/xfs_acl.c +0 -1
@@ -22,7 +22,6 @@#include "xfs_attr.h" #include "xfs_bmap_btree.h" #include "xfs_inode.h" -#include "xfs_vnodeops.h" #include "xfs_sb.h" #include "xfs_mount.h" #include "xfs_trace.h"
fs/xfs/xfs_aops.c +0 -1
@@ -28,7 +28,6 @@#include "xfs_alloc.h" #include "xfs_error.h" #include "xfs_iomap.h" -#include "xfs_vnodeops.h" #include "xfs_trace.h" #include "xfs_bmap.h" #include "xfs_bmap_util.h"
fs/xfs/xfs_attr.c +0 -1
@@ -40,7 +40,6 @@#include "xfs_error.h" #include "xfs_quota.h" #include "xfs_trans_space.h" -#include "xfs_vnodeops.h" #include "xfs_trace.h" /*
fs/xfs/xfs_attr.h +8 -0
@@ -142,5 +142,13 @@ typedef struct xfs_attr_list_context {int xfs_attr_inactive (struct xfs_inode *dp);int xfs_attr_list_int (struct xfs_attr_list_context *);int xfs_inode_hasattr (struct xfs_inode *ip); +int xfs_attr_get (struct xfs_inode *ip,const unsigned char *name, +unsigned char *value,int *valuelenp,int flags); +int xfs_attr_set (struct xfs_inode *dp,const unsigned char *name, +unsigned char *value,int valuelen,int flags); +int xfs_attr_remove (struct xfs_inode *dp,const unsigned char *name,int flags); +int xfs_attr_list (struct xfs_inode *dp,char *buffer,int bufsize, +int flags,struct attrlist_cursor_kern *cursor); +#endif /* __XFS_ATTR_H__ */
fs/xfs/xfs_bmap.c +0 -1
@@ -48,7 +48,6 @@#include "xfs_trans_space.h" #include "xfs_buf_item.h" #include "xfs_filestream.h" -#include "xfs_vnodeops.h" #include "xfs_trace.h" #include "xfs_symlink.h"
fs/xfs/xfs_bmap_util.c +861 -0
875 lines not on this page · raw message
fs/xfs/xfs_bmap_util.h +11 -0
@@ -21,6 +21,7 @@/* Kernel only BMAP related definitions and functions */ struct xfs_bmbt_irec ; +struct xfs_bmap_free_item ;struct xfs_ifork ;struct xfs_inode ;struct xfs_mount ;
@@ -91,6 +92,16 @@ int xfs_bmap_last_extent(struct xfs_trans *tp, struct xfs_inode *ip, int whichfork, struct xfs_bmbt_irec *rec, int *is_empty); +/* preallocation and hole punch interface */ +int xfs_change_file_space (struct xfs_inode *ip,int cmd, +xfs_flock64_t *bf,xfs_off_t offset, +int attr_flags); + +/* EOF block manipulation functions */ +bool xfs_can_free_eofblocks (struct xfs_inode *ip,bool force); +int xfs_free_eofblocks (struct xfs_mount *mp,struct xfs_inode *ip, +bool need_iolock); +xfs_daddr_t xfs_fsb_to_db (struct xfs_inode *ip,xfs_fsblock_t fsb);#endif /* __XFS_BMAP_UTIL_H__ */
fs/xfs/xfs_dfrag.c +0 -1
@@ -35,7 +35,6 @@#include "xfs_itable.h" #include "xfs_dfrag.h" #include "xfs_error.h" -#include "xfs_vnodeops.h" #include "xfs_trace.h"
fs/xfs/xfs_dir2.c +0 -1
@@ -35,7 +35,6 @@#include "xfs_dir2.h" #include "xfs_dir2_priv.h" #include "xfs_error.h" -#include "xfs_vnodeops.h" #include "xfs_trace.h" struct xfs_name xfs_name_dotdot = { (unsigned char *)".." ,2 };
fs/xfs/xfs_dir2.h +0 -6
@@ -63,12 +63,6 @@ extern int xfs_dir_canenter(struct xfs_trans *tp, struct xfs_inode *dp,extern int xfs_dir2_sf_to_block (struct xfs_da_args *args);/* -* Direct call on directory open, before entering the readdir code. -*/ -extern int xfs_dir3_data_readahead (struct xfs_trans *tp,struct xfs_inode *dp, -xfs_dablk_t bno,xfs_daddr_t mapped_bno); - -/* * Interface routines used by userspace utilities */ extern xfs_ino_t xfs_dir2_sf_get_parent_ino (struct xfs_dir2_sf_hdr *sfp);
fs/xfs/xfs_dir2_priv.h +6 -0
@@ -45,6 +45,8 @@ extern int xfs_dir2_leaf_to_block(struct xfs_da_args *args,extern int __xfs_dir3_data_check (struct xfs_inode *dp,struct xfs_buf *bp);extern int xfs_dir3_data_read (struct xfs_trans *tp,struct xfs_inode *dp,xfs_dablk_t bno,xfs_daddr_t mapped_bno,struct xfs_buf **bpp); +extern int xfs_dir3_data_readahead (struct xfs_trans *tp,struct xfs_inode *dp, +xfs_dablk_t bno,xfs_daddr_t mapped_bno);extern struct xfs_dir2_data_free * xfs_dir2_data_freeinsert(struct xfs_dir2_data_hdr *hdr,
@@ -124,4 +126,8 @@ extern int xfs_dir2_sf_lookup(struct xfs_da_args *args);extern int xfs_dir2_sf_removename (struct xfs_da_args *args);extern int xfs_dir2_sf_replace (struct xfs_da_args *args); +/* xfs_dir2_readdir.c */ +extern int xfs_readdir (struct xfs_inode *dp,struct dir_context *ctx, +size_t bufsize); +#endif /* __XFS_DIR2_PRIV_H__ */
fs/xfs/xfs_export.c +0 -1
@@ -26,7 +26,6 @@#include "xfs_dir2_format.h" #include "xfs_dir2.h" #include "xfs_export.h" -#include "xfs_vnodeops.h" #include "xfs_bmap_btree.h" #include "xfs_inode.h" #include "xfs_inode_item.h"
fs/xfs/xfs_file.c +2 -1
@@ -28,11 +28,12 @@#include "xfs_inode.h" #include "xfs_inode_item.h" #include "xfs_bmap.h" +#include "xfs_bmap_util.h" #include "xfs_error.h" -#include "xfs_vnodeops.h" #include "xfs_da_btree.h" #include "xfs_dir2_format.h" #include "xfs_dir2.h" +#include "xfs_dir2_priv.h" #include "xfs_ioctl.h" #include "xfs_trace.h"
fs/xfs/xfs_icache.c +1 -1
@@ -32,12 +32,12 @@#include "xfs_dinode.h" #include "xfs_error.h" #include "xfs_filestream.h" -#include "xfs_vnodeops.h" #include "xfs_inode_item.h" #include "xfs_quota.h" #include "xfs_trace.h" #include "xfs_fsops.h" #include "xfs_icache.h" +#include "xfs_bmap_util.h" #include <linux/kthread.h> #include <linux/freezer.h>
fs/xfs/xfs_inode.c +966 -37
1,059 lines not on this page · raw message
fs/xfs/xfs_inode.h +20 -3
@@ -315,9 +315,21 @@ static inline int xfs_isiflocked(struct xfs_inode *ip) ((pip)->i_d.di_mode & S_ISGID)) -/* -* xfs_inode.c prototypes. -*/ +int xfs_release (struct xfs_inode *ip); +int xfs_inactive (struct xfs_inode *ip); +int xfs_lookup (struct xfs_inode *dp,struct xfs_name *name, +struct xfs_inode **ipp,struct xfs_name *ci_name); +int xfs_create (struct xfs_inode *dp,struct xfs_name *name, +umode_t mode,xfs_dev_t rdev,struct xfs_inode **ipp); +int xfs_remove (struct xfs_inode *dp,struct xfs_name *name, +struct xfs_inode *ip); +int xfs_link (struct xfs_inode *tdp,struct xfs_inode *sip, +struct xfs_name *target_name); +int xfs_rename (struct xfs_inode *src_dp,struct xfs_name *src_name, +struct xfs_inode *src_ip,struct xfs_inode *target_dp, +struct xfs_name *target_name, +struct xfs_inode *target_ip); +void xfs_ilock (xfs_inode_t *,uint );int xfs_ilock_nowait (xfs_inode_t *,uint );void xfs_iunlock (xfs_inode_t *,uint );
@@ -348,6 +360,11 @@ void xfs_lock_two_inodes(xfs_inode_t *, xfs_inode_t *, uint);xfs_extlen_t xfs_get_extsz_hint (struct xfs_inode *ip); +/* from xfs_file.c */ +int xfs_zero_eof (struct xfs_inode *,xfs_off_t ,xfs_fsize_t ); +int xfs_iozero (struct xfs_inode *,loff_t ,size_t ); + +#define IHOLD (ip) \ do { \ ASSERT(atomic_read(&VFS_I(ip)->i_count) > 0) ; \
fs/xfs/xfs_inode_buf.h +0 -1
@@ -40,7 +40,6 @@ int xfs_iread(struct xfs_mount *, struct xfs_trans *,void xfs_dinode_calc_crc (struct xfs_mount *,struct xfs_dinode *);void xfs_dinode_to_disk (struct xfs_dinode *,struct xfs_icdinode *); -bool xfs_can_free_eofblocks (struct xfs_inode *,bool );#if defined(DEBUG )void xfs_inobp_check (struct xfs_mount *,struct xfs_buf *);
fs/xfs/xfs_ioctl.c +35 -1
@@ -38,13 +38,13 @@#include "xfs_utils.h" #include "xfs_dfrag.h" #include "xfs_fsops.h" -#include "xfs_vnodeops.h" #include "xfs_discard.h" #include "xfs_quota.h" #include "xfs_inode_item.h" #include "xfs_export.h" #include "xfs_trace.h" #include "xfs_icache.h" +#include "xfs_symlink.h" #include <linux/capability.h> #include <linux/dcache.h>
@@ -352,6 +352,40 @@ xfs_readlink_by_handle(return error; } +int +xfs_set_dmattrs ( +xfs_inode_t *ip, +u_int evmask, +u_int16_t state) +{ +xfs_mount_t *mp = ip->i_mount; +xfs_trans_t *tp; +int error; + +if (!capable (CAP_SYS_ADMIN )) +return XFS_ERROR (EPERM ); + +if (XFS_FORCED_SHUTDOWN (mp)) +return XFS_ERROR (EIO ); + + tp =xfs_trans_alloc (mp,XFS_TRANS_SET_DMATTRS ); + error =xfs_trans_reserve (tp,0 ,XFS_ICHANGE_LOG_RES (mp),0 ,0 ,0 ); +if (error) { +xfs_trans_cancel (tp,0 ); +return error; + } +xfs_ilock (ip,XFS_ILOCK_EXCL ); +xfs_trans_ijoin (tp, ip,XFS_ILOCK_EXCL ); + + ip->i_d.di_dmevmask = evmask; + ip->i_d.di_dmstate = state; + +xfs_trans_log_inode (tp, ip,XFS_ILOG_CORE ); + error =xfs_trans_commit (tp,0 ); + +return error; +} + STATIC int xfs_fssetdm_by_handle( struct file *parfilp,
fs/xfs/xfs_ioctl.h +6 -0
@@ -82,4 +82,10 @@ xfs_file_compat_ioctl(unsigned int cmd, unsigned long arg); +extern int +xfs_set_dmattrs ( +struct xfs_inode *ip, +u_int evmask, +u_int16_t state); +#endif
fs/xfs/xfs_ioctl32.c +0 -1
@@ -34,7 +34,6 @@#include "xfs_itable.h" #include "xfs_error.h" #include "xfs_dfrag.h" -#include "xfs_vnodeops.h" #include "xfs_fsops.h" #include "xfs_alloc.h" #include "xfs_rtalloc.h"
fs/xfs/xfs_iops.c +1 -1
@@ -37,10 +37,10 @@#include "xfs_attr.h" #include "xfs_buf_item.h" #include "xfs_utils.h" -#include "xfs_vnodeops.h" #include "xfs_inode_item.h" #include "xfs_trace.h" #include "xfs_icache.h" +#include "xfs_symlink.h" #include <linux/capability.h> #include <linux/xattr.h>
fs/xfs/xfs_iops.h +13 -0
@@ -27,4 +27,17 @@ extern ssize_t xfs_vn_listxattr(struct dentry *, char *data, size_t size);extern void xfs_setup_inode (struct xfs_inode *); +/* +* Internal setattr interfaces. +*/ +#define XFS_ATTR_DMI 0x01/* invocation from a DMI function */ +#define XFS_ATTR_NONBLOCK 0x02/* return EAGAIN if op would block */ +#define XFS_ATTR_NOLOCK 0x04/* Don't grab any conflicting locks */ +#define XFS_ATTR_NOACL 0x08/* Don't call xfs_acl_chmod */ +#define XFS_ATTR_SYNC 0x10/* synchronous operation required */ + +extern int xfs_setattr_nonsize (struct xfs_inode *ip,struct iattr *vap, +int flags); +extern int xfs_setattr_size (struct xfs_inode *ip,struct iattr *vap,int flags); +#endif /* __XFS_IOPS_H__ */
fs/xfs/xfs_rename.c +0 -1
@@ -36,7 +36,6 @@#include "xfs_quota.h" #include "xfs_utils.h" #include "xfs_trans_space.h" -#include "xfs_vnodeops.h" #include "xfs_trace.h"
fs/xfs/xfs_super.c +0 -1
@@ -41,7 +41,6 @@#include "xfs_attr.h" #include "xfs_buf_item.h" #include "xfs_utils.h" -#include "xfs_vnodeops.h" #include "xfs_log_priv.h" #include "xfs_trans_priv.h" #include "xfs_filestream.h"
fs/xfs/xfs_vnodeops.c deleted +0 -1872
765 lines not on this page · raw message
fs/xfs/xfs_vnodeops.h deleted +0 -55
55 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 6 lines
1.8.3.2 _______________________________________________ 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 24/49] xfs: kill xfs_vnodeops.[ch]
Quoted 13 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Now we have
xfs_inode.cfor holding kernel-only XFS inode operations, move all the inode operations fromxfs_vnodeops.cto this new file as it holds another set of kernel-only inode operations. The name of this file traces back to the days of Irix and it's vnodes which we don't have anymore.Essentially this move consolidates the inode locking functions and a bunch of XFS inode operations into the one file. Eventually the high level functions will be merged into the VFS interface functions in
xfs_iops.c.
Quoted 7 lines
This leaves only internal preallocation, EOF block manipulation and hole punching functions in
vnodeops.c. Move these toxfs_bmap_util.cwhere we are already consolidating various in-kernel physical extent manipulation and querying functions.Signed-off-by Dave Chinner<[email protected]>---
As already mentioned, xfs_inode_fork.c still has a unwanted include of now removed xfs_vnodeops.h.
A xfs_qm_dqrele(pdqp) does not exist in the copied code:
Quoted 8 lines
fs/xfs/xfs_inode.c +8
-0+int +xfs_create ( +xfs_inode_t *dp, +struct xfs_name *name, +umode_t mode, +xfs_dev_t rdev, +xfs_inode_t **ipp) +{
...
Quoted 7 lines
fs/xfs/xfs_inode.c +7
-0+/* +* Attach the dquot(s) to the inodes and modify them incore. +* These ids of the inode couldn't have changed since the new +* inode has been locked ever since it was created. +*/ +xfs_qm_vop_create_dqattach (tp, ip, udqp, gdqp, pdqp); +
fs/xfs/xfs_inode.c xfs_ialloc( · line 1034
Quoted 10 lines
fs/xfs/xfs_inode.c +10
-0+ error =xfs_bmap_finish (&tp,&free_list,&committed); +if (error) + goto out_bmap_cancel; + + error =xfs_trans_commit (tp,XFS_TRANS_RELEASE_LOG_RES ); +if (error) + goto out_release_inode; + +xfs_qm_dqrele (udqp); +xfs_qm_dqrele (gdqp);
^^^ does not exist here,
Quoted 39 lines
fs/xfs/xfs_inode.c +28
-9+ + *ipp = ip; +return 0 ; + + out_bmap_cancel: +xfs_bmap_cancel (&free_list); + out_trans_abort: + cancel_flags |=XFS_TRANS_ABORT ; + out_trans_cancel: +xfs_trans_cancel (tp, cancel_flags); + out_release_inode: +/* +* Wait until after the current transaction is aborted to +* release the inode. This prevents recursive transactions +* and deadlocks from xfs_inactive. +*/ +if (ip) +IRELE (ip); + +xfs_qm_dqrele (udqp); +xfs_qm_dqrele (gdqp); +xfs_qm_dqrele (pdqp); + +if (unlock_dp_on_error) +xfs_iunlock (dp,XFS_ILOCK_EXCL ); +return error; +} + - -int -xfs_create ( -xfs_inode_t *dp, -struct xfs_name *name, -umode_t mode, -xfs_dev_t rdev, -xfs_inode_t **ipp) -{
...
Quoted 9 lines
fs/xfs/xfs_vnodeops.c deleted +0
-9- -/* -* Attach the dquot(s) to the inodes and modify them incore. -* These ids of the inode couldn't have changed since the new -* inode has been locked ever since it was created. -*/ -xfs_qm_vop_create_dqattach (tp, ip, udqp, gdqp, pdqp); - - error =xfs_bmap_finish (&tp,&free_list,&committed);
fs/xfs/xfs_vnodeops.c line 643
Quoted 10 lines
fs/xfs/xfs_vnodeops.c deleted +0
-10-if (error) - goto out_bmap_cancel; - - error =xfs_trans_commit (tp,XFS_TRANS_RELEASE_LOG_RES ); -if (error) - goto out_release_inode; - -xfs_qm_dqrele (udqp); -xfs_qm_dqrele (gdqp); -xfs_qm_dqrele (pdqp);
exists here
Quoted 17 lines
fs/xfs/xfs_vnodeops.c deleted +0
-17- - *ipp = ip; -return 0 ; - - out_bmap_cancel: -xfs_bmap_cancel (&free_list); - out_trans_abort: - cancel_flags |=XFS_TRANS_ABORT ; - out_trans_cancel: -xfs_trans_cancel (tp, cancel_flags); - out_release_inode: -/* -* Wait until after the current transaction is aborted to -* release the inode. This prevents recursive transactions -* and deadlocks from xfs_inactive. -*/ -if (ip)
fs/xfs/xfs_vnodeops.c line 670
Quoted 10 lines
fs/xfs/xfs_vnodeops.c deleted +0
-10-IRELE (ip); - -xfs_qm_dqrele (udqp); -xfs_qm_dqrele (gdqp); -xfs_qm_dqrele (pdqp); - -if (unlock_dp_on_error) -xfs_iunlock (dp,XFS_ILOCK_EXCL ); -return error; -}
The format for xfs_rename() in xfs_inode.h is funky.
Hopefully I caught everything.
--Mark.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 24/49] xfs: kill xfs_vnodeops.[ch]
Quoted 19 lines · Mark Tinguely
Quoted 18 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Now we have
xfs_inode.cfor holding kernel-only XFS inode operations, move all the inode operations fromxfs_vnodeops.cto this new file as it holds another set of kernel-only inode operations. The name of this file traces back to the days of Irix and it's vnodes which we don't have anymore.Essentially this move consolidates the inode locking functions and a bunch of XFS inode operations into the one file. Eventually the high level functions will be merged into the VFS interface functions in
xfs_iops.c.This leaves only internal preallocation, EOF block manipulation and hole punching functions in
vnodeops.c. Move these toxfs_bmap_util.cwhere we are already consolidating various in-kernel physical extent manipulation and querying functions.
Quoted 7 lines
Quoted 2 lines
Signed-off-by Dave Chinner<[email protected]>---
As already mentioned,
xfs_inode_fork.cstill has a unwanted include of now removedxfs_vnodeops.h.A
xfs_qm_dqrele(pdqp)does not exist in the copied code:
Yes, already fixed that here. It was causing test failures on xfs/050.
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Mark Tinguely
Reviewed-byRe: [PATCH 24/49] xfs: kill xfs_vnodeops.[ch]
Quoted 26 lines · Dave Chinner
Quoted 25 lines · Mark Tinguely
Quoted 13 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Now we have
xfs_inode.cfor holding kernel-only XFS inode operations, move all the inode operations fromxfs_vnodeops.cto this new file as it holds another set of kernel-only inode operations. The name of this file traces back to the days of Irix and it's vnodes which we don't have anymore.Essentially this move consolidates the inode locking functions and a bunch of XFS inode operations into the one file. Eventually the high level functions will be merged into the VFS interface functions in
xfs_iops.c.Quoted 7 lines
This leaves only internal preallocation, EOF block manipulation and hole punching functions in
vnodeops.c. Move these toxfs_bmap_util.cwhere we are already consolidating various in-kernel physical extent manipulation and querying functions.Signed-off-by Dave Chinner<[email protected]>---
As already mentioned,
xfs_inode_fork.cstill has a unwanted include of now removedxfs_vnodeops.h.
Quoted 8 lines
Quoted 1 line
A
xfs_qm_dqrele(pdqp)does not exist in the copied code:Yes, already fixed that here. It was causing test failures on xfs/050.
Cheers,
Dave.
Okay, then considered it:
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 25/49 xfs: consolidate xfs_rename.c
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Move the rename code to xfs_inode.c to continue consolidating all the kernel xfs_inode operations in the one place.
--- fs/xfs/Makefile | 1 - fs/xfs/xfs_inode.c | 308 +++++++++++++++++++++++++++++++++++++++++++++- fs/xfs/xfs_rename.c | 347 ---------------------------------------------------- 3 files changed, 307 insertions(+), 349 deletions(-) delete mode 100644 fs/xfs/xfs_rename.c
fs/xfs/Makefile +0 -1
@@ -50,7 +50,6 @@ xfs-y += xfs_aops.o \ xfs_message.o \ xfs_mount.o \ xfs_mru_cache.o \ - xfs_rename.o \ xfs_super.o \ xfs_symlink.o \ xfs_trans.o \
fs/xfs/xfs_inode.c +307 -1
320 lines not on this page · raw message
fs/xfs/xfs_rename.c deleted +0 -347
347 lines not on this page · raw message
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 25/49] xfs: consolidate xfs_rename.c
Quoted 7 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Move the rename code to
xfs_inode.cto continue consolidating all the kernelxfs_inodeoperations in the one place.Signed-off-by Dave Chinner<[email protected]>---
Simple copy of the xfs_rename functions to xfs_inode.c Looks good.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 26/49 xfs: consolidate xfs_utils.c
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
There are a few small helper functions in xfs_util, all related to xfs_inode modifications. Move them all to xfs_inode.c so all xfs_inode operations are consiolidated in the one place.
--- fs/xfs/Makefile | 1 - fs/xfs/xfs_error.c | 1 - fs/xfs/xfs_filestream.c | 1 - fs/xfs/xfs_inode.c | 279 ++++++++++++++++++++++++++++++++++++++++- fs/xfs/xfs_inode.h | 7 ++ fs/xfs/xfs_ioctl.c | 1 - fs/xfs/xfs_iomap.c | 1 - fs/xfs/xfs_iops.c | 1 - fs/xfs/xfs_log_recover.c | 1 - fs/xfs/xfs_mount.c | 1 - fs/xfs/xfs_qm.c | 1 - fs/xfs/xfs_qm_syscalls.c | 1 - fs/xfs/xfs_rtalloc.c | 1 - fs/xfs/xfs_super.c | 1 - fs/xfs/xfs_symlink.c | 1 - fs/xfs/xfs_utils.c | 316 ----------------------------------------------- fs/xfs/xfs_utils.h | 27 ---- 17 files changed, 285 insertions(+), 357 deletions(-) delete mode 100644 fs/xfs/xfs_utils.c delete mode 100644 fs/xfs/xfs_utils.h
fs/xfs/Makefile +0 -1
@@ -53,7 +53,6 @@ xfs-y += xfs_aops.o \ xfs_super.o \ xfs_symlink.o \ xfs_trans.o \ - xfs_utils.o \ xfs_xattr.o \ kmem.o \ uuid.o
fs/xfs/xfs_error.c +0 -1
@@ -26,7 +26,6 @@#include "xfs_bmap_btree.h" #include "xfs_dinode.h" #include "xfs_inode.h" -#include "xfs_utils.h" #include "xfs_error.h" #ifdef DEBUG
fs/xfs/xfs_filestream.c +0 -1
@@ -28,7 +28,6 @@#include "xfs_bmap.h" #include "xfs_bmap_util.h" #include "xfs_alloc.h" -#include "xfs_utils.h" #include "xfs_mru_cache.h" #include "xfs_filestream.h" #include "xfs_trace.h"
fs/xfs/xfs_inode.c +278 -1
291 lines not on this page · raw message
fs/xfs/xfs_inode.h +7 -0
@@ -360,6 +360,13 @@ void xfs_lock_two_inodes(xfs_inode_t *, xfs_inode_t *, uint);xfs_extlen_t xfs_get_extsz_hint (struct xfs_inode *ip); +int xfs_dir_ialloc (struct xfs_trans **,struct xfs_inode *,umode_t , +xfs_nlink_t ,xfs_dev_t ,prid_t ,int , +struct xfs_inode **,int *); +int xfs_droplink (struct xfs_trans *,struct xfs_inode *); +int xfs_bumplink (struct xfs_trans *,struct xfs_inode *); +void xfs_bump_ino_vers2 (struct xfs_trans *,struct xfs_inode *); +/* from xfs_file.c */ int xfs_zero_eof (struct xfs_inode *,xfs_off_t ,xfs_fsize_t );int xfs_iozero (struct xfs_inode *,loff_t ,size_t );
fs/xfs/xfs_ioctl.c +0 -1
@@ -35,7 +35,6 @@#include "xfs_bmap.h" #include "xfs_bmap_util.h" #include "xfs_buf_item.h" -#include "xfs_utils.h" #include "xfs_dfrag.h" #include "xfs_fsops.h" #include "xfs_discard.h"
fs/xfs/xfs_iomap.c +0 -1
@@ -40,7 +40,6 @@#include "xfs_attr.h" #include "xfs_buf_item.h" #include "xfs_trans_space.h" -#include "xfs_utils.h" #include "xfs_iomap.h" #include "xfs_trace.h" #include "xfs_icache.h"
fs/xfs/xfs_iops.c +0 -1
@@ -36,7 +36,6 @@#include "xfs_itable.h" #include "xfs_attr.h" #include "xfs_buf_item.h" -#include "xfs_utils.h" #include "xfs_inode_item.h" #include "xfs_trace.h" #include "xfs_icache.h"
fs/xfs/xfs_log_recover.c +0 -1
@@ -41,7 +41,6 @@#include "xfs_extfree_item.h" #include "xfs_trans_priv.h" #include "xfs_quota.h" -#include "xfs_utils.h" #include "xfs_cksum.h" #include "xfs_trace.h" #include "xfs_icache.h"
fs/xfs/xfs_mount.c +0 -1
@@ -42,7 +42,6 @@#include "xfs_error.h" #include "xfs_quota.h" #include "xfs_fsops.h" -#include "xfs_utils.h" #include "xfs_trace.h" #include "xfs_icache.h" #include "xfs_cksum.h"
fs/xfs/xfs_qm.c +0 -1
@@ -38,7 +38,6 @@#include "xfs_attr.h" #include "xfs_buf_item.h" #include "xfs_trans_space.h" -#include "xfs_utils.h" #include "xfs_qm.h" #include "xfs_trace.h" #include "xfs_icache.h"
fs/xfs/xfs_qm_syscalls.c +0 -1
@@ -38,7 +38,6 @@#include "xfs_error.h" #include "xfs_attr.h" #include "xfs_buf_item.h" -#include "xfs_utils.h" #include "xfs_qm.h" #include "xfs_trace.h" #include "xfs_icache.h"
fs/xfs/xfs_rtalloc.c +0 -1
@@ -35,7 +35,6 @@#include "xfs_error.h" #include "xfs_inode_item.h" #include "xfs_trans_space.h" -#include "xfs_utils.h" #include "xfs_trace.h" #include "xfs_buf.h" #include "xfs_icache.h"
fs/xfs/xfs_super.c +0 -1
@@ -40,7 +40,6 @@#include "xfs_fsops.h" #include "xfs_attr.h" #include "xfs_buf_item.h" -#include "xfs_utils.h" #include "xfs_log_priv.h" #include "xfs_trans_priv.h" #include "xfs_filestream.h"
fs/xfs/xfs_symlink.c +0 -1
@@ -38,7 +38,6 @@#include "xfs_bmap_util.h" #include "xfs_error.h" #include "xfs_quota.h" -#include "xfs_utils.h" #include "xfs_trans_space.h" #include "xfs_trace.h" #include "xfs_symlink.h"
fs/xfs/xfs_utils.c deleted +0 -316
316 lines not on this page · raw message
fs/xfs/xfs_utils.h deleted +0 -27
@@ -1,27 +0,0 @@ -/* -* Copyright (c) 2000-2002,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_UTILS_H__ -#define __XFS_UTILS_H__ - -extern int xfs_dir_ialloc (xfs_trans_t **,xfs_inode_t *,umode_t ,xfs_nlink_t , -xfs_dev_t ,prid_t ,int ,xfs_inode_t **,int *); -extern int xfs_droplink (xfs_trans_t *,xfs_inode_t *); -extern int xfs_bumplink (xfs_trans_t *,xfs_inode_t *); -extern void xfs_bump_ino_vers2 (xfs_trans_t *,xfs_inode_t *); - -#endif /* __XFS_UTILS_H__ */
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 26/49] xfs: consolidate xfs_utils.c
Quoted 8 lines · Dave Chinner
From: Dave Chinner<[email protected]>
There are a few small helper functions in
xfs_util, all related toxfs_inodemodifications. Move them all toxfs_inode.cso allxfs_inodeoperations are consiolidated in the one place.Signed-off-by Dave Chinner<[email protected]>---
As noted before, a xfs_utils.h did not get removed from xfs_inode_fork.c
Clean moves with some typedef to struct conversion on the moved function prototypes.
With the removal of xfs_utils.h from xfs_inode_fork.c considered this
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 27/49 xfs: consolidate extent swap code
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
So we don't need xfs_dfrag.h in userspace anymore, move the extent swap ioctl structure definition to xfs_fs.h where most of the other ioctl structure definitions are.
Now that we don't need separate files for extent swapping, separate the basic file descriptor checking code to xfs_ioctl.c, and the code that does the extent swap operation to xfs_bmap_util.c. This cleanly separates the user interface code from the physical mechanism used to do the extent swap.
--- fs/xfs/Makefile | 1 - fs/xfs/xfs_bmap_util.c | 343 ++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_bmap_util.h | 3 + fs/xfs/xfs_dfrag.c | 459 ------------------------------------------------- fs/xfs/xfs_dfrag.h | 53 ------ fs/xfs/xfs_fs.h | 15 ++ fs/xfs/xfs_ioctl.c | 72 +++++++- fs/xfs/xfs_ioctl.h | 4 + fs/xfs/xfs_ioctl32.c | 3 +- 9 files changed, 436 insertions(+), 517 deletions(-) delete mode 100644 fs/xfs/xfs_dfrag.c delete mode 100644 fs/xfs/xfs_dfrag.h
fs/xfs/Makefile +0 -1
@@ -32,7 +32,6 @@ xfs-y += xfs_aops.o \ xfs_bit.o \ xfs_bmap_util.o \ xfs_buf.o \ - xfs_dfrag.o \ xfs_dir2_readdir.o \ xfs_discard.o \ xfs_error.o \
fs/xfs/xfs_bmap_util.c +343 -0
346 lines not on this page · raw message
fs/xfs/xfs_bmap_util.h +3 -0
@@ -102,6 +102,9 @@ bool xfs_can_free_eofblocks(struct xfs_inode *ip, bool force);int xfs_free_eofblocks (struct xfs_mount *mp,struct xfs_inode *ip,bool need_iolock); +int xfs_swap_extents (struct xfs_inode *ip,struct xfs_inode *tip, +struct xfs_swapext *sx); +xfs_daddr_t xfs_fsb_to_db (struct xfs_inode *ip,xfs_fsblock_t fsb);#endif /* __XFS_BMAP_UTIL_H__ */
fs/xfs/xfs_dfrag.c deleted +0 -459
459 lines not on this page · raw message
fs/xfs/xfs_dfrag.h deleted +0 -53
53 lines not on this page · raw message
fs/xfs/xfs_fs.h +15 -0
@@ -461,6 +461,21 @@ typedef struct xfs_handle { + (handle).ha_fid.fid_len)/* +* Structure passed to XFS_IOC_SWAPEXT +*/ +typedef struct xfs_swapext +{ +__int64_t sx_version;/* version */ +#define XFS_SX_VERSION 0 +__int64_t sx_fdtarget;/* fd of target file */ +__int64_t sx_fdtmp;/* fd of tmp file */ +xfs_off_t sx_offset;/* offset into file */ +xfs_off_t sx_length;/* leng from offset */ +char sx_pad[16 ];/* pad space, unused */ +xfs_bstat_t sx_stat;/* stat of target b4 copy */ +}xfs_swapext_t ; + +/* * Flags for going down operation */ #define XFS_FSOP_GOING_FLAGS_DEFAULT 0x0/* going down */
fs/xfs/xfs_ioctl.c +70 -2
90 lines not on this page · raw message
fs/xfs/xfs_ioctl.h +4 -0
@@ -27,6 +27,10 @@ xfs_ioc_space(unsigned int cmd, xfs_flock64_t *bf); +int +xfs_ioc_swapext ( +xfs_swapext_t *sxp); + extern int xfs_find_handle( unsigned int cmd,
fs/xfs/xfs_ioctl32.c +1 -2
@@ -33,7 +33,6 @@#include "xfs_inode.h" #include "xfs_itable.h" #include "xfs_error.h" -#include "xfs_dfrag.h" #include "xfs_fsops.h" #include "xfs_alloc.h" #include "xfs_rtalloc.h"
@@ -643,7 +642,7 @@ xfs_file_compat_ioctl( error =mnt_want_write_file (filp);if (error)return error; - error =xfs_swapext (&sxp); + error =xfs_ioc_swapext (&sxp);mnt_drop_write_file (filp);return -error; }
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 27/49] xfs: consolidate extent swap code
Quoted 6 lines · Dave Chinner
From: Dave Chinner<[email protected]>
So we don't need
xfs_dfrag.hin userspace anymore, move the extent swap ioctl structure definition toxfs_fs.hwhere most of the other ioctl structure definitions are.
Quoted 8 lines
Now that we don't need separate files for extent swapping, separate the basic file descriptor checking code to
xfs_ioctl.c, and the code that does the extent swap operation toxfs_bmap_util.c. This cleanly separates the user interface code from the physical mechanism used to do the extent swap.Signed-off-by Dave Chinner<[email protected]>---
Looks good. Only change is xfs_swapext() is rename xfs_ioc_swapext() when moved to xfs_ioctl.c.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 28/49 xfs: don't special case shared superblock mounts
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Neither kernel or userspace support shared read-only mounts, so don't beother special casing the support check to be different between kernel and userspace. The same check canbe used as neither like it...
--- fs/xfs/xfs_sb.h | 7 ------- 1 file changed, 7 deletions(-)
fs/xfs/xfs_sb.h +0 -7
@@ -355,15 +355,8 @@ static inline int xfs_sb_good_version(xfs_sb_t *sbp) (sbp->sb_features2 & ~XFS_SB_VERSION2_OKREALBITS)))return 0 ; -#ifdef __KERNEL__if (sbp->sb_shared_vn >XFS_SB_MAX_SHARED_VN )return 0 ; -#else -if ((sbp->sb_versionnum &XFS_SB_VERSION_SHAREDBIT ) && - sbp->sb_shared_vn >XFS_SB_MAX_SHARED_VN ) -return 0 ; -#endif -return 1 ; }if (XFS_SB_VERSION_NUM (sbp) ==XFS_SB_VERSION_5 )
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 28/49] xfs: don't special case shared superblock mounts
Quoted 9 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Neither kernel or userspace support shared read-only mounts, so don't beother special casing the support check to be different between kernel and userspace. The same check canbe used as neither like it...
Signed-off-by Dave Chinner<[email protected]>---
looks good, in any case the check will fail.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 29/49 xfs: kill __KERNEL__ check for debug code in allocation code
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Userspace running debug builds is relatively rare, so there's need to special case the allocation algorithm code coverage debug switch. As it is, userspace defines random numbers to 0, so invert the logic of the switch so it is effectively a no-op in userspace. This kills another couple of __KERNEL__ users.
--- fs/xfs/xfs_alloc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/xfs/xfs_alloc.c +3 -3
@@ -878,7 +878,7 @@ xfs_alloc_ag_vextent_near(xfs_agblock_t ltnew;/* useful start bno of left side */ xfs_extlen_t rlen;/* length of returned extent */ int forced =0 ; -#if defined(DEBUG ) && defined(__KERNEL__) +#ifdef DEBUG /* * Randomly don't execute the first algorithm. */
@@ -938,8 +938,8 @@ restart:xfs_extlen_t blen=0 ;xfs_agblock_t bnew=0 ; -#if defined(DEBUG ) && defined(__KERNEL__) -if (!dofirst) +#ifdef DEBUG +if (dofirst)break ;#endif /*
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 29/49] xfs: kill __KERNEL__ check for debug code in allocation code
Quoted 10 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Userspace running debug builds is relatively rare, so there's need to special case the allocation algorithm code coverage debug switch. As it is, userspace defines random numbers to 0, so invert the logic of the switch so it is effectively a no-op in userspace. This kills another couple of
__KERNEL__users.Signed-off-by Dave Chinner<[email protected]>---
No functional change for the kernel. skipping the first allocation algorithm is still 50% for debug kernels.
Change is for user space.
Looks good.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 30/49 xfs: remove __KERNEL__ from debug code
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
There is no reason the remaining kernel-only debug code needs to remain kernel-only. Kill the __KERNEL__ part of the defines, and let userspace handle the debug code appropriately.
--- fs/xfs/xfs_bmap.h | 2 +- fs/xfs/xfs_dir2_data.c | 4 ++-- fs/xfs/xfs_rtalloc.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
fs/xfs/xfs_bmap.h +1 -1
@@ -127,7 +127,7 @@ static inline void xfs_bmap_init(xfs_bmap_free_t *flp, xfs_fsblock_t *fbp) { BMAP_RIGHT_FILLING, "RF" }, \ { BMAP_ATTRFORK, "ATTR" } -#if defined(__KERNEL) && defined(DEBUG ) +#ifdef DEBUG void xfs_bmap_trace_exlist (struct xfs_inode *ip,xfs_extnum_t cnt,int whichfork,unsigned long caller_ip);#define XFS_BMAP_TRACE_EXLIST (ip,c,w) \
fs/xfs/xfs_dir2_data.c +2 -2
@@ -331,7 +331,7 @@ xfs_dir2_data_freefind(xfs_dir2_data_free_t *dfp;/* bestfree entry */ xfs_dir2_data_aoff_t off;/* offset value needed */ struct xfs_dir2_data_free *bf; -#if defined(DEBUG ) && defined(__KERNEL__) +#ifdef DEBUG int matched;/* matched the value */ int seenzero;/* saw a 0 bestfree entry */ #endif
@@ -339,7 +339,7 @@ xfs_dir2_data_freefind( off = (xfs_dir2_data_aoff_t)((char *)dup - (char *)hdr); bf =xfs_dir3_data_bestfree_p (hdr); -#if defined(DEBUG ) && defined(__KERNEL__) +#ifdef DEBUG /* * Validate some consistency in the bestfree table. * Check order, non-overlapping entries, and if we find the
fs/xfs/xfs_rtalloc.c +1 -1
@@ -2147,7 +2147,7 @@ xfs_rtfree_extent(ASSERT (mp->m_rbmip->i_itemp !=NULL );ASSERT (xfs_isilocked (mp->m_rbmip,XFS_ILOCK_EXCL )); -#if defined(__KERNEL__) && defined(DEBUG ) +#ifdef DEBUG /* * Check to see that this whole range is currently allocated. */
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 30/49] xfs: remove __KERNEL__ from debug code
Quoted 8 lines · Dave Chinner
From: Dave Chinner<[email protected]>
There is no reason the remaining kernel-only debug code needs to remain kernel-only. Kill the
__KERNEL__part of the defines, and let userspace handle the debug code appropriately.Signed-off-by Dave Chinner<[email protected]>---
No change for the kernel.
Allows the bestfree table validation and the real time block range is allocated tests be used in user space.
Looks good.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 31/49 xfs: remove __KERNEL__ check from xfs_dir2_leaf.c
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
It's actually an ifndef section, which means it is only included in userspace. however, it's deep within the libxfs code, so it's unlikely that the condition checked in userspace can actually occur (search an empty leaf) through the libxfs interfaces. i.e. if it can happen in usrspace, it can happen in the kernel, so remove it from userspace too....
--- fs/xfs/xfs_dir2_leaf.c | 4 ---- 1 file changed, 4 deletions(-)
fs/xfs/xfs_dir2_leaf.c +0 -4
@@ -1586,10 +1586,6 @@ xfs_dir2_leaf_search_hash( ents =xfs_dir3_leaf_ents_p (leaf);xfs_dir3_leaf_hdr_from_disk (&leafhdr, leaf); -#ifndef __KERNEL__ -if (!leafhdr.count) -return 0 ; -#endif /* * Note, the table cannot be empty, so we have to go through the loop. * Binary search the leaf entries looking for our hash value.
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 31/49] xfs: remove __KERNEL__ check from xfs_dir2_leaf.c
Quoted 11 lines · Dave Chinner
From: Dave Chinner<[email protected]>
It's actually an ifndef section, which means it is only included in userspace. however, it's deep within the libxfs code, so it's unlikely that the condition checked in userspace can actually occur (search an empty leaf) through the libxfs interfaces. i.e. if it can happen in usrspace, it can happen in the kernel, so remove it from userspace too....
Signed-off-by Dave Chinner<[email protected]>---
Looks good for the kernel.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 32/49 xfs: xfs_filestreams.h doesn't need __KERNEL__
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Because it is only used within the kernel.
--- fs/xfs/xfs_filestream.h | 4 ---- 1 file changed, 4 deletions(-)
fs/xfs/xfs_filestream.h +0 -4
@@ -18,8 +18,6 @@#ifndef __XFS_FILESTREAM_H__#define __XFS_FILESTREAM_H__ -#ifdef __KERNEL__ -struct xfs_mount ;struct xfs_inode ;struct xfs_perag ;
@@ -69,6 +67,4 @@ xfs_inode_is_filestream( (ip->i_d.di_flags & XFS_DIFLAG_FILESTREAM); } -#endif /* __KERNEL__ */ -#endif /* __XFS_FILESTREAM_H__ */
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 32/49] xfs: xfs_filestreams.h doesn't need __KERNEL__
Quoted 6 lines · Dave Chinner
From: Dave Chinner<[email protected]>
Because it is only used within the kernel.
Signed-off-by Dave Chinner<[email protected]>---
Looks good.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 33/49 xfs: move kernel specific type definitions to xfs.h
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
xfs_types.h is shared with userspace, so having kernel specific types defined in it is problematic. Move all the kernel specific defines to xfs_linux.h so we can remove the __KERNEL__ guards from xfs_types.h
--- fs/xfs/xfs_linux.h | 32 ++++++++++++++++++++++++++++++++ fs/xfs/xfs_types.h | 36 ------------------------------------ 2 files changed, 32 insertions(+), 36 deletions(-)
fs/xfs/xfs_linux.h +32 -0
@@ -32,6 +32,38 @@# define XFS_BIG_INUMS 0#endif +/* +* Kernel specific type declarations for XFS +*/ +typedef signed char __int8_t ; +typedef unsigned char __uint8_t ; +typedef signed short int __int16_t ; +typedef unsigned short int __uint16_t ; +typedef signed int __int32_t ; +typedef unsigned int __uint32_t ; +typedef signed long long int __int64_t ; +typedef unsigned long long int __uint64_t ; + +typedef __uint32_t inst_t ;/* an instruction */ + +typedef __s64 xfs_off_t ;/* <file offset> type */ +typedef unsigned long long xfs_ino_t ;/* <inode> type */ +typedef __s64 xfs_daddr_t ;/* <disk address> type */ +typedef char *xfs_caddr_t ;/* <core address> type */ +typedef __u32 xfs_dev_t ; +typedef __u32 xfs_nlink_t ; + +/* __psint_t is the same size as a pointer */ +#if (BITS_PER_LONG ==32 ) +typedef __int32_t __psint_t ; +typedef __uint32_t __psunsigned_t ; +#elif (BITS_PER_LONG ==64 ) +typedef __int64_t __psint_t ; +typedef __uint64_t __psunsigned_t ; +#else +#error BITS_PER_LONG must be 32 or 64 +#endif +#include "xfs_types.h" #include "kmem.h"
fs/xfs/xfs_types.h +0 -36
@@ -18,42 +18,6 @@#ifndef __XFS_TYPES_H__#define __XFS_TYPES_H__ -#ifdef __KERNEL__ - -/* -* Additional type declarations for XFS -*/ -typedef signed char __int8_t ; -typedef unsigned char __uint8_t ; -typedef signed short int __int16_t ; -typedef unsigned short int __uint16_t ; -typedef signed int __int32_t ; -typedef unsigned int __uint32_t ; -typedef signed long long int __int64_t ; -typedef unsigned long long int __uint64_t ; - -typedef __uint32_t inst_t ;/* an instruction */ - -typedef __s64 xfs_off_t ;/* <file offset> type */ -typedef unsigned long long xfs_ino_t ;/* <inode> type */ -typedef __s64 xfs_daddr_t ;/* <disk address> type */ -typedef char *xfs_caddr_t ;/* <core address> type */ -typedef __u32 xfs_dev_t ; -typedef __u32 xfs_nlink_t ; - -/* __psint_t is the same size as a pointer */ -#if (BITS_PER_LONG ==32 ) -typedef __int32_t __psint_t ; -typedef __uint32_t __psunsigned_t ; -#elif (BITS_PER_LONG ==64 ) -typedef __int64_t __psint_t ; -typedef __uint64_t __psunsigned_t ; -#else -#error BITS_PER_LONG must be 32 or 64 -#endif - -#endif /* __KERNEL__ */ -typedef __uint32_t prid_t ;/* project ID */ typedef __uint32_t xfs_agblock_t ;/* blockno in alloc. group */
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 33/49] xfs: move kernel specific type definitions to xfs.h
Quoted 9 lines · Dave Chinner
From: Dave Chinner<[email protected]>
xfs_types.his shared with userspace, so having kernel specific types defined in it is problematic. Move all the kernel specific defines toxfs_linux.hso we can remove the__KERNEL__guards fromxfs_types.hSigned-off-by Dave Chinner<[email protected]>---
Looks good.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 34/49 xfs: make struct xfs_perag kernel only
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The struct xfs_perag has many kernel-only definitions in it, requiring a __KERNEL__ guard so userspace can use it to. Move it to xfs_mount.h so that it it kernel-only, and let userspace redefine it's own version of the structure containing only what it needs. This gets rid of another __KERNEL__ check in the XFS header files.
--- fs/xfs/xfs_acl.c | 1 + fs/xfs/xfs_ag.h | 53 --------------------------------------------- fs/xfs/xfs_mount.h | 52 ++++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_symlink_remote.c | 1 + 4 files changed, 54 insertions(+), 53 deletions(-)
fs/xfs/xfs_acl.c +1 -0
@@ -22,6 +22,7 @@#include "xfs_attr.h" #include "xfs_bmap_btree.h" #include "xfs_inode.h" +#include "xfs_ag.h" #include "xfs_sb.h" #include "xfs_mount.h" #include "xfs_trace.h"
fs/xfs/xfs_ag.h +0 -53
59 lines not on this page · raw message
fs/xfs/xfs_mount.h +52 -0
58 lines not on this page · raw message
fs/xfs/xfs_symlink_remote.c +1 -0
@@ -21,6 +21,7 @@#include "xfs_format.h" #include "xfs_log.h" #include "xfs_trans.h" +#include "xfs_ag.h" #include "xfs_sb.h" #include "xfs_mount.h" #include "xfs_bmap_btree.h"
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 34/49] xfs: make struct xfs_perag kernel only
Quoted 10 lines · Dave Chinner
From: Dave Chinner<[email protected]>
The struct
xfs_peraghas many kernel-only definitions in it, requiring a__KERNEL__guard so userspace can use it to. Move it toxfs_mount.hso that it it kernel-only, and let userspace redefine it's own version of the structure containing only what it needs. This gets rid of another__KERNEL__check in the XFS header files.Signed-off-by Dave Chinner<[email protected]>---
moves the xfs_perag structure and adds a comment to why it is moved.
looks good.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 35/49 xfs: Introduce a new structure to hold transaction reservation items
In reply to Dave ChinnerFrom: Jie Liu <[email protected]>
Introduce a new structure xfs_trans_res to hold transaction reservation item info per log ticket.
We also need to improve xfs_trans_resv_calc() by initializing the log count as well as log flags for permanent log reservation.
--- fs/xfs/xfs_mount.h | 2 +- fs/xfs/xfs_trans.c | 2 +- fs/xfs/xfs_trans_resv.c | 121 +++++++++++++++++++++++++++++++++++----------- fs/xfs/xfs_trans_resv.h | 125 ++++++++++++++++++++++++++---------------------- 4 files changed, 163 insertions(+), 87 deletions(-)
fs/xfs/xfs_mount.h +1 -1
@@ -136,7 +136,7 @@ typedef struct xfs_mount {int m_ialloc_blks;/* blocks in inode allocation */ int m_inoalign_mask;/* mask sb_inoalignmt if used */ uint m_qflags;/* quota status flags */ -struct xfs_trans_resv m_reservations;/* precomputed res values */ +struct xfs_trans_resv m_resv;/* precomputed res values */ __uint64_t m_maxicount;/* maximum inode count */ __uint64_t m_resblks;/* total reserved blocks */ __uint64_t m_resblks_avail;/* available reserved blocks */
fs/xfs/xfs_trans.c +1 -1
@@ -56,7 +56,7 @@ voidxfs_trans_init ( struct xfs_mount *mp) { -xfs_trans_resv_calc (mp, &mp->m_reservations); +xfs_trans_resv_calc (mp, &mp->m_resv); }/*
fs/xfs/xfs_trans_resv.c +93 -28
125 lines not on this page · raw message
fs/xfs/xfs_trans_resv.h +68 -57
142 lines not on this page · raw message
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 35/49] xfs: Introduce a new structure to hold transaction reservation items
Quoted 11 lines · Dave Chinner
From: Jie Liu<[email protected]>
Introduce a new structure
xfs_trans_resto hold transaction reservation item info per log ticket.We also need to improve
xfs_trans_resv_calc()by initializing the log count as well as log flags for permanent log reservation.Signed-off-by Jie Liu<[email protected]>Signed-off-by Dave Chinner<[email protected]>---
Looks good.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 36/49 xfs: Introduce tr_fsyncts to m_reservation
In reply to Dave ChinnerFrom: Jie Liu <[email protected]>
A preparation step.
For now fsync_ts transaction use the pre-calculated log reservation size of tr_swrite.
This patch introduce a new item tr_fsyncts to mp->m_reservations structure so that we can fetch the log reservation value for it in a same manner to others.
--- fs/xfs/xfs_trans_resv.c | 1 + fs/xfs/xfs_trans_resv.h | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-)
fs/xfs/xfs_trans_resv.c +1 -0
@@ -759,6 +759,7 @@ xfs_trans_resv_calc( resp->tr_ichange.tr_logres =xfs_calc_ichange_reservation (mp); resp->tr_growdata.tr_logres =xfs_calc_growdata_reservation (mp); resp->tr_swrite.tr_logres =xfs_calc_swrite_reservation (mp); + resp->tr_fsyncts.tr_logres =xfs_calc_swrite_reservation (mp); resp->tr_writeid.tr_logres =xfs_calc_writeid_reservation (mp); resp->tr_attrsetrt.tr_logres =xfs_calc_attrsetrt_reservation (mp); resp->tr_clearagi.tr_logres =xfs_calc_clear_agi_bucket_reservation (mp);
fs/xfs/xfs_trans_resv.h +2 -1
@@ -62,6 +62,7 @@ struct xfs_trans_resv {struct xfs_trans_res tr_qm_quotaoff;/* turn quota off */ struct xfs_trans_res tr_qm_equotaoff;/* end of turn quota off */ struct xfs_trans_res tr_sb;/* modify superblock */ +struct xfs_trans_res tr_fsyncts;/* update timestamps on fsync */ };/*
@@ -109,7 +110,7 @@ struct xfs_trans_resv {* Logging the inode timestamps on an fsync -- same as SWRITE * as long as SWRITE logs the entire inode core */ -#define XFS_FSYNC_TS_LOG_RES (mp) ((mp)->m_resv.tr_swrite.tr_logres) +#define XFS_FSYNC_TS_LOG_RES (mp) ((mp)->m_resv.tr_fsyncts.tr_logres)#define XFS_WRITEID_LOG_RES (mp) ((mp)->m_resv.tr_swrite.tr_logres)#define XFS_ADDAFORK_LOG_RES (mp) ((mp)->m_resv.tr_addafork.tr_logres)#define XFS_ATTRSETM_LOG_RES (mp) ((mp)->m_resv.tr_attrsetm.tr_logres)
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 36/49] xfs: Introduce tr_fsyncts to m_reservation
Quoted 4 lines · Dave Chinner
From: Jie Liu<[email protected]>
A preparation step.
Quoted 8 lines
For now
fsync_tstransaction use the pre-calculated log reservation size oftr_swrite.
This patch introduce a new itemtr_fsynctstomp->m_reservationsstructure so that we can fetch the log reservation value for it in a same manner to others.Signed-off-by Jie Liu<[email protected]>---
Looks good.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 37/49 xfs: Make writeid transaction use tr_writeid
In reply to Dave ChinnerFrom: Jie Liu <[email protected]>
tr_writeid is defined at mp->m_resv structure, however, it does not really being used when it should be..
This patch changes it to tr_writeid to fetch the correct log reservation size.
--- fs/xfs/xfs_trans_resv.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/xfs_trans_resv.h +1 -1
@@ -111,7 +111,7 @@ struct xfs_trans_resv {* as long as SWRITE logs the entire inode core */ #define XFS_FSYNC_TS_LOG_RES (mp) ((mp)->m_resv.tr_fsyncts.tr_logres) -#define XFS_WRITEID_LOG_RES (mp) ((mp)->m_resv.tr_swrite.tr_logres) +#define XFS_WRITEID_LOG_RES (mp) ((mp)->m_resv.tr_writeid.tr_logres)#define XFS_ADDAFORK_LOG_RES (mp) ((mp)->m_resv.tr_addafork.tr_logres)#define XFS_ATTRSETM_LOG_RES (mp) ((mp)->m_resv.tr_attrsetm.tr_logres)#define XFS_ATTRINVAL_LOG_RES (mp) ((mp)->m_resv.tr_attrinval.tr_logres)
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 37/49] xfs: Make writeid transaction use tr_writeid
Quoted 11 lines · Dave Chinner
From: Jie Liu<[email protected]>
tr_writeidis defined atmp->m_resvstructure, however, it does not really being used when it should be..This patch changes it to
tr_writeidto fetch the correct log reservation size.Signed-off-by Jie Liu<[email protected]>Signed-off-by Dave Chinner<[email protected]>---
Looks good.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 38/49 xfs: refactor xfs_trans_reserve() interface
In reply to Dave ChinnerFrom: Jie Liu <[email protected]>
With the new xfs_trans_res structure has been introduced, the log reservation size, log count as well as log flags are pre-initialized at mount time. So it's time to refine xfs_trans_reserve() interface to be more neat.
Also, introduce a new helper M_RES() to return a pointer to the mp->m_resv structure to simplify the input.
--- fs/xfs/xfs_aops.c | 2 +- fs/xfs/xfs_attr.c | 33 +++++++++-------- fs/xfs/xfs_attr_inactive.c | 5 ++- fs/xfs/xfs_bmap.c | 4 +-- fs/xfs/xfs_bmap_util.c | 42 ++++++++-------------- fs/xfs/xfs_dquot.c | 6 ++-- fs/xfs/xfs_fsops.c | 8 ++--- fs/xfs/xfs_inode.c | 88 +++++++++++++++++++--------------------------- fs/xfs/xfs_ioctl.c | 4 +-- fs/xfs/xfs_iomap.c | 18 ++++------ fs/xfs/xfs_iops.c | 8 ++--- fs/xfs/xfs_log_recover.c | 5 ++- fs/xfs/xfs_mount.c | 9 ++--- fs/xfs/xfs_qm.c | 11 +++--- fs/xfs/xfs_qm_syscalls.c | 13 +++---- fs/xfs/xfs_rtalloc.c | 17 ++++----- fs/xfs/xfs_symlink.c | 10 +++--- fs/xfs/xfs_trans.c | 51 ++++++++++++++------------- fs/xfs/xfs_trans.h | 3 +- fs/xfs/xfs_trans_resv.c | 7 ++-- fs/xfs/xfs_trans_resv.h | 3 ++ 21 files changed, 150 insertions(+), 197 deletions(-)
fs/xfs/xfs_aops.c +1 -1
@@ -116,7 +116,7 @@ xfs_setfilesize_trans_alloc( tp =xfs_trans_alloc (mp,XFS_TRANS_FSYNC_TS ); - error =xfs_trans_reserve (tp,0 ,XFS_FSYNC_TS_LOG_RES (mp),0 ,0 ,0 ); + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_fsyncts,0 ,0 );if (error) {xfs_trans_cancel (tp,0 );return error;
fs/xfs/xfs_attr.c +16 -17
@@ -226,13 +226,14 @@ xfs_attr_set_int( int valuelen, int flags) { -xfs_da_args_t args; -xfs_fsblock_t firstblock; -xfs_bmap_free_t flist; -int error, err2, committed; -xfs_mount_t *mp = dp->i_mount; -int rsvd = (flags &ATTR_ROOT ) !=0 ; -int local; +xfs_da_args_t args; +xfs_fsblock_t firstblock; +xfs_bmap_free_t flist; +int error, err2, committed; +struct xfs_mount *mp = dp->i_mount; +struct xfs_trans_res tres; +int rsvd = (flags &ATTR_ROOT ) !=0 ; +int local;/* * Attach the dquots to the inode.
@@ -292,11 +293,11 @@ xfs_attr_set_int(if (rsvd) args.trans->t_flags |=XFS_TRANS_RESERVE ; - error =xfs_trans_reserve (args.trans, args.total, -XFS_ATTRSETM_LOG_RES (mp) + -XFS_ATTRSETRT_LOG_RES (mp) * args.total, -0 ,XFS_TRANS_PERM_LOG_RES , -XFS_ATTRSET_LOG_COUNT ); + tres.tr_logres =M_RES (mp)->tr_attrsetm.tr_logres + +M_RES (mp)->tr_attrsetrt.tr_logres * args.total; + tres.tr_logcount =XFS_ATTRSET_LOG_COUNT ; + tres.tr_logflags =XFS_TRANS_PERM_LOG_RES ; + error =xfs_trans_reserve (args.trans, &tres, args.total,0 );if (error) {xfs_trans_cancel (args.trans,0 );return (error);
@@ -516,11 +517,9 @@ xfs_attr_remove_int(xfs_inode_t *dp, struct xfs_name *name, int flags)if (flags &ATTR_ROOT ) args.trans->t_flags |=XFS_TRANS_RESERVE ; -if ((error =xfs_trans_reserve (args.trans, -XFS_ATTRRM_SPACE_RES (mp), -XFS_ATTRRM_LOG_RES (mp), -0 ,XFS_TRANS_PERM_LOG_RES , -XFS_ATTRRM_LOG_COUNT ))) { + error =xfs_trans_reserve (args.trans, &M_RES (mp)->tr_attrrm, +XFS_ATTRRM_SPACE_RES (mp),0 ); +if (error) {xfs_trans_cancel (args.trans,0 );return (error); }
fs/xfs/xfs_attr_inactive.c +2 -3
@@ -412,9 +412,8 @@ xfs_attr_inactive(xfs_inode_t *dp)* the log. */ trans =xfs_trans_alloc (mp,XFS_TRANS_ATTRINVAL ); -if ((error =xfs_trans_reserve (trans,0 ,XFS_ATTRINVAL_LOG_RES (mp),0 , -XFS_TRANS_PERM_LOG_RES , -XFS_ATTRINVAL_LOG_COUNT ))) { + error =xfs_trans_reserve (trans, &M_RES (mp)->tr_attrinval,0 ,0 ); +if (error) {xfs_trans_cancel (trans,0 );return (error); }
fs/xfs/xfs_bmap.c +2 -2
@@ -1148,8 +1148,8 @@ xfs_bmap_add_attrfork( blks =XFS_ADDAFORK_SPACE_RES (mp);if (rsvd) tp->t_flags |=XFS_TRANS_RESERVE ; -if ((error =xfs_trans_reserve (tp, blks,XFS_ADDAFORK_LOG_RES (mp),0 , -XFS_TRANS_PERM_LOG_RES ,XFS_ADDAFORK_LOG_COUNT ))) + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_addafork, blks,0 ); +if (error) goto error0;xfs_ilock (ip,XFS_ILOCK_EXCL ); error = xfs_trans_reserve_quota_nblks(tp, ip, blks, 0, rsvd ?
fs/xfs/xfs_bmap_util.c +15 -27
90 lines not on this page · raw message
fs/xfs/xfs_dquot.c +2 -4
@@ -712,10 +712,8 @@ xfs_qm_dqread(if (flags &XFS_QMOPT_DQALLOC ) { tp =xfs_trans_alloc (mp,XFS_TRANS_QM_DQALLOC ); - error =xfs_trans_reserve (tp,XFS_QM_DQALLOC_SPACE_RES (mp), -XFS_QM_DQALLOC_LOG_RES (mp),0 , -XFS_TRANS_PERM_LOG_RES , -XFS_WRITE_LOG_COUNT ); + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_attrsetm, +XFS_QM_DQALLOC_SPACE_RES (mp),0 );if (error) goto error1; cancelflags =XFS_TRANS_RELEASE_LOG_RES ;
fs/xfs/xfs_fsops.c +4 -4
@@ -203,8 +203,9 @@ xfs_growfs_data_private( tp =xfs_trans_alloc (mp,XFS_TRANS_GROWFS ); tp->t_flags |=XFS_TRANS_RESERVE ; -if ((error =xfs_trans_reserve (tp,XFS_GROWFS_SPACE_RES (mp), -XFS_GROWDATA_LOG_RES (mp),0 ,0 ,0 ))) { + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_growdata, +XFS_GROWFS_SPACE_RES (mp),0 ); +if (error) {xfs_trans_cancel (tp,0 );return error; }
@@ -739,8 +740,7 @@ xfs_fs_log_dummy(int error; tp =_xfs_trans_alloc (mp,XFS_TRANS_DUMMY1 ,KM_SLEEP ); - error =xfs_trans_reserve (tp,0 ,XFS_SB_LOG_RES (mp),0 ,0 , -XFS_DEFAULT_LOG_COUNT ); + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_sb,0 ,0 );if (error) {xfs_trans_cancel (tp,0 );return error;
fs/xfs/xfs_inode.c +36 -52
189 lines not on this page · raw message
fs/xfs/xfs_ioctl.c +2 -2
@@ -367,7 +367,7 @@ xfs_set_dmattrs(return XFS_ERROR (EIO ); tp =xfs_trans_alloc (mp,XFS_TRANS_SET_DMATTRS ); - error =xfs_trans_reserve (tp,0 ,XFS_ICHANGE_LOG_RES (mp),0 ,0 ,0 ); + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_ichange,0 ,0 );if (error) {xfs_trans_cancel (tp,0 );return error;
@@ -1001,7 +1001,7 @@ xfs_ioctl_setattr(* first do an error checking pass. */ tp =xfs_trans_alloc (mp,XFS_TRANS_SETATTR_NOT_SIZE ); - code =xfs_trans_reserve (tp,0 ,XFS_ICHANGE_LOG_RES (mp),0 ,0 ,0 ); + code =xfs_trans_reserve (tp, &M_RES (mp)->tr_ichange,0 ,0 );if (code) goto error_return;
fs/xfs/xfs_iomap.c +6 -12
@@ -188,10 +188,8 @@ xfs_iomap_write_direct(* Allocate and setup the transaction */ tp =xfs_trans_alloc (mp,XFS_TRANS_DIOSTRAT ); - error =xfs_trans_reserve (tp, resblks, -XFS_WRITE_LOG_RES (mp), resrtextents, -XFS_TRANS_PERM_LOG_RES , -XFS_WRITE_LOG_COUNT ); + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_write, + resblks, resrtextents);/* * Check for running out of space, note: need lock to return */
@@ -699,10 +697,8 @@ xfs_iomap_write_allocate( tp =xfs_trans_alloc (mp,XFS_TRANS_STRAT_WRITE ); tp->t_flags |=XFS_TRANS_RESERVE ; nres =XFS_EXTENTADD_SPACE_RES (mp,XFS_DATA_FORK ); - error =xfs_trans_reserve (tp, nres, -XFS_WRITE_LOG_RES (mp), -0 ,XFS_TRANS_PERM_LOG_RES , -XFS_WRITE_LOG_COUNT ); + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_write, + nres,0 );if (error) {xfs_trans_cancel (tp,0 );return XFS_ERROR (error);
@@ -865,10 +861,8 @@ xfs_iomap_write_unwritten(sb_start_intwrite (mp->m_super); tp =_xfs_trans_alloc (mp,XFS_TRANS_STRAT_WRITE ,KM_NOFS ); tp->t_flags |=XFS_TRANS_RESERVE |XFS_TRANS_FREEZE_PROT ; - error =xfs_trans_reserve (tp, resblks, -XFS_WRITE_LOG_RES (mp),0 , -XFS_TRANS_PERM_LOG_RES , -XFS_WRITE_LOG_COUNT ); + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_write, + resblks,0 );if (error) {xfs_trans_cancel (tp,0 );return XFS_ERROR (error);
fs/xfs/xfs_iops.c +3 -5
@@ -546,7 +546,7 @@ xfs_setattr_nonsize( } tp =xfs_trans_alloc (mp,XFS_TRANS_SETATTR_NOT_SIZE ); - error =xfs_trans_reserve (tp,0 ,XFS_ICHANGE_LOG_RES (mp),0 ,0 ,0 ); + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_ichange,0 ,0 );if (error) goto out_dqrele;
@@ -808,9 +808,7 @@ xfs_setattr_size( goto out_unlock; tp =xfs_trans_alloc (mp,XFS_TRANS_SETATTR_SIZE ); - error =xfs_trans_reserve (tp,0 ,XFS_ITRUNCATE_LOG_RES (mp),0 , -XFS_TRANS_PERM_LOG_RES , -XFS_ITRUNCATE_LOG_COUNT ); + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_itruncate,0 ,0 );if (error) goto out_trans_cancel;
@@ -933,7 +931,7 @@ xfs_vn_update_time(trace_xfs_update_time (ip); tp =xfs_trans_alloc (mp,XFS_TRANS_FSYNC_TS ); - error =xfs_trans_reserve (tp,0 ,XFS_FSYNC_TS_LOG_RES (mp),0 ,0 ,0 ); + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_fsyncts,0 ,0 );if (error) {xfs_trans_cancel (tp,0 );return -error;
fs/xfs/xfs_log_recover.c +2 -3
@@ -3368,7 +3368,7 @@ xlog_recover_process_efi( } tp =xfs_trans_alloc (mp,0 ); - error =xfs_trans_reserve (tp,0 ,XFS_ITRUNCATE_LOG_RES (mp),0 ,0 ,0 ); + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_itruncate,0 ,0 );if (error) goto abort_error; efdp =xfs_trans_get_efd (tp, efip, efip->efi_format.efi_nextents);
@@ -3474,8 +3474,7 @@ xlog_recover_clear_agi_bucket(int error; tp =xfs_trans_alloc (mp,XFS_TRANS_CLEAR_AGI_BUCKET ); - error =xfs_trans_reserve (tp,0 ,XFS_CLEAR_AGI_BUCKET_LOG_RES (mp), -0 ,0 ,0 ); + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_clearagi,0 ,0 );if (error) goto out_abort;
fs/xfs/xfs_mount.c +3 -6
@@ -596,8 +596,7 @@ xfs_mount_reset_sbqflags(return 0 ; tp =xfs_trans_alloc (mp,XFS_TRANS_QM_SBCHANGE ); - error =xfs_trans_reserve (tp,0 ,XFS_QM_SBCHANGE_LOG_RES (mp), -0 ,0 ,XFS_DEFAULT_LOG_COUNT ); + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_qm_sbchange,0 ,0 );if (error) {xfs_trans_cancel (tp,0 );xfs_alert (mp,"%s: Superblock update failed!" , __func__);
@@ -1070,8 +1069,7 @@ xfs_log_sbcount(xfs_mount_t *mp)return 0 ; tp =_xfs_trans_alloc (mp,XFS_TRANS_SB_COUNT ,KM_SLEEP ); - error =xfs_trans_reserve (tp,0 ,XFS_SB_LOG_RES (mp),0 ,0 , -XFS_DEFAULT_LOG_COUNT ); + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_sb,0 ,0 );if (error) {xfs_trans_cancel (tp,0 );return error;
@@ -1391,8 +1389,7 @@ xfs_mount_log_sb( XFS_SB_VERSIONNUM)); tp =xfs_trans_alloc (mp,XFS_TRANS_SB_UNIT ); - error =xfs_trans_reserve (tp,0 ,XFS_SB_LOG_RES (mp),0 ,0 , -XFS_DEFAULT_LOG_COUNT ); + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_sb,0 ,0 );if (error) {xfs_trans_cancel (tp,0 );return error;
fs/xfs/xfs_qm.c +4 -7
@@ -835,11 +835,9 @@ xfs_qm_qino_alloc(int committed; tp =xfs_trans_alloc (mp,XFS_TRANS_QM_QINOCREATE ); -if ((error =xfs_trans_reserve (tp, -XFS_QM_QINOCREATE_SPACE_RES (mp), -XFS_CREATE_LOG_RES (mp),0 , -XFS_TRANS_PERM_LOG_RES , -XFS_CREATE_LOG_COUNT ))) { + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_create, +XFS_QM_QINOCREATE_SPACE_RES (mp),0 ); +if (error) {xfs_trans_cancel (tp,0 );return error; }
@@ -1704,8 +1702,7 @@ xfs_qm_write_sb_changes(int error; tp =xfs_trans_alloc (mp,XFS_TRANS_QM_SBCHANGE ); - error =xfs_trans_reserve (tp,0 ,XFS_QM_SBCHANGE_LOG_RES (mp), -0 ,0 ,XFS_DEFAULT_LOG_COUNT ); + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_qm_sbchange,0 ,0 );if (error) {xfs_trans_cancel (tp,0 );return error;
fs/xfs/xfs_qm_syscalls.c +4 -9
@@ -247,9 +247,7 @@ xfs_qm_scall_trunc_qfile(xfs_ilock (ip,XFS_IOLOCK_EXCL ); tp =xfs_trans_alloc (mp,XFS_TRANS_TRUNCATE_FILE ); - error =xfs_trans_reserve (tp,0 ,XFS_ITRUNCATE_LOG_RES (mp),0 , -XFS_TRANS_PERM_LOG_RES , -XFS_ITRUNCATE_LOG_COUNT ); + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_itruncate,0 ,0 );if (error) {xfs_trans_cancel (tp,0 );xfs_iunlock (ip,XFS_IOLOCK_EXCL );
@@ -515,8 +513,7 @@ xfs_qm_scall_setqlim(xfs_dqunlock (dqp); tp =xfs_trans_alloc (mp,XFS_TRANS_QM_SETQLIM ); - error =xfs_trans_reserve (tp,0 ,XFS_QM_SETQLIM_LOG_RES (mp), -0 ,0 ,XFS_DEFAULT_LOG_COUNT ); + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_qm_setqlim,0 ,0 );if (error) {xfs_trans_cancel (tp,0 ); goto out_rele;
@@ -650,8 +647,7 @@ xfs_qm_log_quotaoff_end( tp =xfs_trans_alloc (mp,XFS_TRANS_QM_QUOTAOFF_END ); - error =xfs_trans_reserve (tp,0 ,XFS_QM_QUOTAOFF_END_LOG_RES (mp), -0 ,0 ,XFS_DEFAULT_LOG_COUNT ); + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_qm_equotaoff,0 ,0 );if (error) {xfs_trans_cancel (tp,0 );return (error);
@@ -684,8 +680,7 @@ xfs_qm_log_quotaoff(uint oldsbqflag=0 ; tp =xfs_trans_alloc (mp,XFS_TRANS_QM_QUOTAOFF ); - error =xfs_trans_reserve (tp,0 ,XFS_QM_QUOTAOFF_LOG_RES (mp), -0 ,0 ,XFS_DEFAULT_LOG_COUNT ); + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_qm_quotaoff,0 ,0 );if (error) goto error0;
fs/xfs/xfs_rtalloc.c +9 -8
@@ -100,10 +100,9 @@ xfs_growfs_rt_alloc(/* * Reserve space & log for one extent added to the file. */ -if ((error =xfs_trans_reserve (tp, resblks, -XFS_GROWRTALLOC_LOG_RES (mp),0 , -XFS_TRANS_PERM_LOG_RES , -XFS_DEFAULT_PERM_LOG_COUNT ))) + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_growdata, + resblks,0 ); +if (error) goto error_cancel; cancelflags =XFS_TRANS_RELEASE_LOG_RES ;/*
@@ -146,8 +145,9 @@ xfs_growfs_rt_alloc(/* * Reserve log for one block zeroing. */ -if ((error =xfs_trans_reserve (tp,0 , -XFS_GROWRTZERO_LOG_RES (mp),0 ,0 ,0 ))) + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_growrtzero, +0 ,0 ); +if (error) goto error_cancel;/* * Lock the bitmap inode.
@@ -1957,8 +1957,9 @@ xfs_growfs_rt(* Start a transaction, get the log reservation. */ tp =xfs_trans_alloc (mp,XFS_TRANS_GROWFSRT_FREE ); -if ((error =xfs_trans_reserve (tp,0 , -XFS_GROWRTFREE_LOG_RES (nmp),0 ,0 ,0 ))) + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_growrtfree, +0 ,0 ); +if (error) goto error_cancel;/* * Lock out other callers by grabbing the bitmap inode lock.
fs/xfs/xfs_symlink.c +4 -6
@@ -231,12 +231,10 @@ xfs_symlink(else fs_blocks =xfs_symlink_blocks (mp, pathlen); resblks =XFS_SYMLINK_SPACE_RES (mp, link_name->len, fs_blocks); - error =xfs_trans_reserve (tp, resblks,XFS_SYMLINK_LOG_RES (mp),0 , -XFS_TRANS_PERM_LOG_RES ,XFS_SYMLINK_LOG_COUNT ); + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_symlink, resblks,0 );if (error ==ENOSPC && fs_blocks ==0 ) { resblks =0 ; - error =xfs_trans_reserve (tp,0 ,XFS_SYMLINK_LOG_RES (mp),0 , -XFS_TRANS_PERM_LOG_RES ,XFS_SYMLINK_LOG_COUNT ); + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_symlink,0 ,0 ); }if (error) { cancel_flags =0 ;
@@ -539,8 +537,8 @@ xfs_inactive_symlink_rmt(* Put an itruncate log reservation in the new transaction * for our caller. */ -if ((error =xfs_trans_reserve (tp,0 ,XFS_ITRUNCATE_LOG_RES (mp),0 , -XFS_TRANS_PERM_LOG_RES ,XFS_ITRUNCATE_LOG_COUNT ))) { + error =xfs_trans_reserve (tp, &M_RES (mp)->tr_itruncate,0 ,0 ); +if (error) {ASSERT (XFS_FORCED_SHUTDOWN (mp)); goto error0; }
fs/xfs/xfs_trans.c +26 -25
111 lines not on this page · raw message
fs/xfs/xfs_trans.h +2 -1
@@ -34,6 +34,7 @@ struct xfs_log_iovec;struct xfs_log_item_desc ;struct xfs_mount ;struct xfs_trans ; +struct xfs_trans_res ;struct xfs_dquot_acct ;struct xfs_busy_extent ;
@@ -170,7 +171,7 @@ typedef struct xfs_trans {xfs_trans_t *xfs_trans_alloc (struct xfs_mount *,uint );xfs_trans_t *_xfs_trans_alloc (struct xfs_mount *,uint ,xfs_km_flags_t );xfs_trans_t *xfs_trans_dup (xfs_trans_t *); -int xfs_trans_reserve (xfs_trans_t *,uint ,uint ,uint , +int xfs_trans_reserve (struct xfs_trans *,struct xfs_trans_res *,uint ,uint );void xfs_trans_mod_sb (xfs_trans_t *,uint ,int64_t );
fs/xfs/xfs_trans_resv.c +4 -3
@@ -547,7 +547,8 @@ xfs_calc_attrsetm_reservation(* Since the runtime attribute transaction space is dependent on the total * blocks needed for the 1st bmap, here we calculate out the space unit for * one block so that the caller could figure out the total space according -* to the attibute extent length in blocks by: ext * XFS_ATTRSETRT_LOG_RES(mp). +* to the attibute extent length in blocks by: +* ext * M_RES(mp)->tr_attrsetrt.tr_logres */ STATIC uint xfs_calc_attrsetrt_reservation(
@@ -619,14 +620,14 @@ xfs_calc_qm_setqlim_reservation(/* * Allocating quota on disk if needed. -* the write transaction log space: XFS_WRITE_LOG_RES(mp) +* the write transaction log space: M_RES(mp)->tr_write.tr_logres * the unit of quota allocation: one system block size */ STATIC uintxfs_calc_qm_dqalloc_reservation (struct xfs_mount *mp) { -return XFS_WRITE_LOG_RES (mp) + +return M_RES (mp)->tr_write.tr_logres +xfs_calc_buf_res (1 ,XFS_FSB_TO_B (mp,XFS_DQUOT_CLUSTER_SIZE_FSB ) -1 ); }
fs/xfs/xfs_trans_resv.h +3 -0
@@ -65,6 +65,9 @@ struct xfs_trans_resv {struct xfs_trans_res tr_fsyncts;/* update timestamps on fsync */ }; +/* shorthand way of accessing reservation structure */ +#define M_RES (mp) (&(mp)->m_resv) +/* * Per-extent log reservation for the allocation btree changes * involved in freeing or allocating an extent.
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 38/49] xfs: refactor xfs_trans_reserve() interface
Quoted 15 lines · Dave Chinner
From: Jie Liu<[email protected]>
With the new
xfs_trans_resstructure has been introduced, the log reservation size, log count as well as log flags are pre-initialized at mount time. So it's time to refinexfs_trans_reserve()interface to be more neat.Also, introduce a new helper
M_RES()to return a pointer to themp->m_resvstructure to simplify the input.Signed-off-by Jie Liu<[email protected]>Signed-off-by Dave Chinner<[email protected]>---
fs/xfs/xfs_trans_resv.h struct xfs_trans_resv { · line 69
Quoted 2 lines
fs/xfs/xfs_trans_resv.h +2
-0+/* shorthand way of accessing reservation structure */ +#define M_RES (mp) (&(mp)->m_resv)
Not a fan of this define- it does not buy much savings in text and clarity.
Beside my anti-shouty rant, the patch looks good.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 38/49] xfs: refactor xfs_trans_reserve() interface
Quoted 16 lines · Mark Tinguely
Quoted 13 lines · Dave Chinner
From: Jie Liu<[email protected]>
With the new
xfs_trans_resstructure has been introduced, the log reservation size, log count as well as log flags are pre-initialized at mount time. So it's time to refinexfs_trans_reserve()interface to be more neat.Also, introduce a new helper
M_RES()to return a pointer to themp->m_resvstructure to simplify the input.Signed-off-by Jie Liu<[email protected]>Signed-off-by Dave Chinner<[email protected]>---
Quoted 6 lines
fs/xfs/xfs_trans_resv.h struct xfs_trans_resv { · line 69
Quoted 2 lines
fs/xfs/xfs_trans_resv.h +2
-0+/* shorthand way of accessing reservation structure */ +#define M_RES (mp) (&(mp)->m_resv)Not a fan of this define- it does not buy much savings in text and clarity.
Beside my anti-shouty rant, the patch looks good.
It's designed to be similar to XFS_I, VFS_I and XFS_M. i.e. short, unique, obviously correct and easy to type. I can change it if you want - I couldn't really think up a better name...
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
PATCH 39/49 xfs: Get rid of all XFS_XXX_LOG_RES() macro
In reply to Dave ChinnerFrom: Jie Liu <[email protected]>
Get rid of all XFS_XXX_LOG_RES() macros since they are obsoleted now.
--- fs/xfs/xfs_trans_resv.h | 36 ------------------------------------ 1 file changed, 36 deletions(-)
fs/xfs/xfs_trans_resv.h +0 -36
@@ -92,42 +92,6 @@ struct xfs_trans_resv { (XFS_DAENTER_BLOCKS (mp,XFS_DATA_FORK ) + \XFS_DAENTER_BMAPS (mp,XFS_DATA_FORK ) +1 ) - -#define XFS_WRITE_LOG_RES (mp) ((mp)->m_resv.tr_write.tr_logres) -#define XFS_RENAME_LOG_RES (mp) ((mp)->m_resv.tr_rename.tr_logres) -#define XFS_LINK_LOG_RES (mp) ((mp)->m_resv.tr_link.tr_logres) -#define XFS_REMOVE_LOG_RES (mp) ((mp)->m_resv.tr_remove.tr_logres) -#define XFS_SYMLINK_LOG_RES (mp) ((mp)->m_resv.tr_symlink.tr_logres) -#define XFS_CREATE_LOG_RES (mp) ((mp)->m_resv.tr_create.tr_logres) -#define XFS_MKDIR_LOG_RES (mp) ((mp)->m_resv.tr_mkdir.tr_logres) -#define XFS_IFREE_LOG_RES (mp) ((mp)->m_resv.tr_ifree.tr_logres) -#define XFS_SWRITE_LOG_RES (mp) ((mp)->m_resv.tr_swrite.tr_logres) -#define XFS_ICHANGE_LOG_RES (mp) ((mp)->m_resv.tr_ichange.tr_logres) -#define XFS_GROWDATA_LOG_RES (mp) ((mp)->m_resv.tr_growdata.tr_logres) -#define XFS_ITRUNCATE_LOG_RES (mp) ((mp)->m_resv.tr_itruncate.tr_logres) -#define XFS_GROWRTZERO_LOG_RES (mp) ((mp)->m_resv.tr_growrtzero.tr_logres) -#define XFS_GROWRTFREE_LOG_RES (mp) ((mp)->m_resv.tr_growrtfree.tr_logres) -#define XFS_GROWRTALLOC_LOG_RES (mp) ((mp)->m_resv.tr_growrtalloc.tr_logres) - -/* -* Logging the inode timestamps on an fsync -- same as SWRITE -* as long as SWRITE logs the entire inode core -*/ -#define XFS_FSYNC_TS_LOG_RES (mp) ((mp)->m_resv.tr_fsyncts.tr_logres) -#define XFS_WRITEID_LOG_RES (mp) ((mp)->m_resv.tr_writeid.tr_logres) -#define XFS_ADDAFORK_LOG_RES (mp) ((mp)->m_resv.tr_addafork.tr_logres) -#define XFS_ATTRSETM_LOG_RES (mp) ((mp)->m_resv.tr_attrsetm.tr_logres) -#define XFS_ATTRINVAL_LOG_RES (mp) ((mp)->m_resv.tr_attrinval.tr_logres) -#define XFS_ATTRSETRT_LOG_RES (mp) ((mp)->m_resv.tr_attrsetrt.tr_logres) -#define XFS_ATTRRM_LOG_RES (mp) ((mp)->m_resv.tr_attrrm.tr_logres) -#define XFS_SB_LOG_RES (mp) ((mp)->m_resv.tr_sb.tr_logres) -#define XFS_QM_SETQLIM_LOG_RES (mp) ((mp)->m_resv.tr_qm_setqlim.tr_logres) -#define XFS_QM_DQALLOC_LOG_RES (mp) ((mp)->m_resv.tr_qm_dqalloc.tr_logres) -#define XFS_QM_SBCHANGE_LOG_RES (mp) ((mp)->m_resv.tr_qm_sbchange.tr_logres) -#define XFS_QM_QUOTAOFF_LOG_RES (mp) ((mp)->m_resv.tr_qm_quotaoff.tr_logres) -#define XFS_QM_QUOTAOFF_END_LOG_RES (mp) ((mp)->m_resv.tr_qm_equotaoff.tr_logres) -#define XFS_CLEAR_AGI_BUCKET_LOG_RES (mp) ((mp)->m_resv.tr_clearagi.tr_logres) -/* * Various log count values. */
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 39/49] xfs: Get rid of all XFS_XXX_LOG_RES() macro
Quoted 7 lines · Dave Chinner
From: Jie Liu<[email protected]>
Get rid of all
XFS_XXX_LOG_RES()macros since they are obsoleted now.Signed-off-by Jie Liu<[email protected]>Signed-off-by Dave Chinner<[email protected]>---
Looks good.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 40/49 xfs: Refactor xfs_ticket_alloc() to extract a new helper
In reply to Dave ChinnerFrom: Jie Liu <[email protected]>
Refactor xlog_ticket_alloc() to extract a new helper, i.e. xfs_log_calc_unit_res().
This helper would be used to calculate the total log reservation size by adding extra log operation/transation headers for a new log ticket.
--- fs/xfs/xfs_log.c | 60 +++++++++++++++++++++++++++++++------------------ fs/xfs/xfs_log_format.h | 4 ++++ 2 files changed, 42 insertions(+), 22 deletions(-)
fs/xfs/xfs_log.c +38 -22
@@ -3391,24 +3391,17 @@ xfs_log_ticket_get( }/* -* Allocate and initialise a new log ticket. +* Figure out the total log space unit (in bytes) that would be +* required for a log ticket. */ -struct xlog_ticket * -xlog_ticket_alloc ( -struct xlog *log, -int unit_bytes, -int cnt, -char client, -bool permanent, -xfs_km_flags_t alloc_flags) +int +xfs_log_calc_unit_res ( +struct xfs_mount *mp, +int unit_bytes) { -struct xlog_ticket *tic; -uint num_headers; -int iclog_space; - - tic =kmem_zone_zalloc (xfs_log_ticket_zone, alloc_flags); -if (!tic) -return NULL ; +struct xlog *log = mp->m_log; +int iclog_space; +uint num_headers;/* * Permanent reservations have up to 'cnt'-1 active log operations
@@ -3483,20 +3476,43 @@ xlog_ticket_alloc( unit_bytes += log->l_iclog_hsize;/* for roundoff padding for transaction data and one for commit record */ -if (xfs_sb_version_haslogv2 (&log->l_mp->m_sb) && - log->l_mp->m_sb.sb_logsunit >1 ) { +if (xfs_sb_version_haslogv2 (&mp->m_sb) && mp->m_sb.sb_logsunit >1 ) {/* log su roundoff */ - unit_bytes +=2 *log->l_mp->m_sb.sb_logsunit; + unit_bytes +=2 * mp->m_sb.sb_logsunit; }else {/* BB roundoff */ - unit_bytes +=2 *BBSIZE ; + unit_bytes +=2 *BBSIZE ; } +return unit_bytes; +} + +/* +* Allocate and initialise a new log ticket. +*/ +struct xlog_ticket * +xlog_ticket_alloc ( +struct xlog *log, +int unit_bytes, +int cnt, +char client, +bool permanent, +xfs_km_flags_t alloc_flags) +{ +struct xlog_ticket *tic; +int unit_res; + + tic =kmem_zone_zalloc (xfs_log_ticket_zone, alloc_flags); +if (!tic) +return NULL ; + + unit_res =xfs_log_calc_unit_res (log->l_mp, unit_bytes); +atomic_set (&tic->t_ref,1 ); tic->t_task = current;INIT_LIST_HEAD (&tic->t_queue); - tic->t_unit_res = unit_bytes; - tic->t_curr_res = unit_bytes; + tic->t_unit_res = unit_res; + tic->t_curr_res = unit_res; tic->t_cnt = cnt; tic->t_ocnt = cnt; tic->t_tid =prandom_u32 ();
fs/xfs/xfs_log_format.h +4 -0
@@ -18,6 +18,8 @@#ifndef __XFS_LOG_FORMAT_H__#define __XFS_LOG_FORMAT_H__ +struct xfs_mount ; +/* * On-disk Log Format definitions. *
@@ -834,4 +836,6 @@ struct xfs_icreate_log { __be32 icl_gen; /* inode generation number to use */ }; +int xfs_log_calc_unit_res (struct xfs_mount *mp,int unit_bytes); +#endif /* __XFS_LOG_FORMAT_H__ */
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 40/49] xfs: Refactor xfs_ticket_alloc() to extract a new helper
Quoted 5 lines · Dave Chinner
From: Jie Liu<[email protected]>
Refactor
xlog_ticket_alloc()to extract a new helper, i.e.xfs_log_calc_unit_res().
Quoted 7 lines
This helper would be used to calculate the total log reservation size by adding extra log operation/transation headers for a new log ticket.
Signed-off-by Jie Liu<[email protected]>Signed-off-by Dave Chinner<[email protected]>---
Looks good.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 41/49 xfs: Add xfs_log_rlimit.c
In reply to Dave ChinnerFrom: Jie Liu <[email protected]>
Add source files for xfs_log_rlimit.c The new file is used for log size calculations and validation shared with userspace.
[dchinner: xfs_log_calc_max_attrsetm_res() does not modify the tr_attrsetm reservation, just calculates the maximum. ]
[dchinner: rework loop in xfs_log_get_max_trans_res() ]
--- fs/xfs/Makefile | 1 + fs/xfs/xfs_log_format.h | 7 ++- fs/xfs/xfs_log_rlimit.c | 145 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 152 insertions(+), 1 deletion(-) create mode 100644 fs/xfs/xfs_log_rlimit.c
fs/xfs/Makefile +1 -0
@@ -79,6 +79,7 @@ xfs-y += xfs_alloc.o \ xfs_inode_fork.o \ xfs_inode_buf.o \ xfs_log_recover.o \ + xfs_log_rlimit.o \ xfs_sb.o \ xfs_symlink_remote.o \ xfs_trans_resv.o
fs/xfs/xfs_log_format.h +6 -1
@@ -19,6 +19,7 @@#define __XFS_LOG_FORMAT_H__struct xfs_mount ; +struct xfs_trans_res ;/* * On-disk Log Format definitions.
@@ -51,6 +52,9 @@ typedef __uint32_t xlog_tid_t;#define XLOG_HEADER_SIZE 512 +/* Minimum number of transactions that must fit in the log (defined by mkfs) */ +#define XFS_MIN_LOG_FACTOR 3 +#define XLOG_REC_SHIFT (log) \ BTOBB(1 << (xfs_sb_version_haslogv2(&log->l_mp->m_sb) ? \ XLOG_MAX_RECORD_BSHIFT : XLOG_BIG_RECORD_BSHIFT))
@@ -135,7 +139,6 @@ typedef struct xlog_op_header {__u16 oh_res2;/* 32 bit align : 2 b */ } xlog_op_header_t; -/* valid values for h_fmt */ #define XLOG_FMT_UNKNOWN 0#define XLOG_FMT_LINUX_LE 1
@@ -837,5 +840,7 @@ struct xfs_icreate_log { };int xfs_log_calc_unit_res (struct xfs_mount *mp,int unit_bytes); +int xfs_log_calc_minimum_size (struct xfs_mount *); +#endif /* __XFS_LOG_FORMAT_H__ */
fs/xfs/xfs_log_rlimit.c new file +145 -0
145 lines not on this page · raw message
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 41/49] xfs: Add xfs_log_rlimit.c
Quoted 14 lines · Dave Chinner
From: Jie Liu<[email protected]>
Add source files for
xfs_log_rlimit.cThe new file is used for log size calculations and validation shared with userspace.[dchinner:
xfs_log_calc_max_attrsetm_res()does not modify thetr_attrsetmreservation, just calculates the maximum. ][dchinner: rework loop in
xfs_log_get_max_trans_res()]Signed-off-by Jie Liu<[email protected]>Signed-off-by Dave Chinner<[email protected]>---
fs/xfs/xfs_log_rlimit.c line 142
Quoted 4 lines
fs/xfs/xfs_log_rlimit.c new file +4
-0+if (lsunit) + min_logblks =roundup (BTOBB (max_logres), lsunit) +2 * lsunit; +else + min_logblks =BTOBB (max_logres);
^^ The space is not really needed when using the below multiplier, but add the 2 * BBSIZE size just to be consistent?
fs/xfs/xfs_log_rlimit.c line 143
Quoted 1 line
fs/xfs/xfs_log_rlimit.c new file +1
-0+ min_logblks *=XFS_MIN_LOG_FACTOR ;
^^ okay, a 3 times multiplier of the max transaction and an additional log stripe unit padding will more than make up for all my CIL/CTX concerns.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
PATCH 42/49 xfs: Validate log space at mount time
In reply to Dave ChinnerFrom: Jie Liu <[email protected]>
Validate log space during log mount stage, the underlying function will drop a warning message via syslog in critical level if the log space is too small or too large.
[ dchinner: For CRC enable filesystems, abort the mounting of the filesystem as mkfs should never make a log too small for the given filesystem configuration. ]
--- fs/xfs/xfs_log.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-)
fs/xfs/xfs_log.c +48 -1
@@ -614,7 +614,9 @@ xfs_log_mount(xfs_daddr_t blk_offset, int num_bblks) { - int error; + int error = 0; +int min_logfsbs; +int max_logfsbs;if (!(mp->m_flags &XFS_MOUNT_NORECOVERY ))xfs_notice (mp,"Mounting Filesystem" );
@@ -631,6 +633,51 @@ xfs_log_mount( }/* +* Validate the given log space and drop a critical message via syslog +* if the log size is too small that would lead to some unexpected +* situations in transaction log space reservation stage. +* +* Note: we can't just reject the mount if the validation fails. This +* would mean that people would have to downgrade their kernel just to +* remedy the situation as there is no way to grow the log (short of +* black magic surgery with xfs_db). +* +* We can, however, reject mounts for CRC format filesystems, as the +* mkfs binary being used to make the filesystem should never create a +* filesystem with a log that is too small. +*/ + min_logfsbs =xfs_log_calc_minimum_size (mp); + max_logfsbs =XFS_BB_TO_FSB (mp,XFS_MAX_LOG_BLOCKS ); + +if (mp->m_sb.sb_logblocks < min_logfsbs) { +xfs_warn (mp, +"Log size %d blocks too small, minimum size is %d blocks" , + mp->m_sb.sb_logblocks, min_logfsbs); + error =EINVAL ; + }else if (mp->m_sb.sb_logblocks > max_logfsbs) { +xfs_warn (mp, +"Log size %d blocks too large, maximum size is %d blocks" , + mp->m_sb.sb_logblocks, max_logfsbs); + error =EINVAL ; + }else if (XFS_FSB_TO_B (mp, mp->m_sb.sb_logblocks) >XFS_MAX_LOG_BYTES ) { +xfs_warn (mp, +"log size %lld bytes too large, maximum size is %lld bytes" , +XFS_FSB_TO_B (mp, mp->m_sb.sb_logblocks), +XFS_MAX_LOG_BYTES ); + error =EINVAL ; + } +if (error) { +if (xfs_sb_version_hascrc (&mp->m_sb)) { +xfs_crit (mp,"AAIEEE! Log failed size checks. Abort!" ); +ASSERT (0 ); + goto out_free_log; + } +xfs_crit (mp, +"Log size out of supported range. Continuing onwards, but if log hangs are\n" +"experienced then please report this message in the bug report." ); + } + +/* * Initialize the AIL now we have a log. */ error =xfs_trans_ail_init (mp);
Signature · 6 lines
1.8.3.2 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Re: [PATCH 42/49] xfs: Validate log space at mount time
Quoted 6 lines · Dave Chinner
From: Jie Liu<[email protected]>
Validate log space during log mount stage, the underlying function will drop a warning message via syslog in critical level if the log space is too small or too large.
Quoted 7 lines
[ dchinner: For CRC enable filesystems, abort the mounting of the filesystem as mkfs should never make a log too small for the given filesystem configuration. ]
Signed-off-by Jie Liu<[email protected]>Signed-off-by Dave Chinner<[email protected]>---
Looks good.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs