Commit 39a7dc69 authored by Gabriel Krisman Bertazi's avatar Gabriel Krisman Bertazi
Browse files

lib: Hint to branch predictor about error paths.


Signed-off-by: default avatarGabriel Krisman Bertazi <krisman@collabora.co.uk>
parent 6042437e
......@@ -103,7 +103,7 @@ static int search_ci_path(struct dentry *parent, char *path, char *rpath)
int rpath_off = 0;
int ret = 0;
if (parent->fd < 0)
if (unlikely(parent->fd < 0))
return -ENOENT;
rpath_off = strlen(parent->component) - 1;
......@@ -123,7 +123,8 @@ static int search_ci_path(struct dentry *parent, char *path, char *rpath)
if (unlikely(!dentry)) {
dentry = dentry_create(component, parent);
if (!ci_lookup(parent, component, &ci_name)) {
if (unlikely(!ci_lookup(parent, component,
&ci_name))) {
ret = -ENOENT;
dentry_destroy(dentry);
goto out_close_parent;
......@@ -137,7 +138,7 @@ static int search_ci_path(struct dentry *parent, char *path, char *rpath)
rpath_off = concat_component_to_path(rpath, rpath_off,
dentry->component);
if (rpath_off < 0) {
if (unlikely(rpath_off < 0)) {
ret = -ENAMETOOLONG;
goto out_close_parent;
}
......@@ -155,7 +156,7 @@ static int search_ci_path(struct dentry *parent, char *path, char *rpath)
* need to open the next component as a directory and
* repeat. */
dentry->fd = open_directory(rpath);
if (parent->fd < 0) {
if (unlikely(parent->fd < 0)) {
ret = -ENOENT;
goto out;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment