From patchwork Tue Aug 25 15:02:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Goldwyn Rodrigues X-Patchwork-Id: 11735867 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 40A0016B1 for ; Tue, 25 Aug 2020 15:02:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 304162075F for ; Tue, 25 Aug 2020 15:02:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726697AbgHYPCk (ORCPT ); Tue, 25 Aug 2020 11:02:40 -0400 Received: from mx2.suse.de ([195.135.220.15]:52224 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726336AbgHYPCi (ORCPT ); Tue, 25 Aug 2020 11:02:38 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 8058EADDB for ; Tue, 25 Aug 2020 15:03:08 +0000 (UTC) From: Goldwyn Rodrigues To: linux-btrfs@vger.kernel.org Subject: [PATCH v3 0/2] btrfs: Enumerate and export exclusive operations Date: Tue, 25 Aug 2020 10:02:31 -0500 Message-Id: <20200825150233.30294-1-rgoldwyn@suse.de> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org This patch series enumerates the exlcusive operation currently being perfomed by the current filesystem and exports it in the sys filesytem at /sys/fs/btrfs//exclusive_operation. This would enable our tools to specify precisely which operation is running on why starting an exclusive operation failed. The series also adds a sysfs_notify() to alert userspace when the state changes, so userspace can perform select() on it to get notified of the change. This would enable us to enqueue a command which will wait for current exclusive operation to complete before issuing the next exclusive operation. This has been done synchronously as opposed to a background process, or else error collection (if any) will become a nightmare. For backward compatibility, the tools continue working as before if the sys file is not present. Changes since v1: - Corrected call for btrfs_start_exop() in btrfs_ioctl_dev_replace() - Use fsid_str[] instead of fsid[] to save on uuid_parse() Changes since v2: - Dropped patch to add additional balance information - modified (simplified) progs patches accordingly