2 * linux/cluster/ssi/cfs/symlink.c
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of
7 * the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE
12 * or NON INFRINGEMENT. See the GNU General Public License for more
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 * Questions/Comments/Bugfixes to ssic-linux-devel@lists.sourceforge.net
21 * Copyright (C) 1992 Rick Sladkey
23 * Optimization changes Copyright (C) 1994 Florian La Roche
25 * Jun 7 1999, cache symlink lookups in the page cache. -DaveM
27 * Portions Copyright (C) 2001 Compaq Computer Corporation
29 * ocfs2 symlink handling code.
31 * Copyright (C) 2004, 2005 Oracle.
36 #include <linux/types.h>
37 #include <linux/slab.h>
38 #include <linux/pagemap.h>
39 #include <linux/namei.h>
41 #include <cluster/masklog.h>
52 #include "buffer_head_io.h"
55 static int ocfs2_fast_symlink_read_folio(struct file
*f
, struct folio
*folio
)
57 struct page
*page
= &folio
->page
;
58 struct inode
*inode
= page
->mapping
->host
;
59 struct buffer_head
*bh
= NULL
;
60 int status
= ocfs2_read_inode_block(inode
, &bh
);
61 struct ocfs2_dinode
*fe
;
71 fe
= (struct ocfs2_dinode
*) bh
->b_data
;
72 link
= (char *) fe
->id2
.i_symlink
;
73 /* will be less than a page size */
74 len
= strnlen(link
, ocfs2_fast_symlink_chars(inode
->i_sb
));
75 kaddr
= kmap_atomic(page
);
76 memcpy(kaddr
, link
, len
+ 1);
78 SetPageUptodate(page
);
84 const struct address_space_operations ocfs2_fast_symlink_aops
= {
85 .read_folio
= ocfs2_fast_symlink_read_folio
,
88 const struct inode_operations ocfs2_symlink_inode_operations
= {
89 .get_link
= page_get_link
,
90 .getattr
= ocfs2_getattr
,
91 .setattr
= ocfs2_setattr
,
92 .listxattr
= ocfs2_listxattr
,
93 .fiemap
= ocfs2_fiemap
,