diff options
author | Andreas Gruenbacher <agruenba@redhat.com> | 2017-11-14 10:53:12 -0500 |
---|---|---|
committer | Bob Peterson <rpeterso@redhat.com> | 2018-01-18 16:18:53 -0500 |
commit | 235628c5c76040b0ec206ea9ab9e017771e0d78e (patch) | |
tree | ab8a3c322a8d59ab5814a14d61f9cf6050d0d0d7 /fs/gfs2/inode.c | |
parent | 9db115a0e3d3814e41eb703082b83a261d81736c (diff) |
gfs2: Add gfs2_max_stuffed_size
Add a small inline function for computing the maximum size of a stuffed
inode instead of open coding that in several places throughout the code.
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Diffstat (limited to 'fs/gfs2/inode.c')
-rw-r--r-- | fs/gfs2/inode.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index 4e971b1c7f92..20281992d456 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c | |||
@@ -1184,11 +1184,10 @@ out_inodes: | |||
1184 | static int gfs2_symlink(struct inode *dir, struct dentry *dentry, | 1184 | static int gfs2_symlink(struct inode *dir, struct dentry *dentry, |
1185 | const char *symname) | 1185 | const char *symname) |
1186 | { | 1186 | { |
1187 | struct gfs2_sbd *sdp = GFS2_SB(dir); | ||
1188 | unsigned int size; | 1187 | unsigned int size; |
1189 | 1188 | ||
1190 | size = strlen(symname); | 1189 | size = strlen(symname); |
1191 | if (size > sdp->sd_sb.sb_bsize - sizeof(struct gfs2_dinode) - 1) | 1190 | if (size >= gfs2_max_stuffed_size(GFS2_I(dir))) |
1192 | return -ENAMETOOLONG; | 1191 | return -ENAMETOOLONG; |
1193 | 1192 | ||
1194 | return gfs2_create_inode(dir, dentry, NULL, S_IFLNK | S_IRWXUGO, 0, symname, size, 0, NULL); | 1193 | return gfs2_create_inode(dir, dentry, NULL, S_IFLNK | S_IRWXUGO, 0, symname, size, 0, NULL); |
@@ -1205,8 +1204,7 @@ static int gfs2_symlink(struct inode *dir, struct dentry *dentry, | |||
1205 | 1204 | ||
1206 | static int gfs2_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) | 1205 | static int gfs2_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) |
1207 | { | 1206 | { |
1208 | struct gfs2_sbd *sdp = GFS2_SB(dir); | 1207 | unsigned dsize = gfs2_max_stuffed_size(GFS2_I(dir)); |
1209 | unsigned dsize = sdp->sd_sb.sb_bsize - sizeof(struct gfs2_dinode); | ||
1210 | return gfs2_create_inode(dir, dentry, NULL, S_IFDIR | mode, 0, NULL, dsize, 0, NULL); | 1208 | return gfs2_create_inode(dir, dentry, NULL, S_IFDIR | mode, 0, NULL, dsize, 0, NULL); |
1211 | } | 1209 | } |
1212 | 1210 | ||