1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35#include <linux/fs.h>
36#include <linux/types.h>
37#include <linux/slab.h>
38#include <linux/pagemap.h>
39#include <linux/namei.h>
40
41#include <cluster/masklog.h>
42
43#include "ocfs2.h"
44
45#include "alloc.h"
46#include "file.h"
47#include "inode.h"
48#include "journal.h"
49#include "symlink.h"
50#include "xattr.h"
51
52#include "buffer_head_io.h"
53
54
55static int ocfs2_fast_symlink_readpage(struct file *unused, struct page *page)
56{
57 struct inode *inode = page->mapping->host;
58 struct buffer_head *bh = NULL;
59 int status = ocfs2_read_inode_block(inode, &bh);
60 struct ocfs2_dinode *fe;
61 const char *link;
62 void *kaddr;
63 size_t len;
64
65 if (status < 0) {
66 mlog_errno(status);
67 return status;
68 }
69
70 fe = (struct ocfs2_dinode *) bh->b_data;
71 link = (char *) fe->id2.i_symlink;
72
73 len = strnlen(link, ocfs2_fast_symlink_chars(inode->i_sb));
74 kaddr = kmap_atomic(page);
75 memcpy(kaddr, link, len + 1);
76 kunmap_atomic(kaddr);
77 SetPageUptodate(page);
78 unlock_page(page);
79 brelse(bh);
80 return 0;
81}
82
83const struct address_space_operations ocfs2_fast_symlink_aops = {
84 .readpage = ocfs2_fast_symlink_readpage,
85};
86
87const struct inode_operations ocfs2_symlink_inode_operations = {
88 .get_link = page_get_link,
89 .getattr = ocfs2_getattr,
90 .setattr = ocfs2_setattr,
91 .listxattr = ocfs2_listxattr,
92 .fiemap = ocfs2_fiemap,
93};
94