aboutsummaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_symlink.h
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2013-04-03 16:11:19 +1100
committerBen Myers <bpm@sgi.com>2013-04-27 11:49:28 -0500
commitf948dd76dde021c050c7c35720dc066a8b9a5e35 (patch)
tree457f8097ba46f72ecb6417f96f890f9ee202f6cc /fs/xfs/xfs_symlink.h
parent19de7351a8eb82dc99745e60e8f43474831d99c7 (diff)
xfs: add CRC checks to remote symlinks
Add a header to the remote symlink block, containing location and owner information, as well as CRCs and LSN fields. This requires verifiers to be added to the remote symlink buffers for CRC enabled filesystems. This also fixes a bug reading multiple block symlinks, where the second block overwrites the first block when copying out the link name. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Ben Myers <bpm@sgi.com> Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_symlink.h')
-rw-r--r--fs/xfs/xfs_symlink.h34
1 files changed, 31 insertions, 3 deletions
diff --git a/fs/xfs/xfs_symlink.h b/fs/xfs/xfs_symlink.h
index 07bdabcc4158..b39398d2097c 100644
--- a/fs/xfs/xfs_symlink.h
+++ b/fs/xfs/xfs_symlink.h
@@ -17,16 +17,44 @@
#ifndef __XFS_SYMLINK_H
#define __XFS_SYMLINK_H 1
+struct xfs_mount;
+struct xfs_trans;
+struct xfs_inode;
+struct xfs_buf;
+struct xfs_ifork;
+struct xfs_name;
+
+#define XFS_SYMLINK_MAGIC 0x58534c4d /* XSLM */
+
+struct xfs_dsymlink_hdr {
+ __be32 sl_magic;
+ __be32 sl_offset;
+ __be32 sl_bytes;
+ __be32 sl_crc;
+ uuid_t sl_uuid;
+ __be64 sl_owner;
+ __be64 sl_blkno;
+ __be64 sl_lsn;
+};
+
/*
* The maximum pathlen is 1024 bytes. Since the minimum file system
- * blocksize is 512 bytes, we can get a max of 2 extents back from
- * bmapi.
+ * blocksize is 512 bytes, we can get a max of 3 extents back from
+ * bmapi when crc headers are taken into account.
*/
-#define XFS_SYMLINK_MAPS 2
+#define XFS_SYMLINK_MAPS 3
+
+#define XFS_SYMLINK_BUF_SPACE(mp, bufsize) \
+ ((bufsize) - (xfs_sb_version_hascrc(&(mp)->m_sb) ? \
+ sizeof(struct xfs_dsymlink_hdr) : 0))
+
+int xfs_symlink_blocks(struct xfs_mount *mp, int pathlen);
void xfs_symlink_local_to_remote(struct xfs_trans *tp, struct xfs_buf *bp,
struct xfs_inode *ip, struct xfs_ifork *ifp);
+extern const struct xfs_buf_ops xfs_symlink_buf_ops;
+
#ifdef __KERNEL__
int xfs_symlink(struct xfs_inode *dp, struct xfs_name *link_name,