From 92d8a53b4597487fb8d23a8b2334d854c87ad7e3 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 1 Nov 2007 10:21:27 -0700 Subject: Add missing recvfile_bytes element - noticed by Kukks. Jeremy. (This used to be commit 5cf2811e8e1d9e6a1114bbdff89c333d5b374282) --- source3/include/smbprofile.h | 1 + 1 file changed, 1 insertion(+) diff --git a/source3/include/smbprofile.h b/source3/include/smbprofile.h index acd8460965..864f2bf90f 100644 --- a/source3/include/smbprofile.h +++ b/source3/include/smbprofile.h @@ -741,6 +741,7 @@ struct profile_stats { unsigned syscall_read_bytes; unsigned syscall_write_bytes; unsigned syscall_sendfile_bytes; + unsigned syscall_recvfile_bytes; /* stat cache counters */ unsigned statcache_lookups; -- cgit From 456ca680f24f13e72a529e6e280b1fffa744a1ff Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 31 Oct 2007 15:06:22 +0100 Subject: save memory Hi! Attached find a patch that I've wanted to check in for ages. The whole area probably needs a major rewrite, but this is a minimal patch that on a 32-bit box saves 1.5k per smbd per defined share, twice as much on a 64-bit box. Volker From ebb80e664ecc49eb597a45cb57e1067fbae49e62 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 31 Oct 2007 15:04:34 +0100 Subject: [PATCH] Change global->copymap from bool* to a bitmap We right now have 401 parameters, so with bool being represented as a 64-bit integer this saves about 3k of memory per smbd per share that is defined in smb.conf. (This used to be commit 94f2c35a683eace7f9f3dad9748aaec93f7c534f) --- source3/param/loadparm.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index a5b2647567..163f4179a6 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -441,7 +441,7 @@ typedef struct { bool bStrictAllocate; bool bStrictSync; char magic_char; - bool *copymap; + struct bitmap *copymap; bool bDeleteReadonly; bool bFakeOplocks; bool bDeleteVetoFiles; @@ -2181,7 +2181,8 @@ static const char *get_boolean(bool bool_value); static int getservicebyname(const char *pszServiceName, service * pserviceDest); static void copy_service(service * pserviceDest, - service * pserviceSource, bool *pcopymapDest); + service * pserviceSource, + struct bitmap *pcopymapDest); static bool do_parameter(const char *pszParmName, const char *pszParmValue); static bool do_section(const char *pszSectionName); static void init_copymap(service * pservice); @@ -2455,7 +2456,7 @@ static void free_service(service *pservice) pservice->szService)); string_free(&pservice->szService); - SAFE_FREE(pservice->copymap); + bitmap_free(pservice->copymap); for (i = 0; parm_table[i].label; i++) { if ((parm_table[i].type == P_STRING || @@ -3188,7 +3189,8 @@ static int getservicebyname(const char *pszServiceName, service * pserviceDest) If pcopymapDest is NULL then copy all fields ***************************************************************************/ -static void copy_service(service * pserviceDest, service * pserviceSource, bool *pcopymapDest) +static void copy_service(service * pserviceDest, service * pserviceSource, + struct bitmap *pcopymapDest) { int i; bool bcopyall = (pcopymapDest == NULL); @@ -3197,7 +3199,7 @@ static void copy_service(service * pserviceDest, service * pserviceSource, bool for (i = 0; parm_table[i].label; i++) if (parm_table[i].ptr && parm_table[i].p_class == P_LOCAL && - (bcopyall || pcopymapDest[i])) { + (bcopyall || bitmap_query(pcopymapDest,i))) { void *def_ptr = parm_table[i].ptr; void *src_ptr = ((char *)pserviceSource) + PTR_DIFF(def_ptr, @@ -3244,9 +3246,8 @@ static void copy_service(service * pserviceDest, service * pserviceSource, bool if (bcopyall) { init_copymap(pserviceDest); if (pserviceSource->copymap) - memcpy((void *)pserviceDest->copymap, - (void *)pserviceSource->copymap, - sizeof(bool) * NUMPARAMETERS); + bitmap_copy(pserviceDest->copymap, + pserviceSource->copymap); } data = pserviceSource->param_opt; @@ -3985,15 +3986,17 @@ static bool handle_printing(int snum, const char *pszParmValue, char **ptr) static void init_copymap(service * pservice) { int i; - SAFE_FREE(pservice->copymap); - pservice->copymap = SMB_MALLOC_ARRAY(bool,NUMPARAMETERS); + if (pservice->copymap) { + bitmap_free(pservice->copymap); + } + pservice->copymap = bitmap_allocate(NUMPARAMETERS); if (!pservice->copymap) DEBUG(0, ("Couldn't allocate copymap!! (size %d)\n", (int)NUMPARAMETERS)); else for (i = 0; i < NUMPARAMETERS; i++) - pservice->copymap[i] = True; + bitmap_set(pservice->copymap, i); } /*************************************************************************** @@ -4095,7 +4098,7 @@ bool lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue the same data pointer */ for (i = 0; parm_table[i].label; i++) if (parm_table[i].ptr == parm_table[parmnum].ptr) - ServicePtrs[snum]->copymap[i] = False; + bitmap_clear(ServicePtrs[snum]->copymap, i); } /* if it is a special case then go ahead */ -- cgit From 0e073b8152103d9de9fc68cb5b0dfbb7c9b0327a Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 20 Oct 2007 11:12:11 +0200 Subject: Fix for bug 5021 This is a different fix than the bug reporter (Evgeniy Dushistov , thanks!) created, but it lives without the boolean status variable. Untested so far, but I can not add attachments to bugs right now. But to me this looks really obvious. (This used to be commit b481abf5914dcafe5642c4d9394d02603e905bbb) --- source3/libsmb/libsmbclient.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source3/libsmb/libsmbclient.c b/source3/libsmb/libsmbclient.c index 0b45cad3e1..ff434d275a 100644 --- a/source3/libsmb/libsmbclient.c +++ b/source3/libsmb/libsmbclient.c @@ -2671,7 +2671,11 @@ smbc_opendir_ctx(SMBCCTX *context, return NULL; } - ip_list = &server_addr; + ip_list = memdup(&server_addr, sizeof(server_addr)); + if (ip_list == NULL) { + errno = ENOMEM; + return NULL; + } count = 1; } -- cgit From 8bad80efb016dbd1aa392bbbc2b954d4dc9e3906 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 1 Nov 2007 18:30:02 -0700 Subject: Add brackets so as not to break the POSIX caps return. Jeremy. (This used to be commit 47dbddcb5361caa30ee60cf4e15bb50d557d1191) --- source3/smbd/trans2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 09a8fcc876..c9ea02969b 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -2738,8 +2738,8 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned CIFS_UNIX_EXTATTR_CAP| CIFS_UNIX_POSIX_PATH_OPERATIONS_CAP| CIFS_UNIX_LARGE_READ_CAP| - large_write ? - CIFS_UNIX_LARGE_WRITE_CAP : 0))); + (large_write ? + CIFS_UNIX_LARGE_WRITE_CAP : 0)))); break; } -- cgit