Remove ifa_mtx. It was used only in one place in kernel, and ifnet's

ifaddr lock can substitute it there.

Discussed with:	melifaro, ae
Sponsored by:	Netflix
Sponsored by:	Nginx, Inc.
This commit is contained in:
glebius 2013-10-15 10:41:22 +00:00
parent 564d02b304
commit cb3115eac5
2 changed files with 2 additions and 8 deletions

View File

@ -1428,7 +1428,6 @@ ifa_alloc(size_t size, int flags)
if (ifa == NULL)
return (NULL);
mtx_init(&ifa->ifa_mtx, "ifaddr", NULL, MTX_DEF);
refcount_init(&ifa->ifa_refcnt, 1);
ifa->if_data.ifi_datalen = sizeof(ifa->if_data);
@ -1447,7 +1446,6 @@ ifa_free(struct ifaddr *ifa)
{
if (refcount_release(&ifa->ifa_refcnt)) {
mtx_destroy(&ifa->ifa_mtx);
free(ifa, M_IFADDR);
}
}
@ -2244,9 +2242,9 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, struct thread *td)
log(LOG_INFO, "%s: changing name to '%s'\n",
ifp->if_xname, new_name);
IF_ADDR_WLOCK(ifp);
strlcpy(ifp->if_xname, new_name, sizeof(ifp->if_xname));
ifa = ifp->if_addr;
IFA_LOCK(ifa);
sdl = (struct sockaddr_dl *)ifa->ifa_addr;
namelen = strlen(new_name);
onamelen = sdl->sdl_nlen;
@ -2265,7 +2263,7 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, struct thread *td)
bzero(sdl->sdl_data, onamelen);
while (namelen != 0)
sdl->sdl_data[--namelen] = 0xff;
IFA_UNLOCK(ifa);
IF_ADDR_WUNLOCK(ifp);
EVENTHANDLER_INVOKE(ifnet_arrival_event, ifp);
/* Announce the return of the interface. */

View File

@ -805,7 +805,6 @@ struct ifaddr {
int ifa_metric; /* cost of going out this interface */
int (*ifa_claim_addr) /* check if an addr goes to this if */
(struct ifaddr *, struct sockaddr *);
struct mtx ifa_mtx;
};
#endif
@ -816,9 +815,6 @@ struct ifaddr {
#define ifa_list ifa_link
#ifdef _KERNEL
#define IFA_LOCK(ifa) mtx_lock(&(ifa)->ifa_mtx)
#define IFA_UNLOCK(ifa) mtx_unlock(&(ifa)->ifa_mtx)
struct ifaddr * ifa_alloc(size_t size, int flags);
void ifa_free(struct ifaddr *ifa);
void ifa_ref(struct ifaddr *ifa);