]>
git.proxmox.com Git - ceph.git/blob - ceph/src/common/io_priority.cc
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2012 Red Hat
8 * This is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License version 2.1, as published by the Free Software
11 * Foundation. See file COPYING.
17 #include <sys/syscall.h> /* For SYS_xxx definitions */
22 #include "io_priority.h"
24 pid_t
ceph_gettid(void)
27 return syscall(SYS_gettid
);
33 int ceph_ioprio_set(int whence
, int who
, int ioprio
)
36 return syscall(SYS_ioprio_set
, whence
, who
, ioprio
);
42 int ceph_ioprio_string_to_class(const std::string
& s
)
45 std::transform(l
.begin(), l
.end(), l
.begin(), ::tolower
);
48 return IOPRIO_CLASS_IDLE
;
49 if (l
== "be" || l
== "besteffort" || l
== "best effort")
50 return IOPRIO_CLASS_BE
;
51 if (l
== "rt" || l
== "realtime" || l
== "real time")
52 return IOPRIO_CLASS_RT
;