From: Frank Lahm Date: Tue, 17 Apr 2012 09:43:34 +0000 (+0200) Subject: Dont check for open forks attributes when enumerating, should speed it up X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=netatalk.git;a=commitdiff_plain;h=dcab74d18f4051a692d95d8411fa56054a5bbbff Dont check for open forks attributes when enumerating, should speed it up --- diff --git a/etc/afpd/appl.c b/etc/afpd/appl.c index e1e59db5..3cba16e0 100644 --- a/etc/afpd/appl.c +++ b/etc/afpd/appl.c @@ -484,7 +484,7 @@ int afp_getappl(AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf, size_t } buflen = *rbuflen - sizeof( bitmap ) - sizeof( appltag ); if ( getfilparams(obj, vol, bitmap, path, curdir, rbuf + sizeof( bitmap ) + - sizeof( appltag ), &buflen ) != AFP_OK ) { + sizeof( appltag ), &buflen, 0) != AFP_OK ) { *rbuflen = 0; return( AFPERR_BITMAP ); } diff --git a/etc/afpd/catsearch.c b/etc/afpd/catsearch.c index 81a4855d..71843e2c 100644 --- a/etc/afpd/catsearch.c +++ b/etc/afpd/catsearch.c @@ -454,7 +454,7 @@ static int rslt_add (const AFPObj *obj, struct vol *vol, struct path *path, char } else { /* FIXME slow if we need the file ID, we already know it, done ? */ - ret = getfilparams (obj, vol, c1.fbitmap, path, path->d_dir, p, &tbuf); + ret = getfilparams (obj, vol, c1.fbitmap, path, path->d_dir, p, &tbuf, 0); } if ( ret != AFP_OK ) diff --git a/etc/afpd/enumerate.c b/etc/afpd/enumerate.c index f77d34a5..d469928c 100644 --- a/etc/afpd/enumerate.c +++ b/etc/afpd/enumerate.c @@ -404,7 +404,7 @@ static int enumerate(AFPObj *obj _U_, char *ibuf, size_t ibuflen _U_, } /* files are added to the dircache in getfilparams() -> getmetadata() */ if (AFP_OK != ( ret = getfilparams(obj, vol, fbitmap, &s_path, curdir, - data + header , &esz )) ) { + data + header, &esz, 1)) ) { return( ret ); } } diff --git a/etc/afpd/file.c b/etc/afpd/file.c index d06d4684..67ac04c3 100644 --- a/etc/afpd/file.c +++ b/etc/afpd/file.c @@ -592,11 +592,8 @@ int getmetadata(const AFPObj *obj, } /* ----------------------- */ -int getfilparams(const AFPObj *obj, - struct vol *vol, - uint16_t bitmap, - struct path *path, struct dir *dir, - char *buf, size_t *buflen ) +int getfilparams(const AFPObj *obj, struct vol *vol, uint16_t bitmap, struct path *path, + struct dir *dir, char *buf, size_t *buflen, int in_enumerate) { struct adouble ad, *adp; int opened = 0; @@ -610,7 +607,12 @@ int getfilparams(const AFPObj *obj, if (opened) { char *upath; - flags = (bitmap & (1 << FILPBIT_ATTR)) ? ADFLAGS_CHECK_OF : 0; + /* + * Dont check for and resturn open fork attributes when enumerating + * This saves a lot of syscalls, the client will hopefully only use the result + * in FPGetFileParms where we return the correct value + */ + flags = (!in_enumerate &&(bitmap & (1 << FILPBIT_ATTR))) ? ADFLAGS_CHECK_OF : 0; adp = of_ad(vol, path, &ad); upath = path->u_name; @@ -1773,7 +1775,7 @@ retry: } path.id = cnid; if (AFP_OK != (err = getfilparams(obj, vol, bitmap, &path , curdir, - rbuf + sizeof(bitmap), &buflen))) { + rbuf + sizeof(bitmap), &buflen, 0))) { return err; } *rbuflen = buflen + sizeof(bitmap); diff --git a/etc/afpd/file.h b/etc/afpd/file.h index 937395e5..aa9f3b44 100644 --- a/etc/afpd/file.h +++ b/etc/afpd/file.h @@ -109,8 +109,7 @@ extern struct extmap *getextmap (const char *); extern struct extmap *getdefextmap (void); extern int getfilparams (const AFPObj *obj, struct vol *, uint16_t, struct path *, - struct dir *, char *buf, size_t *); - + struct dir *, char *buf, size_t *, int); extern int setfilparams (const AFPObj *obj, struct vol *, struct path *, uint16_t, char *); extern int renamefile (const struct vol *, int, char *, char *, char *, struct adouble *); extern int copyfile (const struct vol *, const struct vol *, int, char *, char *, char *, struct adouble *); diff --git a/etc/afpd/filedir.c b/etc/afpd/filedir.c index 17473d19..56cbaccf 100644 --- a/etc/afpd/filedir.c +++ b/etc/afpd/filedir.c @@ -113,7 +113,7 @@ int afp_getfildirparams(AFPObj *obj _U_, char *ibuf, size_t ibuflen _U_, char *r *(rbuf + 2 * sizeof( uint16_t )) = (char) FILDIRBIT_ISDIR; } else { if (fbitmap && AFP_OK != (ret = getfilparams(obj, vol, fbitmap, s_path, curdir, - rbuf + 3 * sizeof( uint16_t ), &buflen )) ) { + rbuf + 3 * sizeof( uint16_t ), &buflen, 0)) ) { return( ret ); } /* this is a file */