diff options
| -rw-r--r-- | fs/btrfs/inode.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index e064c49c9a9a..d241285a0d2a 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
| @@ -31,6 +31,7 @@ | |||
| 31 | #include <linux/uio.h> | 31 | #include <linux/uio.h> |
| 32 | #include <linux/magic.h> | 32 | #include <linux/magic.h> |
| 33 | #include <linux/iversion.h> | 33 | #include <linux/iversion.h> |
| 34 | #include <asm/unaligned.h> | ||
| 34 | #include "ctree.h" | 35 | #include "ctree.h" |
| 35 | #include "disk-io.h" | 36 | #include "disk-io.h" |
| 36 | #include "transaction.h" | 37 | #include "transaction.h" |
| @@ -5905,11 +5906,13 @@ static int btrfs_filldir(void *addr, int entries, struct dir_context *ctx) | |||
| 5905 | struct dir_entry *entry = addr; | 5906 | struct dir_entry *entry = addr; |
| 5906 | char *name = (char *)(entry + 1); | 5907 | char *name = (char *)(entry + 1); |
| 5907 | 5908 | ||
| 5908 | ctx->pos = entry->offset; | 5909 | ctx->pos = get_unaligned(&entry->offset); |
| 5909 | if (!dir_emit(ctx, name, entry->name_len, entry->ino, | 5910 | if (!dir_emit(ctx, name, get_unaligned(&entry->name_len), |
| 5910 | entry->type)) | 5911 | get_unaligned(&entry->ino), |
| 5912 | get_unaligned(&entry->type))) | ||
| 5911 | return 1; | 5913 | return 1; |
| 5912 | addr += sizeof(struct dir_entry) + entry->name_len; | 5914 | addr += sizeof(struct dir_entry) + |
| 5915 | get_unaligned(&entry->name_len); | ||
| 5913 | ctx->pos++; | 5916 | ctx->pos++; |
| 5914 | } | 5917 | } |
| 5915 | return 0; | 5918 | return 0; |
| @@ -5999,14 +6002,15 @@ again: | |||
| 5999 | } | 6002 | } |
| 6000 | 6003 | ||
| 6001 | entry = addr; | 6004 | entry = addr; |
| 6002 | entry->name_len = name_len; | 6005 | put_unaligned(name_len, &entry->name_len); |
| 6003 | name_ptr = (char *)(entry + 1); | 6006 | name_ptr = (char *)(entry + 1); |
| 6004 | read_extent_buffer(leaf, name_ptr, (unsigned long)(di + 1), | 6007 | read_extent_buffer(leaf, name_ptr, (unsigned long)(di + 1), |
| 6005 | name_len); | 6008 | name_len); |
| 6006 | entry->type = btrfs_filetype_table[btrfs_dir_type(leaf, di)]; | 6009 | put_unaligned(btrfs_filetype_table[btrfs_dir_type(leaf, di)], |
| 6010 | &entry->type); | ||
| 6007 | btrfs_dir_item_key_to_cpu(leaf, di, &location); | 6011 | btrfs_dir_item_key_to_cpu(leaf, di, &location); |
| 6008 | entry->ino = location.objectid; | 6012 | put_unaligned(location.objectid, &entry->ino); |
| 6009 | entry->offset = found_key.offset; | 6013 | put_unaligned(found_key.offset, &entry->offset); |
| 6010 | entries++; | 6014 | entries++; |
| 6011 | addr += sizeof(struct dir_entry) + name_len; | 6015 | addr += sizeof(struct dir_entry) + name_len; |
| 6012 | total_len += sizeof(struct dir_entry) + name_len; | 6016 | total_len += sizeof(struct dir_entry) + name_len; |
