mirror of
https://github.com/FEX-Emu/linux.git
synced 2025-01-17 15:08:54 +00:00
drbd: Eliminated the user of drbd_task_to_thread()
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com> Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
This commit is contained in:
parent
bed879ae90
commit
bc31fe3352
@ -1133,10 +1133,10 @@ extern int drbd_thread_start(struct drbd_thread *thi);
|
|||||||
extern void _drbd_thread_stop(struct drbd_thread *thi, int restart, int wait);
|
extern void _drbd_thread_stop(struct drbd_thread *thi, int restart, int wait);
|
||||||
extern char *drbd_task_to_thread_name(struct drbd_conf *mdev, struct task_struct *task);
|
extern char *drbd_task_to_thread_name(struct drbd_conf *mdev, struct task_struct *task);
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_SMP
|
||||||
extern void drbd_thread_current_set_cpu(struct drbd_conf *mdev);
|
extern void drbd_thread_current_set_cpu(struct drbd_conf *mdev, struct drbd_thread *thi);
|
||||||
extern void drbd_calc_cpu_mask(struct drbd_conf *mdev);
|
extern void drbd_calc_cpu_mask(struct drbd_conf *mdev);
|
||||||
#else
|
#else
|
||||||
#define drbd_thread_current_set_cpu(A) ({})
|
#define drbd_thread_current_set_cpu(A, B) ({})
|
||||||
#define drbd_calc_cpu_mask(A) ({})
|
#define drbd_calc_cpu_mask(A) ({})
|
||||||
#endif
|
#endif
|
||||||
extern void drbd_free_resources(struct drbd_conf *mdev);
|
extern void drbd_free_resources(struct drbd_conf *mdev);
|
||||||
|
@ -635,17 +635,15 @@ void drbd_calc_cpu_mask(struct drbd_conf *mdev)
|
|||||||
/**
|
/**
|
||||||
* drbd_thread_current_set_cpu() - modifies the cpu mask of the _current_ thread
|
* drbd_thread_current_set_cpu() - modifies the cpu mask of the _current_ thread
|
||||||
* @mdev: DRBD device.
|
* @mdev: DRBD device.
|
||||||
|
* @thi: drbd_thread object
|
||||||
*
|
*
|
||||||
* call in the "main loop" of _all_ threads, no need for any mutex, current won't die
|
* call in the "main loop" of _all_ threads, no need for any mutex, current won't die
|
||||||
* prematurely.
|
* prematurely.
|
||||||
*/
|
*/
|
||||||
void drbd_thread_current_set_cpu(struct drbd_conf *mdev)
|
void drbd_thread_current_set_cpu(struct drbd_conf *mdev, struct drbd_thread *thi)
|
||||||
{
|
{
|
||||||
struct task_struct *p = current;
|
struct task_struct *p = current;
|
||||||
struct drbd_thread *thi = drbd_task_to_thread(mdev, p);
|
|
||||||
|
|
||||||
if (!expect(thi != NULL))
|
|
||||||
return;
|
|
||||||
if (!thi->reset_cpu_mask)
|
if (!thi->reset_cpu_mask)
|
||||||
return;
|
return;
|
||||||
thi->reset_cpu_mask = 0;
|
thi->reset_cpu_mask = 0;
|
||||||
|
@ -3773,7 +3773,7 @@ static void drbdd(struct drbd_conf *mdev)
|
|||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
while (get_t_state(&mdev->tconn->receiver) == RUNNING) {
|
while (get_t_state(&mdev->tconn->receiver) == RUNNING) {
|
||||||
drbd_thread_current_set_cpu(mdev);
|
drbd_thread_current_set_cpu(mdev, &mdev->tconn->receiver);
|
||||||
if (!drbd_recv_header(mdev, &cmd, &packet_size))
|
if (!drbd_recv_header(mdev, &cmd, &packet_size))
|
||||||
goto err_out;
|
goto err_out;
|
||||||
|
|
||||||
@ -4564,7 +4564,7 @@ int drbd_asender(struct drbd_thread *thi)
|
|||||||
current->rt_priority = 2; /* more important than all other tasks */
|
current->rt_priority = 2; /* more important than all other tasks */
|
||||||
|
|
||||||
while (get_t_state(thi) == RUNNING) {
|
while (get_t_state(thi) == RUNNING) {
|
||||||
drbd_thread_current_set_cpu(mdev);
|
drbd_thread_current_set_cpu(mdev, thi);
|
||||||
if (test_and_clear_bit(SEND_PING, &mdev->flags)) {
|
if (test_and_clear_bit(SEND_PING, &mdev->flags)) {
|
||||||
if (!drbd_send_ping(mdev)) {
|
if (!drbd_send_ping(mdev)) {
|
||||||
dev_err(DEV, "drbd_send_ping has failed\n");
|
dev_err(DEV, "drbd_send_ping has failed\n");
|
||||||
|
@ -1621,7 +1621,7 @@ int drbd_worker(struct drbd_thread *thi)
|
|||||||
sprintf(current->comm, "drbd%d_worker", mdev_to_minor(mdev));
|
sprintf(current->comm, "drbd%d_worker", mdev_to_minor(mdev));
|
||||||
|
|
||||||
while (get_t_state(thi) == RUNNING) {
|
while (get_t_state(thi) == RUNNING) {
|
||||||
drbd_thread_current_set_cpu(mdev);
|
drbd_thread_current_set_cpu(mdev, thi);
|
||||||
|
|
||||||
if (down_trylock(&mdev->tconn->data.work.s)) {
|
if (down_trylock(&mdev->tconn->data.work.s)) {
|
||||||
mutex_lock(&mdev->tconn->data.mutex);
|
mutex_lock(&mdev->tconn->data.mutex);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user