123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- #include <linux/fs.h>
- #include <linux/types.h>
- #include <linux/slab.h>
- #include <linux/pagemap.h>
- #include <linux/namei.h>
- #include <cluster/masklog.h>
- #include "ocfs2.h"
- #include "alloc.h"
- #include "file.h"
- #include "inode.h"
- #include "journal.h"
- #include "symlink.h"
- #include "xattr.h"
- #include "buffer_head_io.h"
- static int ocfs2_fast_symlink_readpage(struct file *unused, struct page *page)
- {
- struct inode *inode = page->mapping->host;
- struct buffer_head *bh = NULL;
- int status = ocfs2_read_inode_block(inode, &bh);
- struct ocfs2_dinode *fe;
- const char *link;
- void *kaddr;
- size_t len;
- if (status < 0) {
- mlog_errno(status);
- return status;
- }
- fe = (struct ocfs2_dinode *) bh->b_data;
- link = (char *) fe->id2.i_symlink;
-
- len = strnlen(link, ocfs2_fast_symlink_chars(inode->i_sb));
- kaddr = kmap_atomic(page);
- memcpy(kaddr, link, len + 1);
- kunmap_atomic(kaddr);
- SetPageUptodate(page);
- unlock_page(page);
- brelse(bh);
- return 0;
- }
- const struct address_space_operations ocfs2_fast_symlink_aops = {
- .readpage = ocfs2_fast_symlink_readpage,
- };
- const struct inode_operations ocfs2_symlink_inode_operations = {
- .readlink = generic_readlink,
- .get_link = page_get_link,
- .getattr = ocfs2_getattr,
- .setattr = ocfs2_setattr,
- .listxattr = ocfs2_listxattr,
- .fiemap = ocfs2_fiemap,
- };
|