示例#1
0
文件: osc_io.c 项目: 383530895/linux
static int osc_io_commit_write(const struct lu_env *env,
			       const struct cl_io_slice *ios,
			       const struct cl_page_slice *slice,
			       unsigned from, unsigned to)
{
	struct osc_io	 *oio = cl2osc_io(env, ios);
	struct osc_page       *opg = cl2osc_page(slice);
	struct osc_object     *obj = cl2osc(opg->ops_cl.cpl_obj);
	struct osc_async_page *oap = &opg->ops_oap;

	LASSERT(to > 0);
	/*
	 * XXX instead of calling osc_page_touch() here and in
	 * osc_io_fault_start() it might be more logical to introduce
	 * cl_page_touch() method, that generic cl_io_commit_write() and page
	 * fault code calls.
	 */
	osc_page_touch(env, cl2osc_page(slice), to);
	if (!client_is_remote(osc_export(obj)) &&
	    capable(CFS_CAP_SYS_RESOURCE))
		oap->oap_brw_flags |= OBD_BRW_NOQUOTA;

	if (oio->oi_lockless)
		/* see osc_io_prepare_write() for lockless io handling. */
		cl_page_clip(env, slice->cpl_page, from, to);

	return 0;
}
示例#2
0
/* -------------------------------------------------------------------------- *
 * argv[0] - prefix                                                           *
 * argv[1] - 'invite'                                                         *
 * argv[2] - nick                                                             *
 * argv[3] - channel                                                          *
 * -------------------------------------------------------------------------- */
static void m_invite(struct lclient *lcptr, struct client *cptr,
                     int             argc,  char         **argv)
{
  struct channel *chptr;
  struct client  *acptr;

  if(client_is_local(cptr) && client_is_user(cptr))
  {
    if((acptr = client_find_nickhw(cptr, argv[2])) == NULL)
      return;
  }
  else
  {
    if((acptr = client_find_uid(argv[2])) == NULL)
      if((acptr = client_find_name(argv[2])) == NULL)
      {
        log(server_log, L_warning, "Dropping INVITE for invalid user %s.",
            argv[2]);
        return;
      }
  }

  if((chptr = channel_find_warn(cptr, argv[3])) == NULL)
    return;

  if(client_is_local(cptr))
    numeric_send(cptr, RPL_INVITING, acptr->name, chptr->name);

  if(client_is_service(acptr))
  {
    service_handle(acptr->service, lcptr, cptr, chptr, "INVITE", "%s",
                   argv[4] ? argv[4] : "");
  }
  else
  {
    if(client_is_remote(acptr))
    {
      if(argv[4])
        client_send(acptr, ":%C INVITE %C %s :%s",
                    cptr, acptr, chptr->name, argv[4]);
      else
        client_send(acptr, ":%C INVITE %C %s",
                    cptr, acptr, chptr->name);
    }
    else
    {
      user_invite(acptr->user, chptr);

      if(argv[4])
        client_send(acptr, ":%N!%U@%H INVITE %N %s :%s",
                    cptr, cptr, cptr, acptr, chptr->name, argv[4]);
      else
        client_send(acptr, ":%N!%U@%H INVITE %N %s",
                    cptr, cptr, cptr, acptr, chptr->name);
    }
  }
}