0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035 #include <linux/fs.h>
0036 #include <linux/types.h>
0037 #include <linux/slab.h>
0038 #include <linux/pagemap.h>
0039 #include <linux/namei.h>
0040
0041 #include <cluster/masklog.h>
0042
0043 #include "ocfs2.h"
0044
0045 #include "alloc.h"
0046 #include "file.h"
0047 #include "inode.h"
0048 #include "journal.h"
0049 #include "symlink.h"
0050 #include "xattr.h"
0051
0052 #include "buffer_head_io.h"
0053
0054
0055 static int ocfs2_fast_symlink_read_folio(struct file *f, struct folio *folio)
0056 {
0057 struct page *page = &folio->page;
0058 struct inode *inode = page->mapping->host;
0059 struct buffer_head *bh = NULL;
0060 int status = ocfs2_read_inode_block(inode, &bh);
0061 struct ocfs2_dinode *fe;
0062 const char *link;
0063 void *kaddr;
0064 size_t len;
0065
0066 if (status < 0) {
0067 mlog_errno(status);
0068 return status;
0069 }
0070
0071 fe = (struct ocfs2_dinode *) bh->b_data;
0072 link = (char *) fe->id2.i_symlink;
0073
0074 len = strnlen(link, ocfs2_fast_symlink_chars(inode->i_sb));
0075 kaddr = kmap_atomic(page);
0076 memcpy(kaddr, link, len + 1);
0077 kunmap_atomic(kaddr);
0078 SetPageUptodate(page);
0079 unlock_page(page);
0080 brelse(bh);
0081 return 0;
0082 }
0083
0084 const struct address_space_operations ocfs2_fast_symlink_aops = {
0085 .read_folio = ocfs2_fast_symlink_read_folio,
0086 };
0087
0088 const struct inode_operations ocfs2_symlink_inode_operations = {
0089 .get_link = page_get_link,
0090 .getattr = ocfs2_getattr,
0091 .setattr = ocfs2_setattr,
0092 .listxattr = ocfs2_listxattr,
0093 .fiemap = ocfs2_fiemap,
0094 };