]> arthur.barton.de Git - netatalk.git/commitdiff
Dont check for open forks attributes when enumerating, should speed it up
authorFrank Lahm <franklahm@googlemail.com>
Tue, 17 Apr 2012 09:43:34 +0000 (11:43 +0200)
committerFrank Lahm <franklahm@googlemail.com>
Tue, 17 Apr 2012 09:43:34 +0000 (11:43 +0200)
etc/afpd/appl.c
etc/afpd/catsearch.c
etc/afpd/enumerate.c
etc/afpd/file.c
etc/afpd/file.h
etc/afpd/filedir.c

index e1e59db5760f027050a660ac707f842397968ed9..3cba16e0c2ae7eab2fe07c28a4cbc6b11498ad85 100644 (file)
@@ -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 );
     }
index 81a4855d507ebb2e131fbab6edec76052348d97f..71843e2cd13237863791a396e9e389a8156dcf46 100644 (file)
@@ -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 )
index f77d34a522a91ce702ff80599540791684586548..d469928c357b465a5781d2f5f51c9aad51fb8a2e 100644 (file)
@@ -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 );
             }
         }
index d06d4684e40ef2750b024c5449ad61cff32b71ab..67ac04c3c4df28f995ff5817035f7791214a8d0f 100644 (file)
@@ -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);
index 937395e572baf9c240836c6ac5e86d8d3d16c158..aa9f3b4449a8ea386adf328e8b3f97d39cf759b6 100644 (file)
@@ -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 *);
index 17473d19e7788adc542e8c95f8d66ed4b0e28e08..56cbaccffff2d32d59697fb6acad396589284bca 100644 (file)
@@ -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 */